Skip to content

fix(lint): field-no-consumers credits a related list's columns to the child object it lists - #37596

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/area-o1A-37502
Nov 26, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/area-o1A-37502

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #37502

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:搭建者运行校验或检查命令时,父对象上一个没有任何地方显示的字段,如果恰好和子对象关联列表里的某列同名,现在会被正确提示;子对象被关联列表显示的字段不再被误报。
  • 为什么做:属于“字段无人使用”检查规则的后续修补,替使用空白模板起步的搭建者解决漏报问题。
  • 出错会怎样:最坏情况是多出或少出一条警告,规则仍只是警告、不拦截任何保存或发布,可直接撤回。
  • 要你做什么:无

What changes

  • field-no-consumers (@objectstack/lint, run by os validate and os lint) now reads an object-form relatedLists entry against the CHILD object its list names (child, or the head of child.field), never against the object that declares the list. The entry's columns are the child's field names (RelatedListEntryObjectSchema), so each column is a display site of the child's field.
  • Before: a column was credited to the declaring parent's field of the same name. On the blank starter, the company's related list of contacts has a phone column, which kept an undisplayed company.phone silent, and the contact's own phone got no credit from the column.
  • A list naming a child this stack does not declare credits no object (the columns count as unresolved, like any other field-shaped token that lands nowhere).
  • Side effect, same mechanism: the child.field spelling in list now credits that relationship field on the child as a read (the list joins on it); before, the token was tried against the parent.
  • The test helper withoutPlacement in packages/cli/test/starter-field-consumers.test.ts is narrowed back: it strips the control field only from related lists of the control's OWN object, so the blank-template control blank_company.phone now exercises the fixed rule instead of the helper hiding the defect.
  • The rule stays warning. ADR check: the dispatch named ADR-0139 D4; that decision governs the plugin-audit read gates (parent-record leaves, no pre-scan) and does not touch this rule, so there is no conflict. No ADR governs field-consumer crediting beyond the module header, which is updated.

Files to read first

  1. packages/lint/src/validate-field-consumers.ts — isRelatedListEntry / relatedListChildOf and the one changed line in walk (the risk hunk: which records switch context).
  2. packages/lint/src/validate-field-consumers.test.ts — the new [#37502] describe (both directions pinned).
  3. packages/cli/test/starter-field-consumers.test.ts — withoutPlacement, narrowed.

Tests

Head bc95079f7, worktree of objectstack-ai/objectstack.

lint: new pins, full suite, typecheck
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-field-consumers.test.ts: Tests 201 passed (201).
  • pnpm --filter @objectstack/lint test: Test Files 236 passed (236), Tests 9687 passed (9687).
  • pnpm --filter @objectstack/lint typecheck: exit 0 (test layer: test-typecheck OK, debt unchanged).
  • Ablation (fix committed first, scripts/ablation-replace.mjs, anchor hit 1 to 0, restored to the HEAD blob, git diff HEAD empty): with the walk reading the entry against the parent again, 4 of the 7 new cases go red (parent phone still reported; child column counts; child.field; undeclared child), 197 others pass.
cli: the blank-template control, red before and green after
  • With the narrowed helper against the unfixed lint dist (built from origin/main c385d3b): Tests 1 failed, 24 passed (25). The failure: npm create objectstack: blank_company.phone without its group is reported by both commands, os validate: expected [] to deeply equal [ 'objects[0].fields.phone' ]. This is the premise, measured on current main.
  • After pnpm --filter @objectstack/lint build (dist carries the fix): Tests 25 passed (25).
  • pnpm --filter @objectstack/cli typecheck: exit 0.
Sweep: shipped apps and the blank template, old rule vs new rule

Every finding of validateFieldConsumers over each loaded stack, with the lint dist built from the fix and from an ablated copy (old reading):

  • examples/app-crm: 0 and 0. examples/app-starter: 0 and 0. Blank template: 0 and 0. examples/app-todo: the same 5 pre-existing todo_task findings both ways.
  • examples/app-showcase and examples/app-multi-package did not load in this container (unbuilt dependencies). Neither declares an object-form relatedLists entry, and the change only alters the subtree of such an entry, so neither can move.
  • No new warning in any shipped app or template, so nothing that passed os lint --strict before refuses now.

Acceptance notes

  • A related list entry with no columns draws the child FK's relatedListColumns or the child's derived columns; the rule credits neither of those derived columns (unchanged behaviour, under-crediting direction, outside this card).

Verification

Two minutes: pnpm --filter @objectstack/lint exec vitest run src/validate-field-consumers.test.ts -t 37502 — expect 7 passed, including "a column credits the CHILD's field: the parent's same-name phone is still reported".


Generated by Claude Code

field-no-consumers read an object-form relatedLists entry against the
declaring parent, so a column credited the parent's same-name field and
left the child's own column uncredited. The entry is now read against the
child its list names (child or child.field).

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cyyekQEqLjtrCLLAeV
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/lint, touching 4 documentable anchor(s).

4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/metadata-api.mdx (via relatedLists (literal, a string literal in RELATED_LISTS_KEY))
  • content/docs/data-modeling/object-extensions.mdx (via relatedLists (literal, a string literal in RELATED_LISTS_KEY))
  • content/docs/protocol/kernel/i18n-standard.mdx (via relatedLists (literal, a string literal in RELATED_LISTS_KEY))
  • content/docs/ui/pages.mdx (via relatedLists (literal, a string literal in RELATED_LISTS_KEY))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v18/18-3.mdx (via relatedLists (literal, a string literal in RELATED_LISTS_KEY))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 7968e54be3d3e4f8f096523033151002daf549b2 — the merge of head bc95079f79dd0b57d4782aab1cc53fc8dbbda6b6 into base 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 7968e54be3d3e4f8f096523033151002daf549b2 && git checkout 7968e54be3d3e4f8f096523033151002daf549b2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6 bc95079f79dd0b57d4782aab1cc53fc8dbbda6b6 && git checkout -B drift-repro 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6 && git merge --no-ff bc95079f79dd0b57d4782aab1cc53fc8dbbda6b6

node scripts/docs-audit/affected-docs.mjs --json 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cyyekQEqLjtrCLLAeV

Final head for review: bc95079f79dd0b57d4782aab1cc53fc8dbbda6b6 · 2026-11-26T15:01Z · area o1-A. Check-runs on this head: 57 success, 11 skipped, 0 failed; mergeable_state clean. L1 requested from seat 1's L1 thread.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3

L1 verdict (L1-a): ACCEPT at head bc95079f79dd0b57d4782aab1cc53fc8dbbda6b6 (Fixes #37502). Full read · 2026-11-26T15:03Z

席位核对

Shape and gates. l1-face --pr 37596: 12 of 13 items ok, one flag (below). Check-runs at bc95079: 57 success, 11 expected skip, 0 unexpected skip, 0 failed, 0 pending; Lint & Repo Gates and TypeScript Type Check both success; mergeable_state clean. Draft, base main, first line Fixes #37502, no closing keyword next to another card. 4 files, +151/-13. Not governed. Clause-②: no · Metadata-protocol: none in the body and the changeset.

The one flag is not a gap. l1-face reports @objectstack/cli touched with no changeset. The only cli file is packages/cli/test/starter-field-consumers.test.ts, and cli's files is dist, README.md, CHANGELOG.md, so nothing cli ships moves. The @objectstack/lint patch is the changeset that is owed.

Fixes is right. The card's three Done-when items are all in the diff: (1) an object-form relatedLists entry is read against the child its list names, so a parent field with the same name and no other consumer is reported; (2) the new [#37502] describe pins both directions (the parent's phone is still reported, and the child's own column counts); (3) withoutPlacement is narrowed back to related lists of the control's own object, and the blank-template control blank_company.phone now goes red on the unfixed lint dist (report: 1 failed / 24 passed) and green after (25/25).

The change, read against main.

  • walk switches context only for a record at objects root, top-level relatedLists key, where relatedListEntryName answers. That is the spec's own reader (packages/spec/src/data/related-list-entry.ts:82), not a re-spelling. RELATED_LISTS_KEY is typed satisfies keyof ServiceObject, so a spec rename fails typecheck instead of turning the crediting off silently.
  • Crediting columns to the child matches the published describe: "This list's columns, as field names of the child object" (packages/spec/src/data/object.zod.ts:1373).
  • An undeclared child (another package's or a platform object) answers undefined, so its columns land on no object and never on the parent. That is pinned.
  • The child.field side effect is the same mechanism: the list token is now resolved against the child, where that relationship field is declared. It is pinned, and it under-reports nothing.

Test evidence. Real commands with counts: lint file 201/201, lint suite 9687/9687, typecheck exit 0. Positive control: ablation of the walk switch turns 4 of the 7 new cases red. The cli control was measured red before and green after on origin/main c385d3b.

Dev deviations, judged.

  • ADR-0139 D4: the dev is right. D4 is "The six consumers emit one leaf per parent object, and no pre-scan" (engine semi-join / plugin-audit read gate, docs/adr/0139-…md:251). It says nothing about lint crediting, so there is no conflict and no fork.
  • Severity stays warning. The rule now reports one more true miss and stops one false report. os validate --strict turns warnings into exit 1, so a stack that has exactly this miss would newly fail --strict. That is an opt-in lint finding, not a refusal by the published schema or the metadata door, so no (narrowing) arm is owed. The sweep shows no new warning in app-crm, app-starter, the blank template or app-todo. app-showcase and app-multi-package declare no object-form relatedLists entry in their sources (only a showcase test names the word), so neither can move.
  • The new pins sit in the existing test file (AGENTS.md shared-harness rule): accepted.

Changeset, sentence by sentence. An object-form entry is read against the child (true, walk). Before, a column credited the parent's same-name field, and the blank starter's company.phone stayed quiet (true, the cli control). os validate / os lint can newly report such a parent field, and a child field that only a related list draws is no longer reported (true, both pinned). A column of an undeclared child credits no object (true, pinned). The rule stays a warning (true, no severity line moves). child.field counts as a read of that relationship field on the child (true, pinned).

Contract review. None owed. No packages/spec/src/** file, no governed path, no Clause-②: yes, no narrowing declared. CI plus this read cover it (contract-review.md: four faces untouched).

Out of scope (dev note). An entry with no columns draws the child FK's relatedListColumns or the derived columns, and the rule does not credit those. This under-credits, which is the quiet direction, and is unchanged here. Not filed: it is noted in the PR's Acceptance notes, and no observed false report pulls for it.

Landing: not governed, ≤3000 lines, no narrowing. The area lands it (landing-operations). Fixes closes the card, so no manual pm:dispatched strip is owed.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cyyekQEqLjtrCLLAeV

Landing by area o1-A · 2026-11-26T15:04Z · head bc95079f79dd0b57d4782aab1cc53fc8dbbda6b6 · ACCEPT 7195734271 (L1-a); no contract face touched (no packages/spec/src/**, no governed path)

probe reading
check-governed-merges.mjs --pr 37596 NOT governed; 164 changed lines ≤ 3000
landing-k.mjs --pr 37596 K = 0 < 15; no locale pack, no shared book; os-regen paths untouched

State: ready + auto-merge now; #37502 closes on merge via Fixes, pm:dispatched cleared then.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 15:05
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 54d6726 Nov 26, 2026
69 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-o1A-37502 branch November 26, 2026 15:33
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/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants