Repository navigation
fix(metadata-protocol): search titles a reference-typed nameField by its target's title - #35292
Conversation
…its target's title searchAll rendered row[nameField] as stored, so an object whose primary-title pointer is a lookup / master_detail / user field was titled in the palette and global search by the target's raw id. The title now follows the reference to the target's ADR-0079 title: one id-$in read per swept object, as the searcher, so a reader refused the target (object, row or title column) keeps the bare id. The hit's wire shape does not change. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
…h lookup title pin Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
📓 Docs Drift CheckThis PR changes 1 package(s): ⛔ 1 release-owned page(s) name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 6fc830263d6e82ed2edce6a83a46ec93666985e2 && git checkout 6fc830263d6e82ed2edce6a83a46ec93666985e2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bc75bcdbcda385cdae2cc2384b7307184fc3cb8c 6e7422813bddd2b80b836605077e989be9281cdc && git checkout -B drift-repro bc75bcdbcda385cdae2cc2384b7307184fc3cb8c && git merge --no-ff 6e7422813bddd2b80b836605077e989be9281cdc
node scripts/docs-audit/affected-docs.mjs --json bc75bcdbcda385cdae2cc2384b7307184fc3cb8c
|
…object exposure pin The search title read resolves a reference target through referenceTargetOf, so the core pin requires it classified: a decided read, its exposure asked for get in servesSearchTitleTarget, pinned by protocol.search-title-lookup.test.ts. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me Final green head for L1: Checks at this head: 59 success, 13 skipped, 0 failed. Not governed ( |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head
|
… the changeset's $expand comparison
The changeset now says a refused reader keeps the bare id as $expand answers on a
field that does not declare referenceNameVisible (a declaring field answers
{ id, name, readRefused: true } there).
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me Landing · head
Follow-ups owed by the ACCEPT, nested under #34175: #35307 (record-share palette title), #35308 ([Decision] |
Requested by Bill · project thread
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me
Fixes #34175
Clause-②: no
Metadata-protocol: none
维护者速读
nameField是引用字段(lookup / master_detail / user / tree)时,命中标题不再显示目标记录的原始 id,而是显示目标记录自己的标题。$expand)和活动时间线早已显示目标名称,只有搜索面板还在显示 id,用户无法分辨命中的是谁。packages/metadata-protocol/src/protocol-record-reads.ts的readReferenceTitles(读取身份与拒绝分支),其次同文件searchAll中hitRows一段(批量收集 id)。pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.search-title-lookup.test.ts,预期 11 个测试全绿。What changes
searchAll→renderTitlereturnedrow[nameField]as stored. When the pointer is a reference field, that value is the target record's id, so the palette titled such a hit by a raw key. Now:nameField, else the deprecateddisplayNameField) in onefind(target, { where: { id: { $in } }, fields: ['id', title], limit })per swept object. No N+1 per hit.referenceTargetOfanswer (the same arbiter the$expandgate and engine ask), souserresolves tosys_userwith noreferencedeclared, andtreefollows too.contextgoes tofind, so the target's object gate, row scope and FLS apply as they do to$expand. A reader refused the target keeps the bare id:get(canServeApiOperation) → not read;canReadObject(target)false → not read;PERMISSION_DENIED→ no titles;isMissingTableError).recordstill carries the stored id, no$expandon the palettefind. Onlytitlechanges.resolveLookupTitles); metadata-protocol sits below it and below objectql.servesSearchTitleTarget, and the new reference-target read is classified as adecidedread inpackages/core/src/security/second-object-read-exposure.pin.test.ts(CALLERS, plus the pinned list of decision functions). That pin reds any unclassified caller ofreferenceTargetOf. It was red on this PR's earlier head (Test Core 6/10) and is green now.Tests
New
packages/metadata-protocol/src/protocol.search-title-lookup.test.ts(11 cases): the title followslookup,master_detailanduser; one target read per swept object, as the searcher,id+ title only; the wire shape; four refused-reader legs (object refused before the read, refusal thrown by the read, row scope, FLS strip); exposure withoutget; an outage propagates with its envelope (code+status); a text pointer pays no extra read.Acceptance notes
mainfirst, at d6d9645, with the new test file: the PIN answered{ pm_1: 'per_1', pm_2: 'per_2', pm_3: 'per_1' }, so each hit was titled by the stored lookup id. 7 of 11 failed on main. The 4 that passed there are the refusal, exposure, wire-shape and control legs, which hold on main because main never follows the reference.sys_record_share.recipient_id, is aField.textcolumn (a polymorphic principal id read withrecipient_type), not a reference field. So this fix does not change that object's palette title. Following it needs therecipient_type-keyed directory read the console'srecipient-pickerface does, which is a separate design. Stock objects with a referencenameFieldin this repo aresys_scim_subject(searchable: false) andsys_session(skipped by name prefix), so no stock object reaches the palette through this path. The reach is app objects, for example HotCRM'scrm_project_memberbehind Record activity rows title a record by its raw lookup id when the object's nameField is a lookup ("Created Project Member \"gCX6SR…\"") #34055.referenceNameVisible(ruling 6574398310) is not served here. A refused reader keeps the bare id, as the dispatch states. Serving a refused reader the target's name needs a system-context read, which is a new disclosure decision and not in this card.,. When nothing resolves, the value is rendered exactly as before.searchAllmethod docblock inprotocol.tsis not edited because it is outside this claim's file surface. The contract text for the new read is onreadReferenceTitlesand at the call site.Verification
Red leg on main (d6d9645)
Green, package suite and typecheck
Run at bc101ad (source identical to the current head; the later commit only adds a module-top import to the new test file, re-run green:
Tests 11 passed (11)at 7e664c7).Ablation (committed fix, then mutated, then restored)
Deleted
if (canReadObject && !(await canReadObject(target))) return titles;withscripts/ablation-replace.mjs: anchor 1 to 0, blob 35ced7511b80 to f92c32c63df5. Result:× REFUSED — an object-level refusal keeps the bare id, and the target is never read,Tests 1 failed | 10 passed (11). Restored: blob equals HEAD (35ced7511b80) andgit diff HEADis empty.Derived gates and CI
Final head ff64484.
dispatch-gates --commandsderived 69 families. All 69 were run locally and every one exited 0.dispatch-gates --ranreported: 69 accounted for, 0 NOT-MEASURED, 0 UNRUN, exit 0. Pre-pushoverlap-checkgave VERDICT clean exit 0.Along the way:
check:test-source-aliasfailed on the new test file because it needed a module-topimport '@objectstack/lint'. Fixed in 7e664c7.check:lean-entry-closurefirst exited 3 because the objectql dist had not been built. After building objectql it exited 0.Test Core (6/10)failed on the coresecond-object-read-exposurepin because the new caller was not yet classified. Fixed in ff64484; locally that pin givesTests 4 passed (4).Test Core (8/10)hit a 5000 ms timeout inplugin-securityorg-admin-assignment-boundary.posture.test.ts. That file is untouched here. Locally it givesTests 104 passed (104), and it is green on ff64484.CI check-runs on ff64484: every non-skipped run has
completed/success. That includesLint & Repo Gates,TypeScript Type Check,Test Core(10/10 shards),Build Core,Governed Surface Queue Guard,Test UI,Type Check UI,Build & E2E UI,Live E2E UI,Dogfood Regression GateandCheck Changeset.🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me