Repository navigation
Commit 0a71cde
feat(cli): os migrate meta --stored lists the stored permission sets whose View All / Modify All lost their field reach in 19 (#38399)
Fixes #37375
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- 运维在升级到 19
前后跑一次存量元数据迁移预览,就能看到哪些存库的权限集因“查看全部/修改全部”不再放开字段而受影响,以及每条的一行修法;之前没有任何命令能列出它们。
- 属于“字段权限三轴拆分”收尾:兑现维护者对存库权限集的裁决(存库集按 19 新含义读取、不改写)要求的“一步自查”。
- 只读清单,不写库、不改退出码;列错最多是多列或漏列一条提示,可直接撤回本 PR。
- 无。
## What changes
`os migrate meta --stored` now prints a read-only review list of the
stored permission sets (`sys_metadata`) that ruling A on #36055 leaves
on the 19 meaning: every `objects` entry, the `'*'` entry included, that
carries `viewAllRecords: true` or `modifyAllRecords: true` and no
`viewAllFields`. One line per entry names the set, its scope, the object
entry and the bits, followed by the one-line fix (`viewAllFields: true`
on that entry, applied through the metadata API) and the Modify All
caveats. It is modelled on the existing decision-mode review list of the
`flow-decision-mode-inclusive-explicit` flip, end to end:
- `@objectstack/metadata-protocol`: `collectViewAllFieldsReview(body)`
runs the ADR-0087 D2 entry
`permission-view-all-fields-beside-record-bypass` itself over `{
permissions: [body] }` and keeps only the paths it would write; each
listed entry is named by its own `objects` key, matched against the path
the conversion spells for it, so a key holding a dot or a line
terminator is named rather than rejected. That makes it one predicate,
not two, so the list is exactly what `os migrate meta --from 18`
rewrites in a source. `migrateStoredMetadata` fills a new report list,
`viewAllFieldsReview` (exported type `StoredViewAllFieldsReview`), for
every stored `permission` row, on preview and `--apply` alike. It moves
no count, no row outcome and no verdict, and writes nothing.
`formatStoredMigrationReport` prints it beside the "already on protocol"
verdict.
- `@objectstack/cli`: `meta.ts` adds the empty list to the report it
builds itself when `sys_metadata` does not exist yet, so `--json` always
carries the key.
- `@objectstack/spec`: the protocol-19 semantic entry's upgrade text
said "No command lists the affected stored sets yet", which this PR
makes false. Its description and its one-step check now name `os migrate
meta --stored`. Text only.
No new flag or option. `--type` narrows the list like the rest of the
report.
The published surface widens in three additive places, hence `Clause-②:
yes (widening)` at `patch` (AGENTS.md Post-Task Checklist step 3, a
non-protocol widening): the exported type `StoredViewAllFieldsReview`
from `@objectstack/metadata-protocol`, the new member
`viewAllFieldsReview` on the published `StoredMigrationReport`, and the
matching `viewAllFieldsReview` field in the `os migrate meta --stored
--json` report. The same member also rides on the `POST
/meta/_migrate-stored` response payload and
`client.meta.migrateStored()`, which return the same report. Nothing is
removed or narrowed.
## Why
Maintainer ruling A on #36055 keeps stored permission sets on the 19
meaning and asks the upgrade text to give operators a one-step check of
which stored sets are affected. Until now nothing listed them
(re-measured on `main` at 2efcedd: no producer of such a list in
`packages/metadata-protocol/src` or `packages/cli/src`).
## Tests
- `packages/metadata-protocol/src/protocol.stored-migration.test.ts`,
new `describe`: the list (row, set, entry, bits) on a preview and the
row stays canonical; `--apply` writes nothing (no history row, bytes
identical); controls (`viewAllFields` either value, no bypass, a
non-permission row) plus the positive; `--type` narrowing; the ONE
PREDICATE pin against `applyMetaMigrations(…, 18, 19)`; the renderer
text beside the verdict; no section when there is nothing to review.
-
`packages/cli/src/commands/migrate/meta.stored-view-all-fields.test.ts`
(new): the command prints the list and the fix beside the verdict, stays
a preview, `--json` carries `viewAllFieldsReview` and stays clean, and
the absent-`sys_metadata` path answers an empty list.
Ablation (`scripts/ablation-replace.mjs`, restored to a HEAD-equal blob
every time):
- Key naming (review finding S1): `const object =
objectByPath.get(path);` replaced by the earlier path pattern
`/^permissions\[0\]\.objects\.(.+)\.viewAllFields$/`: exactly the new
case with keys holding `\n`, `\r`, U+2028, U+2029 and a dot goes red (1
failed / 54 passed), on the "unknown shape" throw that rejected the
whole pass; restored blob == HEAD 03b22ca.
- Producer: `if (singular === 'permission') {` → `if (false && …)` in
`protocol-save.ts`: 4 of the 7 new protocol cases go red (the 3 that do
not read the producer stay green), 50 others pass.
- Renderer, through `dist/`: the formatter's list filtered to empty,
`@objectstack/metadata-protocol` rebuilt, marker proven live by
`ablation-dist-preflight.mjs` (present in 2 built files). The CLI text
case goes red and the two `--json` cases stay green, as they do not read
the renderer. Restore leg: rebuilt, marker absent from all 24 built
files, 3/3 green.
<details><summary>Local results (head 792a0ec unless stated)</summary>
- `@objectstack/metadata-protocol`: whole suite 375 files passed / 9
skipped, 23654 tests passed (lock VERDICT command-exit 0; run before the
comment-only `protocol.ts` revert); `protocol.stored-migration.test.ts`
54/54; typecheck exit 0.
- `@objectstack/cli`: `--project unit` 447/449 files at 8ba549b. The 2
others (`published-subpath-console.pin`,
`published-subpath-hook-body.pin`) refused because the CLI was not
built, then passed after the build at 2b3ec66 together with the three
edited stored-pass files (5 files, 37 tests). typecheck (with
`check:test-typecheck`) exit 0. The `integration` layer is declared to
CI.
- `@objectstack/spec`: `src/migrations` +
`retired-key-removal-version.pin` 6 files / 282 tests; `check:generated`
all 14 artifacts current; `check:spec-changes`, `check:upgrade-guide`,
typecheck exit 0; `check:doc-authoring` exit 0.
- Derived gate families (`dispatch-gates.mjs --commands`): 101 derived,
101 run, each exit 0; `--ran` reconciliation: "101 run, 0 NOT-MEASURED
(a DERIVED zero — all 101 recorded an exit code and none of them is 3)".
On the way, the run found `check:facade-delegation-only` red on a
`protocol.ts` doc paragraph and `check:test-source-alias` red on the
edited CLI tests; both are fixed in this PR.
- eslint (`--no-inline-config`) on the 9 changed `.ts` files: exit 0.
- Patch round (declaration line only), head 135393a after merging
`origin/main` (c610020, then b926d37; no conflict, none of this PR's
files moved on main): changeset gates (`check-adr-0087-registration`,
`check-changeset-no-major`, `check-empty-changeset`,
`check:changeset-gate-self-tests`, `check-closing-keyword-parity`,
`check:nul-bytes`) exit 0; full `turbo run build` 124/124; spec
`check:generated` all 14 artifacts current;
`protocol.stored-migration.test.ts` 54/54, the five CLI stored-pass and
subpath-pin files 37/37, spec `src/migrations` 209/209; derived union
101 derived, 101 run, each exit 0, and `--ran`: "101 run, 0 NOT-MEASURED
(a DERIVED zero — all 101 recorded an exit code and none of them is 3)";
`overlap-check.mjs` clean.
- Patch round 2 (review S1, N1, N3), head 8dad954 after merging
`origin/main` a2205a8 (no conflict, none of this PR's files moved on
main): full `turbo run build` 124/124;
`protocol.stored-migration.test.ts` 55/55; the three CLI stored-pass
files 8/8; metadata-protocol and cli typecheck exit 0; derived union 101
derived, 101 run, each exit 0, `--ran` a DERIVED zero of NOT-MEASURED;
`overlap-check.mjs` clean.
</details>
## Acceptance notes
- Surface amendment beyond the claim's file list, each re-checked with
`check-handover.mjs --inflight --card=37375` (all clear) before editing:
`packages/metadata-protocol/src/stored-migration.ts`,
`packages/metadata-protocol/src/protocol-save.ts`,
`packages/metadata-protocol/src/index.ts` (the existing review list's
producer and renderer live there, not in `meta.ts`);
`packages/metadata-protocol/src/protocol.stored-migration.test.ts`
(beside it); `packages/cli/test/migrate-meta-stored-failed.test.ts` (a
report fixture);
`packages/spec/src/migrations/entries/semantic/19.permission-view-all-modify-all-cast-no-field-vote.ts`
(the upgrade text this PR makes false).
- `protocol.ts` (a facade under `check:facade-delegation-only`) is
deliberately untouched: a doc paragraph there took it 9 lines over its
ceiling, so the list is documented beside its type in
`stored-migration.ts` only.
- The three CLI test files this PR edits now load the command's
dynamically imported packages at module top, as
`check:test-source-alias` prescribes for a changed test file.
- Organization-scoped legacy rows are reported `skipped` before their
body is read, so, like the decision list, this list does not name them.
- Not in this PR, release-owned: the same stale sentence ("No command
lists the affected stored sets yet; a review list is follow-up #37375")
is in the released `19.0.0-next.2` `CHANGELOG.md` entries of
`@objectstack/spec`, `cli`, `core`, `lint` and `metadata-core`, and in
`.changeset/pre/36055-view-all-stops-voting-on-fields.md`. Per AGENTS.md
these are corrected in a dedicated docs-only PR, never in a code PR.
- Not in this PR: `content/docs/deployment/cli.mdx` documents
`decisionModeReview` for `os migrate meta --stored` and does not yet
document `viewAllFieldsReview`.
- Not in this PR (ruled out by the claim): the Studio `viewAllFields`
control.
## Verification
Read first, by risk:
`packages/metadata-protocol/src/stored-migration.ts`
(`collectViewAllFieldsReview`, the path regex and the formatter
section), `packages/metadata-protocol/src/protocol-save.ts` (the
`singular === 'permission'` block),
`packages/spec/src/migrations/entries/semantic/19.permission-view-all-modify-all-cast-no-field-vote.ts`.
Two-minute check: `pnpm --filter @objectstack/metadata-protocol exec
vitest run src/protocol.stored-migration.test.ts -t "View All Fields"`.
Expect 7 passing cases.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_017xRBcUuJz2sQYZQYRiwPzr)_
<!-- signed: repo:objectstack#8 · sunhaolin ·
session_017xRBcUuJz2sQYZQYRiwPzr -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4a43d6c commit 0a71cde
10 files changed
Lines changed: 516 additions & 5 deletions
File tree
- .changeset
- packages
- cli
- src/commands/migrate
- test
- metadata-protocol/src
- spec/src/migrations/entries/semantic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
24 | 39 | | |
25 | 40 | | |
26 | 41 | | |
| |||
47 | 62 | | |
48 | 63 | | |
49 | 64 | | |
| 65 | + | |
50 | 66 | | |
51 | 67 | | |
52 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1606 | 1606 | | |
1607 | 1607 | | |
1608 | 1608 | | |
| 1609 | + | |
1609 | 1610 | | |
1610 | 1611 | | |
1611 | 1612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
28 | 43 | | |
29 | 44 | | |
30 | 45 | | |
| |||
85 | 100 | | |
86 | 101 | | |
87 | 102 | | |
| 103 | + | |
88 | 104 | | |
89 | 105 | | |
90 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
264 | 265 | | |
265 | 266 | | |
266 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
2650 | 2650 | | |
2651 | 2651 | | |
2652 | 2652 | | |
| 2653 | + | |
2653 | 2654 | | |
2654 | 2655 | | |
2655 | 2656 | | |
| |||
2813 | 2814 | | |
2814 | 2815 | | |
2815 | 2816 | | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
2816 | 2839 | | |
2817 | 2840 | | |
2818 | 2841 | | |
| |||
0 commit comments