Skip to content

Commit bc6102d

Browse files
committed
test(metadata-protocol): a draft save appends its own history row; assert the publish row by kind
Claude-Session: https://claude.ai/code/session_017ErfyP2Rx7XWHJA27QjyUi Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4f1eb9e commit bc6102d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎packages/metadata-protocol/src/sys-metadata-repository.contract.test.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,9 @@ describe('SysMetadataRepository — a declared ordered map: object `fields` (#21
639639
expect(published.version).toBe(hashSpec(body(MOVED), 'object'));
640640
expect(storedOrder(engine)).toEqual(MOVED);
641641
expect(Object.keys((await repo.get(ref))!.body.fields as object)).toEqual(MOVED);
642-
expect(engine.historyRows().map((r) => r.operation_type)).toEqual(['create', 'publish']);
642+
// The active create, the draft's own row, and the publish — the write the
643+
// order-blind hash used to skip.
644+
expect(engine.historyRows().map((r) => r.operation_type)).toEqual(['create', 'create', 'publish']);
643645
});
644646

645647
it('…while an identical re-save is still the no-op it was', async () => {
@@ -705,8 +707,8 @@ describe('SysMetadataRepository — a declared ordered map: object `fields` (#21
705707
await repo.promoteDraft(ref, { actor: 't', intent });
706708

707709
expect(storedOrder(engine)).toEqual(MOVED);
708-
const [publish] = engine.historyRows();
709-
expect(publish).toMatchObject({ operation_type: 'publish', previous_checksum: stamp });
710+
const publish = engine.historyRows().find((r) => r.operation_type === 'publish');
711+
expect(publish).toMatchObject({ previous_checksum: stamp });
710712
});
711713

712714
it('a reorder INTO sorted order is written, though its hash IS the stale stamp', async () => {
@@ -719,7 +721,8 @@ describe('SysMetadataRepository — a declared ordered map: object `fields` (#21
719721
await repo.promoteDraft(ref, { actor: 't', intent });
720722

721723
expect(storedOrder(engine)).toEqual(SORTED);
722-
expect(engine.historyRows().map((r) => r.operation_type)).toEqual(['publish']);
724+
// The draft's own row, then the publish the stale stamp would have skipped.
725+
expect(engine.historyRows().map((r) => r.operation_type)).toEqual(['create', 'publish']);
723726
});
724727
});
725728
});

0 commit comments

Comments
 (0)