Skip to content

fix(fields): a user field's person object is always sys_user (user cell and picker) - #26050

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-25937-user-cell-sys-user
Oct 26, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-25937-user-cell-sys-user

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #25937

Clause-②: no
Metadata-protocol: none

What

A user field's person object is now always sys_user in the console, matching the spec contract from #24952 (PR #25074): FieldSchema refuses a user field whose reference names any object but sys_user, and referenceTargetOf resolves every user field to sys_user whatever the field carries.

  • ui/packages/fields/src/index.tsx, UserCellRenderer: the read gate's object was field.reference || 'sys_user'. It is now the constant 'sys_user', and the renderer no longer reads field at all. The JSDoc is rewritten: it said the person's object is "the field's reference".
  • ui/packages/fields/src/widgets/UserField.tsx: the picker's target was meta?.reference || 'sys_user'. It is now 'sys_user', with the comment rewritten to match.
  • ui/packages/fields/src/__tests__/userCell.readGate-10535.test.tsx: the crm_member case flips. A { type: 'user', reference: 'crm_member' } field is now gated by the sys_user policy, and its drawing is byte-equal to a plain { type: 'user' } field under the same policy. A crm_member policy no longer reaches it. The header bullet and the test title no longer say the person's object is the field's reference. The retired reference_to case is unchanged and still passes.
  • scripts/sdui-manifest.record.json: re-recorded with node scripts/gen-sdui-manifest-node.mjs, because ui/packages/fields/src is a registry source the record digests.
  • .changeset/25937-user-cell-sys-user.md: @object-ui/fields patch.

The route is the type's constant, not a call to referenceTargetOf. That helper reads the field's reference carrier first and throws when the carrier is unreadable (referenceCarrierOf), so it does not belong in a render path. objectui also does not import the spec's field helpers.

Behaviour change to note: which policy gates a stored foreign reference

The renderer read gate (withoutDeniedFields) is keyed by object name. A stored object saved before the spec refusal can still carry a user field with a foreign reference, for example crm_member. The cell used to gate that field by the crm_member policy. It now gates it by the sys_user policy. That is the object the runtime expands the field into (referenceTargetOf), so the cell now hides exactly what the served row's own object denies. The picker also searches sys_user for such a field now, not the foreign object. This is the card's intent: a link to another object is a lookup.

Verification

All readings were taken at head 11a85a02, after main was merged in at c8cb510a, on a shared box.

  • cd ui && pnpm exec vitest run --maxWorkers=2 packages/fields/ under the verify lock: Test Files 277 passed | 1 skipped (278), Tests 4290 passed | 7 skipped (4297), VERDICT command-exit 0.
  • pnpm --filter @object-ui/fields type-check (tsc --noEmit && tsc -p tsconfig.test.json; the test config compiles __tests__): VERDICT command-exit 0.
  • eslint over the three edited ui files: 0 errors. The 152 warnings were already there.
  • Ablation, one leg, with the fix committed first. scripts/ablation-replace.mjs put the old read back in place of const personObject = 'sys_user';, that is field.reference || 'sys_user'. The tool reported the anchor going 1 to 0 and the blob going 2ac4abd3f41c to 644362b7ff75. Result: userCell.readGate-10535.test.tsx 1 failed | 6 passed. The flipped case failed at :164: expected … not to contain 'Amy Lin', because the crm_member field was no longer gated by the sys_user policy. On restore, the blob was back to the HEAD blob 2ac4abd3f41c and git diff HEAD was empty. The green leg at the same head: 7 of 7 passed.
  • The test imports ../index (source), so the ablation needs no dist/ rebuild.
  • node scripts/gen-sdui-manifest-node.mjs (under the lock, exit 0) re-recorded only inTree.registrySourcesSha256. sdui.manifest.json is byte-identical: sha256 1f6e1ccb925a…, 106 components. node scripts/check-sdui-manifest.mjs passes.
  • Derived gates: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack gave 46 commands, and all 46 exited 0. pnpm check:type-check-debt hit a 300 s local timeout on its first run and passed on the rerun, with no surplus. --ran reconciliation: 46 derived, 46 run, 0 NOT-MEASURED, 0 UNRUN.
  • node scripts/check-changeset-fixed.mjs: in sync. Its roster sits under .changeset/, which this PR touches.
  • Full dogfood: not run. The title has no ! and Clause-② has no (narrowing) arm.

Acceptance notes

  • LookupCellRenderer's comment in ui/packages/fields/src/index.tsx still lists UserField among the readers that read reference. That is now stale, because UserField fixes the target. The comment sits outside this card's declared file region (UserCellRenderer only), so this PR leaves it alone. Carrier: none.
  • RecordMetaFooter's UserRef (ui/packages/plugin-detail) still builds reference: fieldDef?.reference || 'sys_user' for audit fields. When the field is typed user, the cell renderer now ignores that reference, so nothing visible changes. Observation only.

Generated by Claude Code

The user cell gated its read by the field's authored `reference` and the
person picker targeted it; the spec now refuses a foreign `reference` on a
`user` field and referenceTargetOf resolves every user field to sys_user,
so both read the type's constant instead.

Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

ACCEPT · domain:ui seat 2 · session_01SMps7wq7rBTk53e8KTSEup · 2026-10-26T10:14Z · head 11a85a02

  1. 形态: draft PR → main, assigned to os-steve. The first content line is Fixes #25937, which is right because the whole card lands here. No other closing keyword appears. Clause-②: no and Metadata-protocol: none each open their own line in the PR body and in the changeset. no is correct: nothing is exported or accepted that wasn't before, and the console now reads the user type the way the spec already defines it (spec(data) 18.x: refuse a user field whose reference names an object other than sys_user, and resolve every user field to sys_user (the refusal half of #24808) #24952).
  2. 前提实测: the seat read the diff at this head.
    • UserCellRenderer's person object is the constant 'sys_user' (the field prop is no longer read).
    • UserField normalizes reference: 'sys_user'.
    • A legacy body that still carries a foreign reference is now gated by the sys_user policy. The runtime expands the field into sys_user, so that policy is the right one. This is the narrower reading, and no row of another object is exposed.
    • The flipped crm_member case pins it, and the retired reference_to case is unchanged.
  3. 门禁 check-runs: none yet. GitHub reports the PR as mergeable=false / dirty (the manifest record conflicts with main), so no pull_request run has started. Landing waits on a conflict-free head with Lint & Repo Gates and TypeScript Type Check at success, and every other check green.
  4. 接受的偏差:
    • The first commit used --no-verify before the clone's hooks were registered (core.hooksPath unset), so no hook was actually skipped. Later commits ran them.
    • The ui tests ran through the ui workspace's vitest. Neither changes the diff.
  5. 范围外去向: two observations, both left unfiled.
    • The LookupCellRenderer comment (~L2566) still lists UserField among the readers of reference. It is a stale comment outside the claimed region, and it can ride the next card that edits that region.
    • RecordMetaFooter's UserRef still builds a reference that the cell now ignores. Nothing visible changes.
  6. 落地条款: no governed path, +50/−24, root .changeset/ patch for @object-ui/fields. A merge of main that only resolves the conflict and re-records the manifest keeps this ACCEPT.

…er-cell-sys-user

# Conflicts:
#	scripts/sdui-manifest.record.json
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling labels Oct 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Seat 2 · head update · 2026-10-26T10:53Z

Patch round at head b7b9d521. The seat read the three-dot diff against main.

  • Main was merged in (95204415, no rebase), and scripts/sdui-manifest.record.json was re-recorded twice: after the merge and after the plugin-grid edit.
  • Amendment 6413913258: RELATIONAL_META_READ_SET.reference readers ALL_THREE → CELL_AND_LOOKUP_EDITOR, a one-line change. It is the only change in relationalMetaKeys.ts, and ObjectGrid.tsx is untouched.
  • The file list is the 5 accepted files plus the amended relationalMetaKeys.ts.

The dev ran the derivation test 14/14 locally, the full plugin-grid suite 248/248 files, and check-sdui-manifest exit 0. ACCEPT 6413530615 carries over to b7b9d521. Landing waits on CI being green at this head.

Out of scope, accepted with no carrier: the LookupCellRenderer comment in fields/src/index.tsx (~2566) still lists UserField as a reference reader. It is a stale comment only, so it can be fixed alongside the next card that touches that region.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 26, 2026 10:55
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 26, 2026 10:55
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 26, 2026
os-zhuang pushed a commit that referenced this pull request Oct 26, 2026
… different packages stop conflicting (#26120)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DPXV532seCFDcrkAJybGzsf)_

Fixes #26051

Clause-②: no
Metadata-protocol: none

Part of the p1 merge-queue backlog work (#26074). Dispatched by seat
`domain:devx#1` (#6023), claim 6415558140, card-thread session
`session_01SMJGPXxFBpbgAgXdnsXKVS`.

## What changes

`scripts/sdui-manifest.record.json` carried ONE
`inTree.registrySourcesSha256` over the `src/` of all 27 ui registry
packages, so any two ui PRs that touched any registry package conflicted
on that line. Now:

- **One record per registry package**, one file each, one line each:
`scripts/sdui-manifest.sources/PACKAGE.json` =
`{"package","sources","sha256","manifestSha256"}` (the package's own
`src/` digest, its file count, and the sha256 of the artefact it was
verified against). 27 files.
- **The shared record** (`scripts/sdui-manifest.record.json`, same path)
keeps only what describes the artefact: `sha256`, `components`,
`generatedAt`, and `inTree` = `modulesRoot`, `objectuiWorkspaceVersion`,
`registryRecords` (the directory). The retired `registryPackages` /
`registrySources` / `registrySourcesSha256` are refused if they
reappear.
- **The reached package set** is the set of record files: a reached
package with no record (new package, new dependency edge into the
registry, deleted record) is RED; a record the registry no longer
reaches (removed package, dropped edge) is RED.
- `sdui.manifest.json` is byte-identical (sha256 `1f6e1ccb925a…`, 106
components).

`lint.yml`'s command line (`node scripts/check-sdui-manifest.mjs
--self-test && node scripts/check-sdui-manifest.mjs`) is unchanged and
keeps working. No `.github/**` or `ui/.github/**` edit.

## Measured first (Ask 1): own `src/` per package, not
dependency-inclusive

Tree: objectstack `0a6948210c` (base), 27 reached packages, 922 non-test
sources.

**Detection is the same as one digest over the set.** Any edit under any
reached package's `src/` moves exactly that package's digest, so a
single PR's edit is caught exactly as before; a dependency's edit is
caught through the dependency's own record. Dependency-inclusive digests
add no single-PR detection. They would only add conflicts, and at this
cost (records a `src/` edit would touch):

| package edited | own `src/` (this PR) | dependency-inclusive |
|:--|:-:|:-:|
| `types` | 1 | 25 |
| `core` | 1 | 21 |
| `data-objectstack`, `i18n` | 1 | 19 |
| `react`, `react-runtime`, `sdui-parser` | 1 | 18 |
| `components` | 1 | 17 |
| `fields` | 1 | 14 |
| `plugin-detail` | 1 | 10 |
| `plugin-form`, `plugin-grid` | 1 | 2 |
| the other 11 plugins | 1 | 1 |

**Merge experiment, real tree, `git merge-tree --write-tree` (no merge
driver routes these paths; `git check-attr merge` = unspecified, so this
is GitHub's answer):** each branch appends a comment to one `src/` file
and runs the generator.

| pair | before (single digest, on `0a6948210c`) | after (this PR, on
`a8114011`) |
|:--|:--|:--|
| `plugin-grid/src/FormulaBar.tsx` × `plugin-form/src/DrawerForm.tsx` |
exit 1, CONFLICT in `scripts/sdui-manifest.record.json` | exit 0, clean;
the merged tree passes `check-sdui-manifest` (exit 0) |
| `plugin-grid/src/FormulaBar.tsx` × `plugin-grid/src/ObjectGrid.tsx` |
(conflicts) | exit 1, CONFLICT in
`scripts/sdui-manifest.sources/plugin-grid.json` only, by design |

**The open ui PRs today** (registry packages each changes, non-test
`src/` only; none changes `sdui.manifest.json`): #25987 i18n,
plugin-grid, plugin-list · #25998 plugin-detail · #26040 components,
i18n · #26045 i18n · #26027 plugin-dashboard · #26030 plugin-grid ·
#26033 core, plugin-form, plugin-grid · #26042 plugin-form · #26044 i18n
· #26048 i18n, plugin-map · #26050 fields, plugin-grid · #26062 fields.
Under the single digest all 12 conflict pairwise (12 serial landings).
Under this layout they conflict only within a shared package; the
largest group is `i18n` (5 PRs), so they can land in 5 rounds, e.g.
{#25987, #25998, #26027, #26042, #26062} → {#26040, #26030} → {#26045,
#26033} → {#26044, #26050} → {#26048}, assuming no source-level
conflicts between them.

## The check (Ask 2)

`checkTreeWithoutPin` compares each reached package's digest with its
own record and names every stale package (`ui/packages/plugin-grid: now
38 file(s) sha256 …, recorded …`), every unrecorded package, every
record the registry no longer reaches, every record verified against
another artefact, and every malformed record, then prints the one
command: `node scripts/gen-sdui-manifest-node.mjs`. The pin mode
(`.objectui-sha` present) is untouched.

**Why `manifestSha256` is in every package record, and why one line:** a
PR that changes the artefact re-records every package against the new
sha256, so it still conflicts with every in-flight registry PR, which
must regenerate on the merged tree (that is today's behaviour, kept for
the case where it matters). Two PRs on the same package touch the same
line and conflict. One line per file guarantees git cannot merge a
digest from one side with an artefact sha256 from the other; a record
that is not in the producer's one-line form is RED.

**What this does not force, stated rather than implied:** two PRs on
different packages that each leave the artefact unchanged, where only
their combination would change it, land without any run seeing the
combination. Under the single digest their textual conflict forced that
run. Here the next regeneration of any registry package sees the
combination. Dependency-inclusive digests would close this only along
import edges (not between siblings that interact through
`ComponentRegistry`), at the fan-out above. No stale or missing registry
source passes: every source edit still reds until regenerated, and every
package added to or removed from the reached set still reds.

## Self-test (Ask 3)

29 rows (was 22), roster and floor updated. New or changed in-tree rows:
a staged edit to one package is RED naming that package and NOT naming
`plugin-form` or `core`; a new package the registry reaches; a new
workspace edge (now names `ui/packages/unrelated`); a removed package
(names `scripts/sdui-manifest.sources/types.json`); a deleted package
record; a record verified against another artefact; a record out of its
one-line form; a record from the single-digest layout; and the producer
re-recording only the moved package (it back-dates the shared record
first, so a producer that stamps today's date reds the row).

Ablations, one at a time through `scripts/ablation-replace.mjs`, each
restored with `git diff HEAD` empty:

| guard removed | self-test |
|:--|:--|
| the other-artefact comparison (gate) | exit 1, row "a package record
verified against another artefact is RED" expected RED got GREEN |
| the one-line form comparison (gate) | exit 1, row "a package record
out of its one-line form is RED" |
| the unreached-record list (gate) | exit 1, row "a removed registry
package is RED naming its record" |
| the `generatedAt` carry (producer) | exit 1, row "the producer
re-records only the package whose sources moved": the second run changed
the shared record too |
| the per-package record write (producer) | exit 1, the two producer
rows |

## The generator (Ask 4)

It re-records only the packages whose line changed and leaves the others
byte-identical; it removes a record the registry no longer reaches; it
prints which packages it re-recorded. The shared record moves only with
the artefact: `generatedAt` and the provenance version are carried while
the artefact's sha256 is unchanged (the same rule the pin-keyed fields
already follow), so a regeneration on another day no longer moves a
shared line.

**It still builds, and why:** the build plus the enumeration is the only
oracle that says whether `sdui.manifest.json` moved. A record written
without it would stamp a current digest on a manifest no run checked,
which is the narrowing this card forbids. The 8 minutes is a cold turbo
cache, not the build of one package. Measured on `0a6948210c`, one
container, no remote cache (`TURBO_TOKEN` unset):

| run | wall | turbo |
|:--|:-:|:--|
| cold | 8m49s | 0 of 63 cached, 8m43s |
| nothing moved | 6s | 63 of 63 cached |
| one edit under `plugin-grid/src` | 33s | 61 of 63 cached, 27s |
| one edit under `core/src` | 2m50s | 41 of 63 cached, 2m44s |

## Readers moved (Ask 5)

- `docs/releases-maintenance.md`: the regenerate section describes the
per-package records, the re-record rule and which PRs still conflict.
- `scripts/check-changeset-no-major.mjs`: the "measured out" comment,
the real-build assertion (neither record is shipped) and the
records-only control now cover `scripts/sdui-manifest.sources/`. Its
`--self-test` passes (456 assertions).
- `scripts/ui-import/README.md` is not edited: line 140 records what the
cutover's step 4 wrote at the time, and that file still exists at that
path.
- `git grep -n "sdui-manifest.record"` outside CHANGELOGs: only the two
scripts, the docs page, `check-changeset-no-major.mjs` and that
historical README line. `git grep registrySourcesSha256`: only the
retired-field list and its self-test row.

## After this lands: what an in-flight ui PR does (once)

A ui PR whose branch re-recorded the old single digest conflicts once on
`scripts/sdui-manifest.record.json`:

```sh
git merge origin/main                                   # conflict in scripts/sdui-manifest.record.json
git checkout --theirs scripts/sdui-manifest.record.json  # take main's layout
node scripts/gen-sdui-manifest-node.mjs                  # re-records only this PR's package(s)
git add scripts/sdui-manifest.record.json scripts/sdui-manifest.sources sdui.manifest.json
git commit
```

After that, PRs on different registry packages no longer conflict with
each other on the record.

## Gates

Local, on `a8114011` (derived with `node scripts/pm/dispatch-gates.mjs
--commands`): 39 of the 40 derived families exit 0, including `node
scripts/check-sdui-manifest.mjs --self-test` (29 cases) and `node
scripts/check-sdui-manifest.mjs`, `node
scripts/check-changeset-no-major.mjs --self-test` and `--base
origin/main`, `pnpm check:nul-bytes`, `pnpm check:watch-hint-literal`,
`pnpm check:required-contexts`, `pnpm check:doc-authoring` and `pnpm
--filter @objectstack/lint run check:doc-formula-expressions` (after the
lint closure build). `pnpm check:pm-dispatch-gates` was still running
when this PR opened; its reading goes into the report comment on #26051,
and CI runs it in Lint & Repo Gates.

CI on the PR's check-runs: pending at the time of writing; the seat
reads them.

Changeset: none, `skip-changeset`. The diff touches only root `scripts/`
(private), `docs/` and the records; `sdui.manifest.json` is
byte-identical and neither record is copied into
`packages/console/dist/` (the `check-changeset-no-major` real-build
assertion above).

Not Tier H: no governed path (`git diff --name-only` has no `.github/`,
`.claude/`, `docs/adr/`, `skills/`, `AGENTS.md`, `CLAUDE.md`).

## Acceptance notes

- `i18n` is the hot package: 5 of the 12 open ui PRs touch its `src/`,
so they still serialize on `scripts/sdui-manifest.sources/i18n.json`.
Whether locale data belongs in the digest at all is a narrowing question
(it would let a source change pass unregenerated), not something this PR
decides.
- The cold-cache cost of a regeneration (8m43s here) is a
fresh-container property; card threads run with no turbo remote cache.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01SMJGPXxFBpbgAgXdnsXKVS)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
…er-cell-sys-user

# Conflicts:
#	scripts/sdui-manifest.record.json
…r merging main

Since the per-package sdui record split, the provenance for a registry source
edit lives in scripts/sdui-manifest.sources/<pkg>.json; the global record took
main's side in the merge and the generator re-recorded the two packages this
branch edits. The artefact sdui.manifest.json is byte-unchanged.

Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Seat 2 · 2026-10-26T16:44Z · CI red that is not this PR's

Test UI (9/16) fails ui/packages/app-shell/src/services/MetadataService.retiredObjectEnabled.test.ts:161 with expected 48 to be 47 (check-run 121703010847). This PR touches fields, plugin-grid and their records, not app-shell. On main, #26005 added sharing to ObjectSchema, and every ui PR's merge ref fails this guard the same way.

The fix is #26231 (#26218), which is in the merge queue now. Nothing is ported here, so this PR's diff stays as accepted. After #26231 merges, this PR's patch round (in progress) merges main again and CI re-runs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Seat 2 · head update · 2026-10-26T17:18Z

Patch round at head 02986dd2 (was b7b9d521): merge of origin/main at df8aac41, with the record conflict resolved to main's, then a re-record under the lock. Only sources/fields.json and sources/plugin-grid.json move; the global record and sdui.manifest.json are unchanged. No product or test logic changed since the ACCEPT (6413530615).

check reading
check-sdui-manifest exit 0 (27 packages)
Console build exit 0, 71/71 tasks
fields + plugin-grid suites 528 files / 6532 tests passed
dispatch gates 47 derived, 47 run, all exit 0
line plugin-grid #26030 ✓ → #26033 ✓ → this; fields #26062 ✓ → this
drift no commit on main touches fields, plugin-grid or their sources records since 81bba6c3; git merge-tree clean
governance NOT governed, 78 lines

Seat's route: auto-merge. #26217 (#25942 step 2) follows on the plugin-grid line.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 9598405 Oct 26, 2026
59 of 61 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-25937-user-cell-sys-user branch October 26, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fields: userCell gates by the authored reference of a user field, but objectstack now resolves every user field to sys_user (objectstack#24952)

2 participants