Skip to content

Commit bad558d

Browse files
committed
test(spec): the retired-key pin joins the protocol-19 default flip to its D3 entry
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As8b4YLdvodeGAQWNTQ
1 parent 7bc4696 commit bad558d

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎packages/spec/src/migrations/entries/semantic/19.permission-view-all-modify-all-cast-no-field-vote.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ export const entry: SemanticMigration = {
5555
+ 'set\'s reads by adding `viewAllFields: true` to its entry through the metadata API. No command lists '
5656
+ 'the affected stored sets yet. The error direction is fewer fields seen, never a field opened.',
5757
acceptanceCriteria:
58-
'One-step check, for every permission set in source and every one stored in a deployment: the set is '
58+
'Before or after moving a deployment to protocol 19, the one-step check, for every permission set in '
59+
+ 'source and every one stored in the deployment: the set is '
5960
+ 'affected when one of its `objects` entries, the `*` entry included, has `viewAllRecords: true` or '
6061
+ '`modifyAllRecords: true` and no `viewAllFields`. For each such entry whose holders should still read '
6162
+ 'every field of the object, add `viewAllFields: true`; nothing else is needed for the read. Sets in '

‎packages/spec/src/shared/retired-key-removal-version.pin.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ import { readFileSync } from 'node:fs';
7878
import { describe, expect, it } from 'vitest';
7979

8080
import { ALL_CONVERSIONS } from '../conversions/registry';
81+
import { MIGRATIONS_BY_MAJOR } from '../migrations/registry';
8182
import { TimeUpdateInterval } from '../data/analytics.zod';
8283
import { CurrencyConfigSchema, FieldSchema } from '../data/field.zod';
8384
import { IndexSchema, ObjectSchema } from '../data/object.zod';
@@ -236,6 +237,23 @@ const todo = (where: string, id: string, stack: Record<string, unknown>): Render
236237
return reasons.map((text) => ({ where, text }));
237238
};
238239

240+
/**
241+
* The D3 entry `os migrate meta` prints for a DEFAULT FLIP, read by its `id`:
242+
* the old shape still parses and now means something else, so there is no
243+
* refusal or tombstone to read, and the semantic entry that judges the
244+
* conversion's edits (its `conversionIds`) is the prescription an author and
245+
* an operator meet. Its `reason` and `acceptanceCriteria` are the two texts.
246+
*/
247+
const semantic = (where: string, id: string, conversionId: string): Renderer => () => {
248+
const found = Object.values(MIGRATIONS_BY_MAJOR).flatMap((step) => step.semantic).find((e) => e.id === id);
249+
if (!found) throw new Error(`${where}: no semantic entry \`${id}\``);
250+
expect(found.conversionIds ?? [], `${where} judges \`${conversionId}\``).toContain(conversionId);
251+
return [
252+
{ where: `${where} (reason)`, text: found.reason },
253+
{ where: `${where} (acceptanceCriteria)`, text: found.acceptanceCriteria },
254+
];
255+
};
256+
239257
const ELEMENTS: readonly (readonly [unknown, string, readonly string[]])[] = [
240258
[ElementNumberPropsSchema, 'element:number', ['object', 'filter']],
241259
[ElementRecordPickerPropsSchema, 'element:record_picker', ['object', 'filter', 'sort', 'limit']],
@@ -649,6 +667,16 @@ const JOIN: Readonly<Record<string, readonly Renderer[]>> = {
649667
'cube-sub-day-granularities-removed': [
650668
refusal('a sub-day TimeUpdateInterval member', () => TimeUpdateInterval.safeParse('minute')),
651669
],
670+
// Protocol 19's View All / Modify All field-axis split, a default flip: View
671+
// All without `viewAllFields` still parses and now casts no field vote, so the
672+
// D3 entry is what an author and an operator meet.
673+
'permission-view-all-fields-beside-record-bypass': [
674+
semantic(
675+
'D3 permission-view-all-modify-all-cast-no-field-vote',
676+
'permission-view-all-modify-all-cast-no-field-vote',
677+
'permission-view-all-fields-beside-record-bypass',
678+
),
679+
],
652680
};
653681

654682
/** Every major a prescription names as a release: `@objectstack/spec N[.x.y]` or `protocol N`. */

0 commit comments

Comments
 (0)