Repository navigation
fix(lint): field-no-consumers credits a related list's columns to the child object it lists - #37596
Conversation
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
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cyyekQEqLjtrCLLAeV
📓 Docs Drift CheckThis PR changes 1 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 4 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 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
|
|
repo:objectstack#1 · os-elon-musk · session_016WV4cyyekQEqLjtrCLLAeV Final head for review: |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT at head 席位核对Shape and gates. The one flag is not a gap. l1-face reports Fixes is right. The card's three Done-when items are all in the diff: (1) an object-form The change, read against main.
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.
Changeset, sentence by sentence. An object-form entry is read against the child (true, Contract review. None owed. No Out of scope (dev note). An entry with no Landing: not governed, ≤3000 lines, no narrowing. The area lands it (landing-operations). Generated by Claude Code |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cyyekQEqLjtrCLLAeV Landing by area o1-A · 2026-11-26T15:04Z · head
State: ready + auto-merge now; #37502 closes on merge via |
Fixes #37502
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
field-no-consumers(@objectstack/lint, run byos validateandos lint) now reads an object-formrelatedListsentry against the CHILD object itslistnames (child, or the head ofchild.field), never against the object that declares the list. The entry'scolumnsare the child's field names (RelatedListEntryObjectSchema), so each column is a display site of the child's field.phonecolumn, which kept an undisplayedcompany.phonesilent, and the contact's ownphonegot no credit from the column.child.fieldspelling inlistnow credits that relationship field on the child as a read (the list joins on it); before, the token was tried against the parent.withoutPlacementinpackages/cli/test/starter-field-consumers.test.tsis narrowed back: it strips the control field only from related lists of the control's OWN object, so the blank-template controlblank_company.phonenow exercises the fixed rule instead of the helper hiding the defect.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
packages/lint/src/validate-field-consumers.ts—isRelatedListEntry/relatedListChildOfand the one changed line inwalk(the risk hunk: which records switch context).packages/lint/src/validate-field-consumers.test.ts— the new[#37502]describe (both directions pinned).packages/cli/test/starter-field-consumers.test.ts—withoutPlacement, narrowed.Tests
Head
bc95079f7, worktree ofobjectstack-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).scripts/ablation-replace.mjs, anchor hit 1 to 0, restored to the HEAD blob,git diff HEADempty): with the walk reading the entry against the parent again, 4 of the 7 new cases go red (parentphonestill reported; child column counts;child.field; undeclared child), 197 others pass.cli: the blank-template control, red before and green after
dist(built fromorigin/mainc385d3b): 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.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
validateFieldConsumersover 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-existingtodo_taskfindings both ways.examples/app-showcaseandexamples/app-multi-packagedid not load in this container (unbuilt dependencies). Neither declares an object-formrelatedListsentry, and the change only alters the subtree of such an entry, so neither can move.os lint --strictbefore refuses now.Acceptance notes
columnsdraws the child FK'srelatedListColumnsor 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