Repository navigation
fix(plugin-audit): an activity summary names a referenced record by a title the writer may read, else by its id - #34493
Conversation
… title the writer may read, else by its id Both summary branches that name a referenced record (the tracked-change diff and a fired milestone's tokens) read the title in the writer's scope, the scope the record label already reads in. An id whose record or title column the writer may not read keeps its stored id. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ADHkmRiaNzHVY81pCjZrpv
…title the writer may read Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ADHkmRiaNzHVY81pCjZrpv
…ry-titles-in-writer-scope
📓 Docs Drift Check1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 12 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 748820e4452a6676a4cbfb1f48a463b4a8c41265 && git checkout 748820e4452a6676a4cbfb1f48a463b4a8c41265
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 495a79c7b38c82b4ca4c840b387626b6a1a4b16e 7c093c01a1de80c60494979c5ade5751fd3a94d6 && git checkout -B drift-repro 495a79c7b38c82b4ca4c840b387626b6a1a4b16e && git merge --no-ff 7c093c01a1de80c60494979c5ade5751fd3a94d6
node scripts/docs-audit/affected-docs.mjs --json 495a79c7b38c82b4ca4c840b387626b6a1a4b16e |
|
security#1 · os-steve · session_01ADHkmRiaNzHVY81pCjZrpv {
"issue": null,
"status": "needs_decision",
"branch": "claude/activity-summary-titles-in-writer-scope",
"pr": "https://github.com/objectstack-ai/objectstack/pull/34493",
"session": "session_01ADHkmRiaNzHVY81pCjZrpv",
"premise_still_valid": true,
"summary": "Both activity-summary branches that name a referenced record (tracked-change diff, fired-milestone token) now read the title in the writer's scope, the scope the record label already reads in (#34172); an id whose record or title column the writer may not read keeps its stored id, per id, with no read added. Draft PR #34493 (head 7c093c01, origin/main merged once) carries the fix, 11 rule-named pins in a new file, and a patch changeset stating the rule only. Status is needs_decision for ONE sub-case only: honouring a lookup's referenceNameVisible in activity rows the way $expand does needs a choice (see open_questions); the PR as written is option A, which names a declaring field's target by its id when the writer is refused it, the same as the record label already does. Landing the PR as is = choosing A.",
"ruling_6574398310": {
"url": "https://github.com/objectstack-ai/objectstack/issues/29171#issuecomment-6574398310",
"author": "zhuangjianguo (director#1), 2026-11-02T10:05:41Z, maintainer approval quoted in the ruling",
"verbatim_binding_section": "**What the ruling binds**\n\n- A new optional key on the referencing `lookup` field (name chosen by the `domain:spec` seat; meaning: \"a principal who can read this record may see the target record's display name\"). Declared per field by the application author; default off, so the objectui#13335 posture (「受限记录」) is unchanged for every field that does not declare it.\n- Placement is the referencing field, not the target object: the application decides whose name its own portal pages reveal. A target-object-level \"my name is public to every referrer\" switch is refused.\n- What the engine returns for such a field when the caller cannot read the target: the target's `nameField` value and the id, nothing else. `expand` on that field returns the same (name + id), never other fields. The same key covers `sys_user` names; no separate carve-out.\n- The console renders the name as text with no link to the target record.\n- Option A (every portal app keeps its own snapshot field + sync flow) and option C (every lookup returns the target name regardless of read access) are refused.",
"how_it_bears": "The ruling governs what the engine and $expand return for a declaring field when the caller cannot read the target; it says nothing about activity rows. The engine serves it from serveReferenceNames (objectql, private method) after the caller's own expansion, gated by the caller's field-level answer on the name field (servableNameField). Neither is reachable from plugin-audit without exporting it from objectql (outside the file surface) or copying it."
},
"surface_grep_before_edit": "audit-writers.ts hits for ruling / maintainer / ⛔ were read; the binding one for this change is maintainer ruling Option A+ (#6656 / PR #6977: zero reads by default, one read per distinct target object on the write hot path). Honoured: the fix swaps the reader of the existing read and adds no read. No Ruling-ref hits.",
"files_changed": [
"packages/plugins/plugin-audit/src/audit-writers.ts (+26/-17: both summary call sites pass the hook api; resolveLookupTitles param renamed writerApi and its 'Whose read it is' docblock states the rule for every caller; two docblock lines aligned)",
"packages/plugins/plugin-audit/src/activity-summary-title-writer-scope.test.ts (new, 11 cases)",
".changeset/activity-summary-titles-writer-scope.md (new, @objectstack/plugin-audit patch, Clause-②: no, Metadata-protocol: none)"
],
"tests": "PREMISE on fresh origin/main bf76922925 (before any edit, new pin file only): `pnpm --filter @objectstack/plugin-audit exec vitest run --maxWorkers=2 src/activity-summary-title-writer-scope.test.ts` -> Test Files 1 failed (1) · Tests 7 failed | 4 passed (11); the 4 passing are the controls (allowed writer, system write, per branch). After the fix (526a97c7): that file + activity-lookup-name-field-label-34055 + audit-lookup-summary + audit-milestone-summary -> Test Files 4 passed (4) · Tests 70 passed (70). ABLATION (scripts/ablation-replace.mjs, src import so no dist leg; trap restore with absolute path): M1 tracked branch call reverted to its base-source argument -> 4 failed | 7 passed (11), 'ok mutation landed: anchor 1 -> 0', restored 'blob == HEAD (b8e96db505a1) and git diff HEAD is empty'; M2 milestone branch call reverted -> 3 failed | 8 passed (11), same landed/restored lines. FULL PACKAGE at merged head 7c093c01 under os-verify-lock: `pnpm --filter @objectstack/plugin-audit test && pnpm --filter @objectstack/plugin-audit typecheck` -> Test Files 100 passed (100) · Tests 1665 passed (1665) · check:test-typecheck OK (0 debt) · VERDICT command-exit 0. Closure rebuilt after the merge (turbo build --filter=@objectstack/plugin-audit..., 16/16) and `@objectstack/spec check:generated` -> all 14 generated artifacts up to date. test:repo not run locally (diff touches no repo-project test; CI Test Core).",
"ablation": {
"M1_tracked_change_branch": {
"red": 4,
"of": 11,
"restored": "blob == HEAD b8e96db505a1, git diff HEAD empty"
},
"M2_milestone_branch": {
"red": 3,
"of": 11,
"restored": "blob == HEAD b8e96db505a1, git diff HEAD empty"
}
},
"gates": "Derived `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at 7c093c01 (stderr: tree objectstack-ai/objectstack @ 7c093c01, 3 paths vs merge base 3bf9c5c41) = 72 commands, each run with exit captured before any pipe. 69 exit 0 on the first pass; `node scripts/check-plugin-teardown-shape.mjs --self-test` exit 3 (pinned fixture commit 621a4876 not in the shallow clone) -> fetched that commit at depth 1 -> rerun exit 0 (48 cases). `pnpm check:dual-build-cjs-loads` exit 3 PREREQUISITE NOT MET (reads every package's dist) and `pnpm check:i18n` exit 3 PREREQUISITE NOT MET (needs the CLI build closure; two lock attempts timed out at 9 min each behind a sibling's runtime suite) -> both NOT MEASURED locally, declared narrowing. `dispatch-gates --ran` -> '72 derived, 70 run, 2 NOT-MEASURED, 0 UNRUN', exit 0. CI check-runs on 7c093c01 at report time (not waited on): success = Check Changeset, Check PR Size, PR-body guards, Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Governed Surface Queue Guard, Flag docs affected by code changes, Dogfood Regression Gate, Test UI, Auto Label, filter; in_progress = Build Core, Plan Test Core shards (Test Core not yet listed), Lint · repo & tooling gates, Lint · CI, release & engine gates, Lint · docs & code guards, Lint · ESLint, Lint · scoped · query-options erasure, Lint · scoped · slot lookup & corpus, Type Check · workspace / source gates / consumer gates / debt ledger, Live E2E UI; the rest skipped by path. The two locally NOT MEASURED families ride the in_progress Lint jobs. check-platform-checklist not owed (no export renamed or removed).",
"dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
"mcp_calls": "0",
"api_writes": "2 — (1) relay pr_create: POST /repos/objectstack-ai/objectstack/dispatches (HTTP 204) -> fleet-write run 43974448338 success -> PR #34493 created draft, read-back 5927 bytes sent = stored, assignees none, labels none; (2) this report comment via scripts/pm/post-stamped.mjs on PR #34493 (POST /repos/objectstack-ai/objectstack/issues/34493/comments). Not REST: git push of the branch (4 pushes). Reads only otherwise (gh api GET of the ruling comment, PR #34172, recent PR bodies, check-runs).",
"deviations": [
"PR body carries two HTML comments (attribution first line, signed trailer last line) although os-dev bans HTML comments in GitHub text: the dispatch prescribed both, the relay header names the signed trailer as the PR-body signature form, and the stored body read back byte-identical. Named here, not chosen silently.",
"Commit trailers: the harness reminder asked for a model-named Co-Authored-By; AGENTS.md's model-free pair (Co-authored-by: Claude, Claude-Session) was used, as AGENTS.md outranks the reminder.",
"PR footer: AGENTS.md session-URL footer block used, not the harness's 'Generated with' form.",
"No assignee on the PR: the dispatch forbade assignees (os-dev rule 2 would carry a claim Account, and a no-card order has no claim).",
"Local narrowing: check:dual-build-cjs-loads and check:i18n NOT MEASURED (prerequisite refusals); CI's Lint & Repo Gates runs both.",
"Shared .git touched additively: commit 621a4876 fetched at depth 1 into the common object store for a gate self-test fixture.",
"New test file instead of a top-level describe in an existing one (ruling record 6583487846): the summary writer has no shared harness file; each audit suite carries its own, as #34172 also recorded."
],
"governing_text": "ruling 6574398310 letter B (verbatim above); FieldSchema.referenceNameVisible description in packages/spec; ADR-0104 D1 (an unexpanded read answers the bare id for every caller); maintainer ruling Option A+ on the audit write hot path (#6656, cited in audit-writers.ts).",
"open_questions": [
{
"question": "Should activity rows (the record label and both summary branches alike) honour a lookup's referenceNameVisible, naming a target the writer may not read by its display name the way $expand serves it?",
"options": [
"A — No, as this PR is written and as the record label already behaves since #34172: an activity row names a referenced record only by a title the writer may read in its own scope, else by its id; a declaring field whose target the writer is refused is named by its id. Business need (measured in this repo at 7c093c01, git grep): 0 fields declare the key in any metadata outside test fixtures (examples/ included), so 0 declaring fields are tracked or named in a milestone token; the ruling's named consumer (hotsrm portal pages) is outside this repo and unmeasured. Long-term: one read rule for every title an activity row writes, and no second copy of the engine's name rule. AI-error: fail-closed, no new key semantics for an author to misread. Startup focus: no new surface. Cost: an app that declares the key on a tracked lookup shows an id in the timeline where the record page shows the name. Effort: 0 (landed by this PR).",
"B — Yes, identically to $expand, for the label and both summary branches: for a declaring field, an id the writer is refused (object gate or row scope) is named by the target's display name when the writer's field-level answer serves the name field and that field is title-eligible, unmasked and not a formula through a reference; otherwise the id. Needs the engine's name-serving rule reachable from plugin-audit: exported as one engine API from @objectstack/objectql (outside this order's file surface) or copied into plugin-audit (a second de-facto contract that drifts). Adds up to one refused-id check plus one elevated name read per write per declaring target on the hot path Option A+ keeps lean. Business need: same zero measured pull as A. Effort: M, two packages, plus pins mirroring the rest data-reference-name-visible suite."
],
"recommendation": "A, because on the long-term axis it keeps one read rule for every title an activity row writes with no second copy of the engine's name rule, it is fail-closed on the error-proofing axis, and there is zero measured pull for B in this repo (startup-focus axis: no widening without pull). If a deployment shows the pull (a declaring field that is tracked or used in a milestone token), B should land once, as one exported engine read used by both activity paths, never as a copy in plugin-audit."
}
],
"out_of_scope_findings": [],
"security_findings": "withheld"
} |
|
security#1 · os-steve · session_01ADHkmRiaNzHVY81pCjZrpv 席位核对 · ACCEPT · Head-sha
|
Requested by Steve · project thread
Clause-②: no
Metadata-protocol: none
维护者速读
{token}),记录名称按写入者自己的读取范围取得;写入者读不到该记录或其名称字段时,摘要写记录 id。packages/plugins/plugin-audit/src/audit-writers.ts(两个摘要分支调用resolveLookupTitles的两处,以及该函数 "Whose read it is" 一节);packages/plugins/plugin-audit/src/activity-summary-title-writer-scope.test.ts。pnpm --filter @objectstack/plugin-audit exec vitest run src/activity-summary-title-writer-scope.test.ts,预期 1 个文件、11 个用例全部通过。What changes
Hardening rule: an activity summary names a referenced record by a title the writer may read, else by its id.
sys_activity.summarynames a referenced record in two branches: the tracked-change diff (Vault: A → B) and a fired milestone's{token}(Escalated to {vault}). Both take the title fromresolveLookupTitlesinaudit-writers.ts. Both now hand it the hook's ownapi, the writer's scope. The row's record label already reads there, so every title an activity row writes follows one rule.id: { $in }read per distinct target object, and only when a tracked reference moved or a fired milestone names one.The resolver's docblock now states the rule for every caller. Rows already written keep the summary they were written with.
Tests
New file
src/activity-summary-title-writer-scope.test.ts(11 cases) runs a bare engine with the realinstallAuditWriters. The restrictions are engine middleware on the target object: a refused read, a row left out by row scope, and a row served without its title column. For each branch it pins the three restricted writers, a writer who may read and a system write. The tracked branch also pins the per-id case. The cases assert the stored sentence and the stored summary code that the read side composes from.Red first: the new file against the base source
At
origin/mainbf76922925, before the fix:The 4 that pass are the controls (a writer who may read, and a system write, in each branch).
Ablations via scripts/ablation-replace.mjs, each restored to the HEAD blob with an empty git diff HEAD
Each logged
ok mutation landed: anchor 1 -> 0andok restored: blob == HEAD (b8e96db505a1) and git diff HEAD is empty.Package suite and typecheck at 7c093c0 (after merging origin/main)
Closure rebuilt after the merge (
turbo run build --filter=@objectstack/plugin-audit..., 16/16 tasks),@objectstack/spec check:generatedreports all 14 generated artifacts up to date. Underscripts/pm/os-verify-lock.sh:Acceptance notes
referenceNameVisible. A lookup that declares it follows the same rule in the summary as in the record label. Whether that key should widen what activity rows name is a question raised with the owning seat. This PR does not decide it.Verification
Local gate subset: the
scripts/pm/dispatch-gates.mjs --commandslist derived at7c093c01(72 commands). 70 answered exit 0, one of them after its pinned fixture commit was fetched into this shallow clone.check:dual-build-cjs-loadsrefused locally (PREREQUISITE NOT MET: it reads every package's build output), and so didcheck:i18n(it needs the CLI build closure). Both are NOT MEASURED here. CI runs both inLint & Repo Gates, and CI runs the full farm.Generated by Claude Code