Skip to content

Commit 2d469b0

Browse files
committed
test(objectql): the shadowed row's rollback addresses the served pair row; changeset
Claude-Session: https://claude.ai/code/session_01Utp6CXdBvpJrhnHyW825Hb Co-authored-by: Claude <noreply@anthropic.com>
1 parent 005970d commit 2d469b0

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
Clause-②: no
6+
Metadata-protocol: none
7+
8+
fix(metadata-protocol): the per-item rollback (`POST /api/v1/meta/:type/:name/rollback`) restores into the row the by-name read naming no package serves. A `.custom` pair's declared override stored beside a row bound to its read-only base (a row saved before the named-base close and not yet moved) is now rolled back in place, and the base row is left untouched; before, the door read a package-agnostic binding, addressed the base row, and was refused `403 NOT_OVERRIDABLE` naming a row the caller never meant. The door takes no new parameter. A rollback whose served row is the base's own is still refused by the named-base close.

‎packages/objectql/src/protocol-packageless-overlay-migration.test.ts‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,17 @@ describe('[#28576] the close reaches only what the ceremony moves: every row it
609609
const pairRow = rowOf(VIEW, PAIR);
610610
expect(columnsOf(await read(protocol))).toEqual(['title']);
611611

612-
// The rollback's row is the first active row of the name in store
613-
// order (`resolveOverlayPackageBinding`): here the package-less one,
614-
// which is rolled back to its version 1.
615-
expect(await refusalOf((protocol as any).rollbackMetaItem({ type: 'view', name: VIEW, toVersion: 1 }))).toBeUndefined();
616-
expect(columnsOf(JSON.parse(String(rowOf(VIEW, null)!.metadata)))).toEqual(UNBOUND_COLUMNS);
612+
// [#29848] The rollback's row is the one the read serves, the pair's
613+
// declared row, never the first active row of the name in store order:
614+
// version 1 is the package-less row's undeclared body, so the override
615+
// write gate answers it there (D2), not the close, and nothing is written.
616+
const packagelessRow = rowOf(VIEW, null);
617+
const rolledBack = await refusalOf((protocol as any).rollbackMetaItem({ type: 'view', name: VIEW, toVersion: 1 }));
618+
expect(rolledBack).toMatchObject({ status: 403, code: 'NOT_OVERRIDABLE' });
619+
expect(rolledBack?.message).toContain('declares no override');
620+
expect(rolledBack?.message).not.toContain('os migrate packageless-overlays');
621+
expect(rowOf(VIEW, PAIR)).toEqual(pairRow);
622+
expect(rowOf(VIEW, null)).toEqual(packagelessRow);
617623
// The package-less save and DELETE are not the close's to refuse:
618624
// they are addressed as before the close (`packagelessAddress`: the
619625
// one bound row of the name, the pair's), so the override write gate
@@ -627,7 +633,7 @@ describe('[#28576] the close reaches only what the ceremony moves: every row it
627633
expect(rows(VIEW)).toEqual([[null, 'active']]);
628634
// …which leaves the package-less row movable: the ceremony's remedy.
629635
expect(dispositions(await census(protocol))).toEqual([`${VIEW}@active movable`]);
630-
expect(columnsOf(await read(protocol))).toEqual(UNBOUND_COLUMNS);
636+
expect(columnsOf(await read(protocol))).toEqual(EDITED_COLUMNS);
631637
});
632638

633639
it('CONTROL movable: the same stored row with no pair row beside it — its package-less rollback, save and DELETE are refused', async () => {

0 commit comments

Comments
 (0)