diff --git a/.changeset/39176-own-field-row-18x-note.md b/.changeset/39176-own-field-row-18x-note.md new file mode 100644 index 00000000000..59c806d4b4f --- /dev/null +++ b/.changeset/39176-own-field-row-18x-note.md @@ -0,0 +1,16 @@ +--- +'@objectstack/spec': patch +'@objectstack/cli': patch +--- + +fix(cli): `os migrate meta --from 18` says which 18.x release its own-field-row answer describes, and what differs for a source last run on an earlier 18.x + +Clause-②: no +Metadata-protocol: none + +Who sees it: a developer running `os migrate meta --from 18` (with or without `--write`) to move a project to protocol 19. The `--stored` review's rows are unchanged; the step-19 entry's note covers a deployment last run on an earlier 18.x. + +- **The own-field-row list names its releases.** The list of own field rows beside Modify All that protocol 19 narrows printed a "protocol 18" answer that is the one 18.3.0 to 18.6.0 give. Its header and each row's protocol-18 line now say so. +- **The View All and Modify All manual change carries a note for an earlier 18.x.** `--from` names a major, so the tool cannot tell which 18.x a source last ran on. The note, printed in every run that crosses into 19 whether the list is empty or not, says what differs: + - from 18.3.0 to 18.5.0 View All also read a field over the set's own `readable: false` row, so beside View All without Modify All that row now hides its field and is not listed: delete it where the set's holders should still read the field; + - before 18.3.0 neither bit cast a field vote, so a listed row already answered as it does on 19. diff --git a/packages/cli/src/utils/own-field-row-narrowing.ts b/packages/cli/src/utils/own-field-row-narrowing.ts index a3379afd4c4..fad0c1889ad 100644 --- a/packages/cli/src/utils/own-field-row-narrowing.ts +++ b/packages/cli/src/utils/own-field-row-narrowing.ts @@ -7,14 +7,21 @@ * * The edit line the chain prints for such an entry is right: the bit keeps the * reads Modify All cast on every field the set's own rows leave alone. What it - * cannot keep is Modify All's vote OVER the set's own rows: up to protocol 18 a - * set with Modify All on `contact` and its own `'contact.salary': + * cannot keep is Modify All's vote OVER the set's own rows: from 18.3.0 to + * 18.6.0 a set with Modify All on `contact` and its own `'contact.salary': * { readable: false }` row read and edited `salary`; from 19 that row binds * and the field is hidden from the set's holders. Validate and build stay * green either way, so without a line naming the row the upgrade takes the * field away silently. The predicate is the spec's * ({@link ownFieldRowsBesideModifyAll}), shared with the `--stored` review * list; this module only walks a source stack for it and prints it. + * + * The protocol-18 answer printed is 18.3.0's to 18.6.0's: `--from` names a + * major, so the list cannot tell a source last run on an earlier 18.x. Its + * header says which releases it describes, and the step-19 semantic entry, + * printed in every run that crosses into 19 whether this list is empty or + * not, carries the note for 18.0.0 to 18.5.0 (see the spec predicate's + * "Which 18.x the answer describes"). */ import chalk from 'chalk'; @@ -82,7 +89,7 @@ export function ownFieldRowNarrowingSites( } const PROTOCOL_18: Record = { - 'read-and-edit': 'read and edit (Modify All voted over the set\'s own row)', + 'read-and-edit': 'read and edit on 18.3.0 to 18.6.0 (Modify All voted over the set\'s own row)', }; const PROTOCOL_19: Record = { @@ -105,7 +112,9 @@ export function printOwnFieldRowNarrowing(sites: readonly OwnFieldRowNarrowingSi if (sites.length === 0) return; console.log(chalk.bold(chalk.yellow( ` ${sites.length} own field row(s) beside Modify All that protocol 19 narrows — ` - + 'the `viewAllFields: true` written beside the bit does not keep them:', + + 'the `viewAllFields: true` written beside the bit does not keep them ' + + '(the protocol-18 answer is 18.3.0 to 18.6.0\'s; for a source last run on an earlier 18.x, see the ' + + 'manual change on View All and Modify All below):', ))); for (const site of sites) { console.log( diff --git a/packages/cli/test/migrate-meta-own-field-row-38924.test.ts b/packages/cli/test/migrate-meta-own-field-row-38924.test.ts index e285b3c4326..af1efb8dc4d 100644 --- a/packages/cli/test/migrate-meta-own-field-row-38924.test.ts +++ b/packages/cli/test/migrate-meta-own-field-row-38924.test.ts @@ -138,6 +138,12 @@ describe('os migrate meta --from 18 — the own field rows beside Modify All pro expect(text).toContain('protocol 19: hidden, no read and no edit'); expect(text).toMatch(/choice: to keep the protocol-18 read and edit, .*otherwise accept the narrowing\./); expect(text).not.toContain('so their field reads are kept'); + // The protocol-18 answer names the releases it describes, and the step-19 manual change + // carries the note for a source last run on an earlier 18.x (`--from` names a major only). + expect(text).toContain('the protocol-18 answer is 18.3.0 to 18.6.0\'s'); + expect(text).toContain('protocol 18: read and edit on 18.3.0 to 18.6.0'); + expect(text).toContain('from 18.3.0 to 18.5.0 View All also read a field over the set\'s own `readable: false` row'); + expect(text).toContain('before 18.3.0 neither bit cast a field vote'); // The control set rides in the same stack and is not named. expect(text).not.toContain("permission set 'auditor'"); }, 60_000); diff --git a/packages/spec/src/conversions/own-field-rows-beside-modify-all.ts b/packages/spec/src/conversions/own-field-rows-beside-modify-all.ts index 4400123e4ea..14175269093 100644 --- a/packages/spec/src/conversions/own-field-rows-beside-modify-all.ts +++ b/packages/spec/src/conversions/own-field-rows-beside-modify-all.ts @@ -8,8 +8,9 @@ * * ## The shape * - * Up to protocol 18 Modify All (`modifyAllRecords`) voted `readable: true` and - * `editable: true` on every field of its object, OVER the set's own field rows: + * From 18.3.0 to 18.6.0, the last protocol-18 releases, Modify All + * (`modifyAllRecords`) voted `readable: true` and `editable: true` on every + * field of its object, OVER the set's own field rows: * a set holding Modify All on `contact` and its own `'contact.salary': * { readable: false }` row still read and edited `salary`. From 19 the bit * casts no field vote; the conversion `permission-view-all-fields-beside-record-bypass` @@ -40,11 +41,23 @@ * key (field rows have no wildcard, ruling of record 6912661484), so it is * inert on both sides of the split. * - * View All (`viewAllRecords`) alone is not this shape: up to 18 the set's own + * View All (`viewAllRecords`) alone is not this shape: on 18.6.0 the set's own * row already beat its own View All (ADR-0066 D2 ⑧, note of 2026-11-15), and * View All never voted an edit, so its own rows give the same answer on both * sides of the split. * + * ## Which 18.x the answer describes + * + * The protocol-18 answer is 18.3.0's to 18.6.0's (beside Modify All they + * agree). A source last run on an earlier 18.x differs, and no predicate here can + * tell, since `--from` names a major only; the step-19 semantic entry + * (`permission-view-all-modify-all-cast-no-field-vote`) carries the note: + * - 18.3.0 to 18.5.0: View All also read over the set's own `readable: false` + * row, so such a row beside View All alone hides a field on 19 that it did + * not hide there, and this list does not name it; + * - before 18.3.0: neither bit cast a field vote, so a listed row already + * answered as it does on 19. + * * ## Which entries * * Exactly the entries the conversion rewrites (it is run here, its emitted @@ -67,7 +80,7 @@ import { permissionViewAllFieldsBesideRecordBypass } from './entries/19/permission-view-all-fields-beside-record-bypass.js'; -/** What a holder of the set read and edited on the field through this set on protocol 18. */ +/** What a holder of the set read and edited on the field through this set on 18.3.0 to 18.6.0. */ export type OwnFieldRowProtocol18Outcome = 'read-and-edit'; /** What a holder of the set reads and edits on the field through this set on protocol 19. */ diff --git a/packages/spec/src/migrations/entries/semantic/19.permission-view-all-modify-all-cast-no-field-vote.ts b/packages/spec/src/migrations/entries/semantic/19.permission-view-all-modify-all-cast-no-field-vote.ts index 3f839a01ca5..cb2de4e92bf 100644 --- a/packages/spec/src/migrations/entries/semantic/19.permission-view-all-modify-all-cast-no-field-vote.ts +++ b/packages/spec/src/migrations/entries/semantic/19.permission-view-all-modify-all-cast-no-field-vote.ts @@ -30,7 +30,8 @@ export const entry: SemanticMigration = { + '`editable: true` field row in the set that should edit it.', reason: 'From protocol 19 View All (`viewAllRecords`) and Modify All (`modifyAllRecords`) widen RECORDS only and ' - + 'cast no field vote. Until 19 View All voted every field of the object readable and Modify All voted ' + + 'cast no field vote. From 18.3.0 until 19 View All voted every field of the object readable (on 18.6.0 ' + + 'except over the set\'s own `readable: false` row) and Modify All voted ' + 'every field readable and editable, so one set\'s bit re-opened a field another set hid with ' + '`readable: false` and unlocked a field another set locked with `editable: false`. Reading every field ' + 'is now `viewAllFields: true`, which votes read on every field of the object (fields added later ' @@ -58,7 +59,12 @@ export const entry: SemanticMigration = { + 'own field row beside a Modify All bit it writes `viewAllFields: true` beside in that run, where the row ' + 'now hides its field, locks it (on every row or on the rows its `when` matches) or limits its edit to the ' + 'rows its `when` matches, with its protocol-18 and protocol-19 answer and the choice: change the row to ' - + 'keep the protocol-18 answer, or accept the narrowing. It names no row beside an entry that already ' + + 'keep the protocol-18 answer, or accept the narrowing. That protocol-18 answer is 18.3.0\'s to 18.6.0\'s; ' + + '`--from` names a major, so a source last run on an earlier 18.x is told it too, and differs: from 18.3.0 ' + + 'to 18.5.0 View All also read a field over the set\'s own `readable: false` row (18.6.0 lets the row ' + + 'bind), so beside View All without Modify All that row now hides its field and is not listed: delete it ' + + 'where the set\'s holders should still read the field; before 18.3.0 neither bit cast a field vote, so a ' + + 'listed row already answered as it does on 19. It names no row beside an entry that already ' + 'carries `viewAllFields` (a source the edit was applied to, by `--write` or by hand): review those rows ' + 'against the criteria below. The conversion replays only there: it is a default flip, ' + 'retired from the load path, so the authoring funnel skips it, and the artifact-ingestion door and every ' @@ -68,14 +74,18 @@ export const entry: SemanticMigration = { + 'control today (it keeps the key when it saves a set that already carries it), so restore a stored ' + 'set\'s reads by adding `viewAllFields: true` to its entry through the metadata API. ' + '`os migrate meta --stored` lists every affected entry of a stored set (`viewAllFieldsReview`, read-only: ' - + 'it writes nothing), and under an entry with Modify All each own field row protocol 19 narrows beside it. ' + + 'it writes nothing), and under an entry with Modify All each own field row protocol 19 narrows beside it ' + + '(its protocol-18 answer is again 18.3.0\'s to 18.6.0\'s: the note on an earlier 18.x above holds for a ' + + 'deployment last run on one). ' + 'The error direction is fewer fields seen, never a field opened.', acceptanceCriteria: 'Before or after moving a deployment to protocol 19, the one-step check, for every permission set in ' + 'source and every one stored in the deployment: the set is ' + 'affected when one of its `objects` entries, the `*` entry included, has `viewAllRecords: true` or ' + '`modifyAllRecords: true` and no `viewAllFields`. For each such entry whose holders should still read ' - + 'every field of the object, add `viewAllFields: true`. Beside View All that restores every read. Beside ' + + 'every field of the object, add `viewAllFields: true`. Beside View All that restores every read 18.6.0 ' + + 'gave (a source last run on 18.3.0 to 18.5.0 also read a field the set\'s own `readable: false` row ' + + 'hides: delete that row where they should still read it). Beside ' + 'Modify All it does not restore a field the same set\'s own `readable: false` row hides: that row now ' + 'hides the field from the set\'s holders, so delete it where they should still read the field. Sets in ' + 'source: run `os migrate meta --from 18 --write`, which adds the bit to every such entry, then delete it '