Skip to content

Commit 0106395

Browse files
committed
fix(metadata-protocol): a lone prose key or none on an unlocked item is refused as adding lock keys, not setting a lock
Claude-Session: https://claude.ai/code/session_01ADzJtzYTLUfgrRZHxkagkX Co-authored-by: Claude <noreply@anthropic.com>
1 parent bc55905 commit 0106395

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎packages/metadata-protocol/src/protocol.save-door-lock-family.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ for (const writeFace of AUTHOR_FACES) {
227227
await protocol.saveMetaItem({ type: 'app', name, item: app(name), writeFace });
228228
for (const family of [{ _lock: 'full' }, { _lock: 'no-overlay' }, { _lock: 'no-delete' }, { _lock: 'none' }, { _lockReason: 'why' }]) {
229229
const err = await refusalOf(() => protocol.saveMetaItem({ type: 'app', name, item: app(name, family), writeFace }));
230-
expectLockFamilyRefusal(err, Object.keys(family), 'set a lock on it');
230+
// A lone prose key, or `none`, binds nothing: it adds keys, not a lock.
231+
expectLockFamilyRefusal(err, Object.keys(family), family._lock && family._lock !== 'none' ? 'set a lock on it' : 'add lock keys to it');
231232
}
232233
expect(storedFamily('app', name)).toEqual({});
233234
});

‎packages/metadata-protocol/src/protocol.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ function authoredLockFamilyRefusal(
11031103
const servedLock = served._lock ?? 'none';
11041104
const sentLock = sent._lock ?? 'none';
11051105
const effect = servedLock === 'none'
1106-
? 'set a lock on it'
1106+
? (sentLock === 'none' ? 'add lock keys to it' : 'set a lock on it')
11071107
: sentLock === 'none' ? 'remove its lock' : 'change its lock';
11081108
const err = new Error(
11091109
`Remove ${keys.map((key) => `\`${key}\``).join(', ')} from ${type} '${saveName}' and send it again. `

0 commit comments

Comments
 (0)