Skip to content

Commit a3aeacb

Browse files
committed
test: re-judge the repo-project and objectql pins the closed view door moves
The strip-site count for view.zod.ts reads 2 now that the item wire arms closed; the filterableFields absence walk excludes the refusal pin that authors the key on purpose; two objectql save fixtures stop carrying an undeclared key and pin its refusal instead. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziYCUHZQE3MXucvWe9
1 parent 1c246bd commit a3aeacb

4 files changed

Lines changed: 34 additions & 12 deletions

File tree

‎packages/objectql/src/protocol-meta.test.ts‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -486,34 +486,46 @@ describe('ObjectStackProtocolImplementation - Metadata Persistence', () => {
486486
expect(mockEngine.insert).toHaveBeenCalled();
487487
});
488488

489-
it('[#20051] stores the console\'s declared round-trip keys, and drops the `objectName` alias', async () => {
489+
it('[#20051] stores the console\'s declared round-trip keys; [#26711] refuses the `objectName` alias by name', async () => {
490490
// Re-judged at stage (iv) of #20051: was "preserves Studio-only
491491
// auxiliary fields verbatim". A saved view now stores the parsed
492492
// value of every key its body carried. `isPinned` / `isDefault` /
493493
// `sortOrder` survive because the list overlay DECLARES them
494-
// (`VIEW_CONSOLE_ROUND_TRIP_KEYS`); `objectName` is the
494+
// (`VIEW_CONSOLE_ROUND_TRIP_KEYS`). `objectName` is the
495495
// console's alias of `object`, which the member does not
496-
// declare, so it is dropped and `object` carries the binding.
497-
const itemWithExtras = {
496+
// declare: stage (iv) dropped it on a success, and since #26711
497+
// the `view` write door refuses it, pointing at `object`.
498+
const declared = {
498499
...validView,
499500
isPinned: true,
500501
isDefault: false,
501502
sortOrder: 5,
502-
objectName: 'lead',
503503
};
504504

505505
await protocol.saveMetaItem({
506506
type: 'view',
507507
name: 'all_leads',
508-
item: itemWithExtras,
508+
item: declared,
509509
});
510510

511511
const insertCall = mockEngine.insert.mock.calls[0];
512512
const persisted = JSON.parse(insertCall[1].metadata);
513-
const { objectName: _alias, ...declared } = itemWithExtras;
514513
expect(persisted).toEqual(declared);
515-
expect(persisted).not.toHaveProperty('objectName');
516514
expect(persisted.object).toBe('lead');
515+
516+
mockEngine.insert.mockClear();
517+
let caught: any;
518+
try {
519+
await protocol.saveMetaItem({
520+
type: 'view',
521+
name: 'all_leads',
522+
item: { ...declared, objectName: 'lead' },
523+
});
524+
} catch (e) { caught = e; }
525+
expect(caught?.code).toBe('INVALID_METADATA');
526+
expect(caught?.status).toBe(422);
527+
expect(caught.message).toContain('Did you mean `objectName` → `object`?');
528+
expect(mockEngine.insert).not.toHaveBeenCalled();
517529
});
518530

519531
it('rejects an invalid view (container with a listView missing `columns`) with 422', async () => {

‎packages/objectql/src/protocol-publish-rollback.test.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,17 @@ describe('publishMetaItem / rollbackMetaItem / diffMetaItem', () => {
344344
});
345345
await protocol.saveMetaItem({
346346
type: 'view', name: 'case_grid',
347-
item: { name: 'case_grid', type: 'grid', label: 'B', columns: ['id', 'title'], rowHeight: 'compact', extra: 1, object: 'case', viewKind: 'list' }, // [#7741] the inline arm requires the object binding pair
347+
item: { name: 'case_grid', type: 'grid', label: 'B', columns: ['id', 'title'], rowHeight: 'compact', object: 'case', viewKind: 'list' }, // [#7741] the inline arm requires the object binding pair
348348
});
349349
const diff = await protocol.diffMetaItem({
350350
type: 'view', name: 'case_grid',
351351
fromVersion: 1, toVersion: 2,
352352
});
353353
// [#20051] Re-judged at stage (iv): the added key is a DECLARED one
354-
// (`rowHeight`). The undeclared `extra` never reaches a version — a
354+
// (`rowHeight`). The undeclared `extra` never reached a version — a
355355
// view stores the parsed value of every key its body carried — so no
356-
// diff can show it.
356+
// diff could show it. [#26711] The `view` write door now refuses an
357+
// undeclared top-level key, so the fixture no longer carries `extra`.
357358
expect((diff as any).added.map((e: any) => e.path)).toEqual(['rowHeight']);
358359
expect((diff as any).changed.map((e: any) => e.path).sort()).toEqual(['columns', 'label']);
359360
});

‎packages/spec/scripts/strictness-ledger.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,12 @@ describe('posture reading, with a red control for each', () => {
380380
// console-written inner key must not 422 against an older server). Wire,
381381
// not debt; the ledger row carries the intent, and the authoring doors
382382
// reject the carrier key by name (`view-metadata-schema.test.ts` §#9933).
383-
expect(countStripSites(at('ui/view.zod.ts'))).toBe(4);
383+
//
384+
// 4 → 2 at #26711: the two `ViewItemWireSchema` arms closed with the rest
385+
// of the `view` write door (the save stores the parsed body, so a strip
386+
// there lost a key silently). The two sites left are `ViewColumnStateSchema`
387+
// (above) and the form field's `base` shape, both unchanged by #26711.
388+
expect(countStripSites(at('ui/view.zod.ts'))).toBe(2);
384389
});
385390

386391
it('lets a chained posture override the idiom in either direction (#5072)', () => {

‎packages/spec/src/ui/view-list-filterable-fields-retirement.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ describe('tree-scoped absence: no list-view payload inside the declared radius s
368368
// both took this key over from `striped` when its 16.x tombstone aged out.
369369
'packages/spec/src/ui/view-union-retirement-prescription.test.ts',
370370
'packages/lint/src/lint-liveness-properties.test.ts',
371+
// [#26711] The closed view write door's pin authors the key on the inline
372+
// list view to assert the live tombstone still raises its own prescription
373+
// there, not a bare unrecognized-key refusal.
374+
'packages/spec/src/ui/view-wire-unknown-key-refusal.test.ts',
371375
]);
372376
const EXCLUDED_PREFIXES = [
373377
// The D2 conversion's fixture authors the pre-retirement payload on purpose.

0 commit comments

Comments
 (0)