Skip to content

Commit f32b7d6

Browse files
fix(cli): os migrate meta --from 18 names the 18.x its own-field-row answer describes (#39403)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgQwQhn6sVVyeM8UEmMGvRnK)_ Fixes #39176 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:开发者用迁移预演从 18 升到 19 时,"自己设了隐藏/只读字段的权限集"清单会写明它描述的是 18.3–18.6 的结果,并附一段说明早期 18.x 的不同之处。 - 为什么做:清单把所有 18.x 都按 18.6 写,从 18.0–18.2 升级会被告知一个不会发生的收窄,从 18.3–18.5 升级会悄悄丢一个读权限却不点名。 - 出错会怎样:只改提示文字,迁移本身写什么不变;可直接撤回。 - 要你做什么:无。 ## What changes `os migrate meta --from 18` cannot tell which 18.x a source last ran on (`--from` names a major). The own-field-row list printed a "protocol 18" answer that is the one 18.3.0 to 18.6.0 give, and the step-19 semantic entry described only that span. Measured on the published `@objectstack/core` tarballs: `superuserFieldVote` is absent from 17.7.0 to 18.2.0 and present from 18.3.0; `declaresOwnReadMask` ships only in 18.6.0. This takes the card's second shape (the text names the 18.x it describes, and a short note covers the earlier ones; precedent: "Upgrading from 18.5.0 or earlier" in `content/docs/upgrading.mdx`). No contract changes: no type, key or exported symbol moves. - `packages/cli/src/utils/own-field-row-narrowing.ts`: the list header says its protocol-18 answer is 18.3.0 to 18.6.0's and points at the View All and Modify All manual change; each row reads `protocol 18: read and edit on 18.3.0 to 18.6.0 (…)`. - `packages/spec/src/migrations/entries/semantic/19.permission-view-all-modify-all-cast-no-field-vote.ts`: the SOURCE paragraph carries the note, printed in every run that crosses into 19 whether the list is empty or not. 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. Before 18.3.0, neither bit cast a field vote, so a listed row already answered as it does on 19. The STORED paragraph says the same note holds for a deployment last run on an earlier 18.x. The "Until 19" sentence reads "From 18.3.0 until 19". The acceptance criteria's "Beside View All that restores every read" names 18.6.0 and the 18.3.0 to 18.5.0 row. - `packages/spec/src/conversions/own-field-rows-beside-modify-all.ts`: module header and the `OwnFieldRowProtocol18Outcome` docblock say which releases the answer describes ("Which 18.x the answer describes"). - `.changeset/39176-own-field-row-18x-note.md`: patch, `@objectstack/spec` and `@objectstack/cli`. - `packages/cli/test/migrate-meta-own-field-row-38924.test.ts`: the fixture run now asserts the header's release span, the row's `read and edit on 18.3.0 to 18.6.0`, and both lines of the earlier-18.x note. The review follow-ups on the same files (#39177) are not in this PR. ## Tests <details><summary>Measurement before the fix (built CLI, head 850d240)</summary> - An 18.2-shaped source (View All + Modify All on `contact`, own `'contact.salary': { readable: false }`): the list printed `protocol 18: read and edit`. On core 18.2.0 the set never read `salary` (no field vote). - An 18.4-shaped source (View All alone, the same own row): nothing listed. On core 18.4.0 the set read `salary` over its own row, and on 19 the row binds, so that read is lost silently. </details> <details><summary>After the fix (head 0e3ecec; pin added at ecc8685)</summary> - 18.2-shaped source: the header names 18.3.0 to 18.6.0, the row prints `protocol 18: read and edit on 18.3.0 to 18.6.0 (…)`, and the manual change carries the before-18.3.0 note. - 18.4-shaped source: the manual change prints `from 18.3.0 to 18.5.0 View All also read a field over the set's own readable: false row … that row now hides its field and is not listed: delete it where the set's holders should still read the field`. - `pnpm --filter @objectstack/cli exec vitest run test/migrate-meta-own-field-row-38924.test.ts test/migrate-meta-engine-guidance.test.ts src/commands/migrate/meta.stored-view-all-fields.test.ts`: 3 files, 10 tests passed. - `pnpm --filter @objectstack/spec exec vitest run src/conversions src/migrations`: 35 files, 1136 passed, 2 todo. - `pnpm --filter @objectstack/metadata-protocol exec vitest run src/stored-own-field-rows`: 2 passed. - At ecc8685: `test/migrate-meta-own-field-row-38924.test.ts` 4 passed. Ablation: with the row's text reverted to `read and edit (Modify All …)` on disk, the case went red (`expected … to contain 'protocol 18: read and edit on 18.3.0 …'`); restored. - `pnpm --filter @objectstack/spec run typecheck` and `pnpm --filter @objectstack/cli run typecheck`: exit 0. </details> <details><summary>Derived gates (head 0e3ecec)</summary> `node scripts/pm/dispatch-gates.mjs --commands`: 88 commands derived, 88 run (`--ran` reconciliation: 88 derived, 88 run, 0 unrun); 84 exit 0. Four did not measure, all for prerequisites outside this diff: - `node scripts/check-plugin-teardown-shape.mjs --self-test`: shallow clone, the fixture commit is unreachable; - `pnpm check:dual-build-cjs-loads`: needs a whole-workspace build (`packages/qa/scenarios/dist` absent); - `pnpm check:i18n-coverage`: `examples/app-showcase` needs `@objectstack/service-print` built; - `pnpm check:query-options-erasure`: self-test passed; the repo-wide lint pass ran past the 150 s local cap. CI runs all four. </details> ## Acceptance notes - The tool still cannot ask which 18.x a source last ran on. The first shape the card names (an answer true for the source's own 18.x) would need a new input, and with it a contract change, so it is not taken here. - The `--stored` review line (`packages/metadata-protocol/src/stored-own-field-rows.ts`) still prints "protocol 18 read and edit". The step-19 entry's STORED paragraph carries the note for it. The file is outside the card's landing points, so it is left alone here. ## Verification Read first: the SOURCE paragraph of the step-19 semantic entry (the note), then `printOwnFieldRowNarrowing`. Two-minute check: `pnpm --filter @objectstack/cli exec vitest run test/migrate-meta-own-field-row-38924.test.ts`. Expected: 4 passed, including the release span and both earlier-18.x note lines. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Utp6CYAcXpQMmT3KPQGzfJ <!-- signed: repo:objectstack@os-bill · os-bill · session_01Utp6CYAcXpQMmT3KPQGzfJ --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 301a378 commit f32b7d6

5 files changed

Lines changed: 66 additions & 12 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/spec': patch
3+
'@objectstack/cli': patch
4+
---
5+
6+
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
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
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.
12+
13+
- **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.
14+
- **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:
15+
- 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;
16+
- before 18.3.0 neither bit cast a field vote, so a listed row already answered as it does on 19.

‎packages/cli/src/utils/own-field-row-narrowing.ts‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@
77
*
88
* The edit line the chain prints for such an entry is right: the bit keeps the
99
* reads Modify All cast on every field the set's own rows leave alone. What it
10-
* cannot keep is Modify All's vote OVER the set's own rows: up to protocol 18 a
11-
* set with Modify All on `contact` and its own `'contact.salary':
10+
* cannot keep is Modify All's vote OVER the set's own rows: from 18.3.0 to
11+
* 18.6.0 a set with Modify All on `contact` and its own `'contact.salary':
1212
* { readable: false }` row read and edited `salary`; from 19 that row binds
1313
* and the field is hidden from the set's holders. Validate and build stay
1414
* green either way, so without a line naming the row the upgrade takes the
1515
* field away silently. The predicate is the spec's
1616
* ({@link ownFieldRowsBesideModifyAll}), shared with the `--stored` review
1717
* list; this module only walks a source stack for it and prints it.
18+
*
19+
* The protocol-18 answer printed is 18.3.0's to 18.6.0's: `--from` names a
20+
* major, so the list cannot tell a source last run on an earlier 18.x. Its
21+
* header says which releases it describes, and the step-19 semantic entry,
22+
* printed in every run that crosses into 19 whether this list is empty or
23+
* not, carries the note for 18.0.0 to 18.5.0 (see the spec predicate's
24+
* "Which 18.x the answer describes").
1825
*/
1926

2027
import chalk from 'chalk';
@@ -82,7 +89,7 @@ export function ownFieldRowNarrowingSites(
8289
}
8390

8491
const PROTOCOL_18: Record<OwnFieldRowProtocol18Outcome, string> = {
85-
'read-and-edit': 'read and edit (Modify All voted over the set\'s own row)',
92+
'read-and-edit': 'read and edit on 18.3.0 to 18.6.0 (Modify All voted over the set\'s own row)',
8693
};
8794

8895
const PROTOCOL_19: Record<OwnFieldRowProtocol19Outcome, string> = {
@@ -105,7 +112,9 @@ export function printOwnFieldRowNarrowing(sites: readonly OwnFieldRowNarrowingSi
105112
if (sites.length === 0) return;
106113
console.log(chalk.bold(chalk.yellow(
107114
` ${sites.length} own field row(s) beside Modify All that protocol 19 narrows — `
108-
+ 'the `viewAllFields: true` written beside the bit does not keep them:',
115+
+ 'the `viewAllFields: true` written beside the bit does not keep them '
116+
+ '(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 '
117+
+ 'manual change on View All and Modify All below):',
109118
)));
110119
for (const site of sites) {
111120
console.log(

‎packages/cli/test/migrate-meta-own-field-row-38924.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ describe('os migrate meta --from 18 — the own field rows beside Modify All pro
138138
expect(text).toContain('protocol 19: hidden, no read and no edit');
139139
expect(text).toMatch(/choice: to keep the protocol-18 read and edit, .*otherwise accept the narrowing\./);
140140
expect(text).not.toContain('so their field reads are kept');
141+
// The protocol-18 answer names the releases it describes, and the step-19 manual change
142+
// carries the note for a source last run on an earlier 18.x (`--from` names a major only).
143+
expect(text).toContain('the protocol-18 answer is 18.3.0 to 18.6.0\'s');
144+
expect(text).toContain('protocol 18: read and edit on 18.3.0 to 18.6.0');
145+
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');
146+
expect(text).toContain('before 18.3.0 neither bit cast a field vote');
141147
// The control set rides in the same stack and is not named.
142148
expect(text).not.toContain("permission set 'auditor'");
143149
}, 60_000);

‎packages/spec/src/conversions/own-field-rows-beside-modify-all.ts‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
*
99
* ## The shape
1010
*
11-
* Up to protocol 18 Modify All (`modifyAllRecords`) voted `readable: true` and
12-
* `editable: true` on every field of its object, OVER the set's own field rows:
11+
* From 18.3.0 to 18.6.0, the last protocol-18 releases, Modify All
12+
* (`modifyAllRecords`) voted `readable: true` and `editable: true` on every
13+
* field of its object, OVER the set's own field rows:
1314
* a set holding Modify All on `contact` and its own `'contact.salary':
1415
* { readable: false }` row still read and edited `salary`. From 19 the bit
1516
* casts no field vote; the conversion `permission-view-all-fields-beside-record-bypass`
@@ -40,11 +41,23 @@
4041
* key (field rows have no wildcard, ruling of record 6912661484), so it is
4142
* inert on both sides of the split.
4243
*
43-
* View All (`viewAllRecords`) alone is not this shape: up to 18 the set's own
44+
* View All (`viewAllRecords`) alone is not this shape: on 18.6.0 the set's own
4445
* row already beat its own View All (ADR-0066 D2 ⑧, note of 2026-11-15), and
4546
* View All never voted an edit, so its own rows give the same answer on both
4647
* sides of the split.
4748
*
49+
* ## Which 18.x the answer describes
50+
*
51+
* The protocol-18 answer is 18.3.0's to 18.6.0's (beside Modify All they
52+
* agree). A source last run on an earlier 18.x differs, and no predicate here can
53+
* tell, since `--from` names a major only; the step-19 semantic entry
54+
* (`permission-view-all-modify-all-cast-no-field-vote`) carries the note:
55+
* - 18.3.0 to 18.5.0: View All also read over the set's own `readable: false`
56+
* row, so such a row beside View All alone hides a field on 19 that it did
57+
* not hide there, and this list does not name it;
58+
* - before 18.3.0: neither bit cast a field vote, so a listed row already
59+
* answered as it does on 19.
60+
*
4861
* ## Which entries
4962
*
5063
* Exactly the entries the conversion rewrites (it is run here, its emitted
@@ -67,7 +80,7 @@
6780

6881
import { permissionViewAllFieldsBesideRecordBypass } from './entries/19/permission-view-all-fields-beside-record-bypass.js';
6982

70-
/** What a holder of the set read and edited on the field through this set on protocol 18. */
83+
/** What a holder of the set read and edited on the field through this set on 18.3.0 to 18.6.0. */
7184
export type OwnFieldRowProtocol18Outcome = 'read-and-edit';
7285

7386
/** What a holder of the set reads and edits on the field through this set on protocol 19. */

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export const entry: SemanticMigration = {
3030
+ '`editable: true` field row in the set that should edit it.',
3131
reason:
3232
'From protocol 19 View All (`viewAllRecords`) and Modify All (`modifyAllRecords`) widen RECORDS only and '
33-
+ 'cast no field vote. Until 19 View All voted every field of the object readable and Modify All voted '
33+
+ 'cast no field vote. From 18.3.0 until 19 View All voted every field of the object readable (on 18.6.0 '
34+
+ 'except over the set\'s own `readable: false` row) and Modify All voted '
3435
+ 'every field readable and editable, so one set\'s bit re-opened a field another set hid with '
3536
+ '`readable: false` and unlocked a field another set locked with `editable: false`. Reading every field '
3637
+ 'is now `viewAllFields: true`, which votes read on every field of the object (fields added later '
@@ -58,7 +59,12 @@ export const entry: SemanticMigration = {
5859
+ 'own field row beside a Modify All bit it writes `viewAllFields: true` beside in that run, where the row '
5960
+ 'now hides its field, locks it (on every row or on the rows its `when` matches) or limits its edit to the '
6061
+ 'rows its `when` matches, with its protocol-18 and protocol-19 answer and the choice: change the row to '
61-
+ 'keep the protocol-18 answer, or accept the narrowing. It names no row beside an entry that already '
62+
+ 'keep the protocol-18 answer, or accept the narrowing. That protocol-18 answer is 18.3.0\'s to 18.6.0\'s; '
63+
+ '`--from` names a major, so a source last run on an earlier 18.x is told it too, and differs: from 18.3.0 '
64+
+ 'to 18.5.0 View All also read a field over the set\'s own `readable: false` row (18.6.0 lets the row '
65+
+ 'bind), so beside View All without Modify All that row now hides its field and is not listed: delete it '
66+
+ 'where the set\'s holders should still read the field; before 18.3.0 neither bit cast a field vote, so a '
67+
+ 'listed row already answered as it does on 19. It names no row beside an entry that already '
6268
+ 'carries `viewAllFields` (a source the edit was applied to, by `--write` or by hand): review those rows '
6369
+ 'against the criteria below. The conversion replays only there: it is a default flip, '
6470
+ '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 = {
6874
+ 'control today (it keeps the key when it saves a set that already carries it), so restore a stored '
6975
+ 'set\'s reads by adding `viewAllFields: true` to its entry through the metadata API. '
7076
+ '`os migrate meta --stored` lists every affected entry of a stored set (`viewAllFieldsReview`, read-only: '
71-
+ 'it writes nothing), and under an entry with Modify All each own field row protocol 19 narrows beside it. '
77+
+ 'it writes nothing), and under an entry with Modify All each own field row protocol 19 narrows beside it '
78+
+ '(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 '
79+
+ 'deployment last run on one). '
7280
+ 'The error direction is fewer fields seen, never a field opened.',
7381
acceptanceCriteria:
7482
'Before or after moving a deployment to protocol 19, the one-step check, for every permission set in '
7583
+ 'source and every one stored in the deployment: the set is '
7684
+ 'affected when one of its `objects` entries, the `*` entry included, has `viewAllRecords: true` or '
7785
+ '`modifyAllRecords: true` and no `viewAllFields`. For each such entry whose holders should still read '
78-
+ 'every field of the object, add `viewAllFields: true`. Beside View All that restores every read. Beside '
86+
+ 'every field of the object, add `viewAllFields: true`. Beside View All that restores every read 18.6.0 '
87+
+ 'gave (a source last run on 18.3.0 to 18.5.0 also read a field the set\'s own `readable: false` row '
88+
+ 'hides: delete that row where they should still read it). Beside '
7989
+ 'Modify All it does not restore a field the same set\'s own `readable: false` row hides: that row now '
8090
+ 'hides the field from the set\'s holders, so delete it where they should still read the field. Sets in '
8191
+ 'source: run `os migrate meta --from 18 --write`, which adds the bit to every such entry, then delete it '

0 commit comments

Comments
 (0)