Skip to content

Commit 387ff2b

Browse files
committed
test(objectql): a base-bound unshipped locale moves as the pair's own member
Claude-Session: https://claude.ai/code/session_01ADHkmQZSg4zWtKMdRnKmKS Co-authored-by: Claude <noreply@anthropic.com>
1 parent d74ab15 commit 387ff2b

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

‎packages/objectql/src/environment-overlay-email-locale-restart.test.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,32 @@ describe('[#28904] the ceremony moves a row of a member the package does not shi
10281028
expect(rowsOf(stores, DIGEST).map((r) => [r.packageId, r.member, r.state])).toEqual([[PAIR, 'zh-CN', 'active']]);
10291029
});
10301030

1031+
it('[#29392] an unshipped locale in a row bound to the package itself (a save naming it, before that write was closed): listed bound, and moved into the pair as its own member', async () => {
1032+
const stores = new Map<string, Map<string, Record<string, unknown>>>();
1033+
const first = await boot(stores);
1034+
await (first.raw as any).getOverlayRepo().put(
1035+
{ type: T, name: DIGEST, org: 'env' },
1036+
{ ...template('zh-CN', `ADMIN ${DIGEST} zh-CN`), name: DIGEST, ...ENVELOPE },
1037+
{ parentVersion: null, actor: null, source: 'older-release', intent: 'override-artifact', packageId: PKG },
1038+
);
1039+
const { raw } = await boot(stores);
1040+
expect(rowsOf(stores, DIGEST).map((r) => [r.packageId, r.member])).toEqual([[PKG, 'zh-CN']]);
1041+
1042+
const listed = await census(raw);
1043+
expect(listed.rows.map((r: any) => [r.name, r.member, r.disposition, r.addedMember, r.base, r.boundToBase]))
1044+
.toEqual([[DIGEST, 'zh-CN', 'movable', 'zh-CN', PKG, true]]);
1045+
const result = await migrate(raw);
1046+
expect(result.outcomes).toEqual([{ id: listed.rows[0].id, outcome: 'moved', packageId: PAIR, addedMember: 'zh-CN' }]);
1047+
const stored = rowsOf(stores, DIGEST);
1048+
expect(stored.map((r) => [r.packageId, r.member, r.state])).toEqual([[PAIR, 'zh-CN', 'active']]);
1049+
expect(stored[0]!.body).not.toHaveProperty('overrides');
1050+
for (const served of [raw, (await boot(stores)).raw]) {
1051+
expect(await sentMember(served, DIGEST, 'zh-CN')).toMatchObject({ subject: `ADMIN ${DIGEST} zh-CN`, ...ENVELOPE });
1052+
expect((await sentMember(served, DIGEST, 'en-US'))?.subject).toBe('PKG digest en');
1053+
}
1054+
expect((await migrate(raw)).rows).toEqual([]);
1055+
});
1056+
10311057
it('an unshipped locale whose stored body declares the base: the declaration is dropped, as the pair\'s own member carries none', async () => {
10321058
const { stores, raw } = await withUnboundZh(DIGEST, { overrides: { package: PKG, basedOn: '0.9.0' } });
10331059
const result = await migrate(raw);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ describe('[#29392] the census and the move reach a row bound to the read-only ba
767767
const result = await migrate(protocol);
768768
expect(result.outcomes.map((o: any) => [o.outcome, o.basedOn])).toEqual([['moved', '1.2.0']]);
769769
expect(rows(VIEW)).toEqual([[PAIR, 'active']]);
770-
expect(rows(ENV_VIEW).slice().sort()).toEqual([[OTHER, 'active'], [WORKSPACE, 'active']]);
770+
expect(rows(ENV_VIEW).slice().sort()).toEqual([[WORKSPACE, 'active'], [OTHER, 'active']]);
771771
expect(rows(SHARED_VIEW)).toEqual([[WORKSPACE, 'active']]);
772772
});
773773
});

0 commit comments

Comments
 (0)