Skip to content

Commit 0a71cde

Browse files
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
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
'@objectstack/cli': patch
3+
'@objectstack/metadata-protocol': patch
4+
'@objectstack/spec': patch
5+
---
6+
7+
feat(cli): `os migrate meta --stored` lists the stored permission sets whose View All / Modify All no longer read fields in 19
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
From protocol 19, View All (`viewAllRecords`) and Modify All (`modifyAllRecords`) widen records only and cast no field vote, and a permission set stored in a deployment (`sys_metadata`, for example saved in Studio) is read with that meaning and never rewritten on upgrade. The upgrade asks for a one-step check of which stored sets are affected; `os migrate meta --stored` now prints it.
13+
14+
On a preview and an `--apply` run alike, the command lists every stored permission set's `objects` entry, the `'*'` entry included, that carries `viewAllRecords: true` or `modifyAllRecords: true` and no `viewAllFields`, one line per entry with the set, its scope and the bits:
15+
16+
```text
17+
◆ 2 object entry(ies) in 1 stored permission set row(s) hold View All or Modify All and no `viewAllFields` — since protocol 19 they read no field another set hides; listed for review, never rewritten:
18+
• permission/ops_auditor [env-wide] — objects entry 'ops_ticket' (viewAllRecords)
19+
• permission/ops_auditor [env-wide] — objects entry '*' (viewAllRecords, modifyAllRecords)
20+
```
21+
22+
The fix, where the set's holders should still read every field of that object: add `viewAllFields: true` to the entry through the metadata API (Studio's permission matrix has no control for it). Beside Modify All the set's own `readable: false` rows now bind and no edit is restored; grant an edit with an explicit `editable: true` field row. Declaring `viewAllFields` either way, `true` or `false`, takes the entry off the list.
23+
24+
The list is read-only: it writes nothing, moves no count and does not change the exit code or the "already on protocol" verdict. `--type` narrows it like the rest of the report. It uses the same predicate as the source conversion `permission-view-all-fields-beside-record-bypass` (`os migrate meta --from 18`), so it names exactly the entries that conversion rewrites in a source.
25+
26+
- `@objectstack/metadata-protocol`: `StoredMigrationReport` gains `viewAllFieldsReview` (exported type `StoredViewAllFieldsReview`: `id`, `name`, `organizationId`, `packageId`, `state`, `object`, `bits`), and `formatStoredMigrationReport` prints it. `os migrate meta --stored --json` carries the same key, as an empty list on a database with no `sys_metadata` table yet, and so do the `POST /meta/_migrate-stored` response payload and `client.meta.migrateStored()`, which return the same report.
27+
- `@objectstack/spec`: the upgrade text of the protocol-19 semantic entry `permission-view-all-modify-all-cast-no-field-vote` no longer says that no command lists the affected stored sets; its description and its one-step check now name `os migrate meta --stored`. Text only: no schema, key or behaviour changes.

‎packages/cli/src/commands/migrate/meta.stored-actor.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2121
import { dirname, resolve } from 'node:path';
2222
import { fileURLToPath } from 'node:url';
2323
import MigrateMeta from './meta.js';
24+
// The packages the command reaches through dynamic imports, loaded at module top so the
25+
// first load is paid during collection, never inside a clocked case (`check:test-source-alias`).
26+
import '@objectstack/cloud-connection';
27+
import '@objectstack/driver-sql';
28+
import '@objectstack/driver-turso';
29+
import '@objectstack/metadata';
30+
import '@objectstack/metadata-protocol';
31+
import '@objectstack/platform-objects/plugin';
32+
import '@objectstack/plugin-hono-server';
33+
import '@objectstack/plugin-security';
34+
import '@objectstack/rest';
35+
import '@objectstack/service-automation';
36+
import '@objectstack/service-datasource';
37+
import '@objectstack/service-settings';
38+
import '@objectstack/service-storage';
2439

2540
const boot = vi.hoisted(() => vi.fn());
2641
vi.mock('../../utils/schema-migrate.js', () => ({ bootSchemaStack: boot }));
@@ -47,6 +62,7 @@ const CLEAN_REPORT = {
4762
failed: 0,
4863
rows: [],
4964
decisionModeReview: [],
65+
viewAllFieldsReview: [],
5066
};
5167

5268
const migrateStoredMetadata = vi.fn();
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* `os migrate meta --stored` — the review list of stored permission sets whose
5+
* View All / Modify All lost their field reach in protocol 19 (maintainer
6+
* ruling option A on #36055).
7+
*
8+
* A stored set keeps the 19 meaning (the bits widen records only), and the
9+
* upgrade text owes operators a one-step check of which stored sets are
10+
* affected. The pass names each `objects` entry carrying `viewAllRecords` or
11+
* `modifyAllRecords` and no `viewAllFields` under `viewAllFieldsReview`; this
12+
* file pins what the COMMAND prints and emits for it: the list and its fix in
13+
* the terminal, beside the on-protocol verdict, read-only (exit 0), and the
14+
* key on `--json`, including the report the command builds itself when
15+
* `sys_metadata` does not exist yet.
16+
*
17+
* The boot is replaced, so no database is opened; the command's own parse,
18+
* control flow and the real report renderer run.
19+
*/
20+
21+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
22+
import { dirname, resolve } from 'node:path';
23+
import { fileURLToPath } from 'node:url';
24+
import MigrateMeta from './meta.js';
25+
// The packages the command reaches through dynamic imports, loaded at module top so the
26+
// first load is paid during collection, never inside a clocked case (`check:test-source-alias`).
27+
import '@objectstack/cloud-connection';
28+
import '@objectstack/driver-sql';
29+
import '@objectstack/driver-turso';
30+
import '@objectstack/metadata';
31+
import '@objectstack/metadata-protocol';
32+
import '@objectstack/platform-objects/plugin';
33+
import '@objectstack/plugin-hono-server';
34+
import '@objectstack/plugin-security';
35+
import '@objectstack/rest';
36+
import '@objectstack/service-automation';
37+
import '@objectstack/service-datasource';
38+
import '@objectstack/service-settings';
39+
import '@objectstack/service-storage';
40+
41+
const boot = vi.hoisted(() => vi.fn());
42+
vi.mock('../../utils/schema-migrate.js', () => ({ bootSchemaStack: boot }));
43+
vi.mock('../../utils/migrate-occupancy-gate.js', () => ({
44+
OCCUPANCY_HINT: 'occupancy hint',
45+
probeMigrationTarget: vi.fn(async () => ({ status: 'free' })),
46+
}));
47+
vi.mock('../../utils/data-migration-plugins.js', () => ({ buildDataMigrationPlugins: vi.fn(async () => []) }));
48+
49+
const HERE = dirname(fileURLToPath(import.meta.url));
50+
const CLI_ROOT = resolve(HERE, '..', '..', '..');
51+
/** oclif builds its whole command table on the first `run()` in a process. */
52+
const RUN_TIMEOUT = 60_000;
53+
54+
const SCOPE = { id: 'r_1', name: 'ops_auditor', organizationId: null, packageId: null, state: 'active' as const };
55+
56+
/** An on-protocol run that names two entries of one stored set for review. */
57+
const REPORT = {
58+
apply: false,
59+
protocol: '19.0.0',
60+
scanned: 1,
61+
canonical: 1,
62+
pending: 0,
63+
rewritten: 0,
64+
skipped: 0,
65+
failed: 0,
66+
rows: [],
67+
decisionModeReview: [],
68+
viewAllFieldsReview: [
69+
{ ...SCOPE, object: 'ops_ticket', bits: ['viewAllRecords'] },
70+
{ ...SCOPE, object: '*', bits: ['viewAllRecords', 'modifyAllRecords'] },
71+
],
72+
};
73+
74+
const migrateStoredMetadata = vi.fn();
75+
let tableAbsent: (name: string) => boolean;
76+
let written: string[];
77+
let printed: string[];
78+
let stdout: ReturnType<typeof vi.spyOn>;
79+
let stderr: ReturnType<typeof vi.spyOn>;
80+
let log: ReturnType<typeof vi.spyOn>;
81+
82+
beforeEach(() => {
83+
migrateStoredMetadata.mockReset();
84+
migrateStoredMetadata.mockResolvedValue(REPORT);
85+
tableAbsent = () => false;
86+
boot.mockReset();
87+
boot.mockResolvedValue({
88+
kernel: { getService: (name: string) => (name === 'protocol' ? { migrateStoredMetadata } : undefined) },
89+
dbLabel: 'file:test.db',
90+
tableAbsent: (name: string) => tableAbsent(name),
91+
shutdown: vi.fn(async () => {}),
92+
});
93+
written = [];
94+
printed = [];
95+
// `emitJson` awaits the write's DRAIN callback, so the double invokes it.
96+
stdout = vi.spyOn(process.stdout, 'write').mockImplementation(((chunk: unknown, enc?: unknown, cb?: unknown) => {
97+
written.push(String(chunk));
98+
const done = typeof enc === 'function' ? enc : cb;
99+
if (typeof done === 'function') done();
100+
return true;
101+
}) as typeof process.stdout.write);
102+
stderr = vi.spyOn(process.stderr, 'write').mockImplementation((() => true) as typeof process.stderr.write);
103+
log = vi.spyOn(console, 'log').mockImplementation((...args: unknown[]) => {
104+
printed.push(args.map(String).join(' '));
105+
});
106+
});
107+
afterEach(() => {
108+
stdout.mockRestore();
109+
stderr.mockRestore();
110+
log.mockRestore();
111+
});
112+
113+
describe('os migrate meta --stored — the stored permission sets View All / Modify All no longer open fields for (ruling A on #36055)', () => {
114+
it('prints each listed entry and the `viewAllFields: true` fix, beside the on-protocol verdict', async () => {
115+
await MigrateMeta.run(['--stored'], { root: CLI_ROOT });
116+
117+
const text = printed.join('\n');
118+
expect(text).toMatch(/2 object entry\(ies\) in 1 stored permission set row\(s\) hold View All or Modify All/);
119+
expect(text).toContain("permission/ops_auditor [env-wide] — objects entry 'ops_ticket' (viewAllRecords)");
120+
expect(text).toContain("permission/ops_auditor [env-wide] — objects entry '*' (viewAllRecords, modifyAllRecords)");
121+
expect(text).toContain('add `viewAllFields: true` to the entry through the metadata API');
122+
expect(text).toMatch(/already on protocol/);
123+
// Read-only: the list asks nothing of the pass, so the preview asks for no write.
124+
expect(migrateStoredMetadata.mock.calls[0][0].apply).toBe(false);
125+
}, RUN_TIMEOUT);
126+
127+
it('--json carries the list under `viewAllFieldsReview`, and the run stays clean', async () => {
128+
await MigrateMeta.run(['--stored', '--json'], { root: CLI_ROOT });
129+
130+
const out = JSON.parse(written.join(''));
131+
expect(out.viewAllFieldsReview.map((r: { object: string }) => r.object)).toEqual(['ops_ticket', '*']);
132+
expect(out.clean).toBe(true);
133+
}, RUN_TIMEOUT);
134+
135+
it('a database with no `sys_metadata` yet answers an empty list, not a missing key', async () => {
136+
tableAbsent = (name) => name === 'sys_metadata';
137+
138+
await MigrateMeta.run(['--stored', '--json'], { root: CLI_ROOT });
139+
140+
expect(migrateStoredMetadata).not.toHaveBeenCalled();
141+
const out = JSON.parse(written.join(''));
142+
expect(out).toMatchObject({ scanned: 0, decisionModeReview: [], viewAllFieldsReview: [] });
143+
}, RUN_TIMEOUT);
144+
});

‎packages/cli/src/commands/migrate/meta.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,7 @@ export default class MigrateMeta extends Command {
16061606
failed: 0,
16071607
rows: [],
16081608
decisionModeReview: [],
1609+
viewAllFieldsReview: [],
16091610
};
16101611
const report: StoredMigrationReport = reads.absent('sys_metadata')
16111612
? noStoredRows

‎packages/cli/test/migrate-meta-stored-failed.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ import { resolve } from 'node:path';
2525
import { fileURLToPath } from 'node:url';
2626
import { stripVTControlCharacters } from 'node:util';
2727
import MigrateMeta from '../src/commands/migrate/meta.js';
28+
// The packages the command reaches through dynamic imports, loaded at module top so the
29+
// first load is paid during collection, never inside a clocked case (`check:test-source-alias`).
30+
import '@objectstack/cloud-connection';
31+
import '@objectstack/driver-sql';
32+
import '@objectstack/driver-turso';
33+
import '@objectstack/metadata';
34+
import '@objectstack/metadata-protocol';
35+
import '@objectstack/platform-objects/plugin';
36+
import '@objectstack/plugin-hono-server';
37+
import '@objectstack/plugin-security';
38+
import '@objectstack/rest';
39+
import '@objectstack/service-automation';
40+
import '@objectstack/service-datasource';
41+
import '@objectstack/service-settings';
42+
import '@objectstack/service-storage';
2843

2944
const boot = vi.hoisted(() => vi.fn());
3045
vi.mock('../src/utils/schema-migrate.js', () => ({ bootSchemaStack: boot }));
@@ -85,6 +100,7 @@ function reportOf(rows: ReturnType<typeof failedRow>[], apply = false) {
85100
failed: rows.length,
86101
rows,
87102
decisionModeReview: [],
103+
viewAllFieldsReview: [],
88104
};
89105
}
90106

‎packages/metadata-protocol/src/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ export type {
261261
StoredMigrationReport,
262262
StoredMigrationRow,
263263
StoredMigrationTodo,
264+
StoredViewAllFieldsReview,
264265
} from './stored-migration.js';
265266

266267
export {

‎packages/metadata-protocol/src/protocol-save.ts‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
translatedEchoNotices,
4040
} from './protocol-translated-echo.js';
4141
import { PROTOCOL_VERSION, stripReadDecorations } from '@objectstack/spec/kernel';
42-
import { collectDecisionModeReview } from './stored-migration.js';
42+
import { collectDecisionModeReview, collectViewAllFieldsReview } from './stored-migration.js';
4343
import type {
4444
StoredFlowCanonicalization,
4545
StoredMigrationNotice,
@@ -2650,6 +2650,7 @@ export class ProtocolSaveFacet {
26502650
failed: 0,
26512651
rows: [],
26522652
decisionModeReview: [],
2653+
viewAllFieldsReview: [],
26532654
};
26542655

26552656
// Two scoped queries rather than one unfiltered scan: `state` is an
@@ -2813,6 +2814,28 @@ export class ProtocolSaveFacet {
28132814
}
28142815
}
28152816

2817+
// [ruling A on #36055] The View All Fields review list — REPORT ONLY,
2818+
// the same posture as the decision list above. A stored permission
2819+
// set's `objects` entry with View All or Modify All and no
2820+
// `viewAllFields` read every field before protocol 19 and reads no
2821+
// field another set hides now; by ruling the row keeps that new
2822+
// meaning (no pass rewrites it), and this names each such entry so
2823+
// an operator can add `viewAllFields: true` where the set meant to
2824+
// read every field. Read off the stored body, before the chain, so
2825+
// it touches no count, no outcome and no write.
2826+
if (singular === 'permission') {
2827+
for (const entry of collectViewAllFieldsReview(body)) {
2828+
report.viewAllFieldsReview.push({
2829+
id: base.id,
2830+
name: base.name,
2831+
organizationId,
2832+
packageId,
2833+
state,
2834+
...entry,
2835+
});
2836+
}
2837+
}
2838+
28162839
// Flow rows need the automation engine's canonicalizer — its
28172840
// registration preview judges plugin nodes against the live
28182841
// registry — supplied by the caller (#4454) or resolved from the

0 commit comments

Comments
 (0)