Repository navigation
feat(lint)!: judge a lookupFilters { $record } path against the record being edited and its one hop - #34249
Conversation
…d being edited and its one hop object-field-ref-unknown gains the lookupFilters[].value.$record member of its owner-addressed field-level sweep: on a picker field, the path's head is a field of the object that owns the field, a second segment a field of the object that relationship references, and a second hop is refused at the segment past the bound. A hop to an object outside the stack stays unjudged. Claude-Session: https://claude.ai/code/session_01ADHkmS3jo9CFJZXCvjc2n4 Co-authored-by: Claude <noreply@anthropic.com>
…aviour Claude-Session: https://claude.ai/code/session_01ADHkmS3jo9CFJZXCvjc2n4 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 173 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 37793cd5f8b05c68fcee0c3dfedbe3ef65ef3338 && git checkout 37793cd5f8b05c68fcee0c3dfedbe3ef65ef3338
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 43dd5656e47001bf26ba5b441683ae836aebf816 99ff6598430c8b3e00cc6691e22ce09d3527de04 && git checkout -B drift-repro 43dd5656e47001bf26ba5b441683ae836aebf816 && git merge --no-ff 99ff6598430c8b3e00cc6691e22ce09d3527de04
node scripts/docs-audit/affected-docs.mjs --json 43dd5656e47001bf26ba5b441683ae836aebf816
|
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (maintainer-limited fable quota, 2026-11-16T02:19Z) · head d180955 First review, for card #34200 (delta The seat has read the dev's deviations:
Main is not merged (K small; #34132 has no overlap). The seat merges at landing if K ≥ 15. |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head d180955 · 2026-11-16T02:20Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-16T02:50Z. First review of this head; claim: comment 6905524732; lane request 6905509101 on mailbox #33873. Independence: implemented in an os-steve project thread, dispatched by domain:spec#2 (os-steve); reviewed by os-tesla, who neither dispatched nor implemented it. No prior record for this PR; findings are numbered fresh and continue no earlier id. Read, not reviewed (outside the diff, at this head): ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
S1 (should-fix) — The pins cover each refused shape and three accepted ones (single field, injected single column, one hop through a N1 (nit) — The hint and the two-hop message say "one lookup field" and "one lookup hop" while the slot traverses N2 (nit) — N3 (nit) — The changeset could name the publish receipt as a place the finding now appears (reported there, never refused), beside the four doors it lists. No must-fix. Implemented-by: VERDICT: PASS |
…mns as accepted; say relationship hop Claude-Session: https://claude.ai/code/session_01ADHkmS3jo9CFJZXCvjc2n4 Co-authored-by: Claude <noreply@anthropic.com>
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (maintainer-limited fable quota, 2026-11-16T03:40Z) · head c83d119 This is a delta on r1 PASS 6905932695 (head d180955). One commit; main is not merged (merge base dfb8ed3).
Card-thread readings at this head: field-refs 119/119; lint 9054 tests pass; dispatch-gates 92/92 exit 0, 0 NOT-MEASURED; dogfood VERDICT exit 0. |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head c83d119 · 2026-11-16T03:42Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-16T03:46Z. Delta review of this head against PASS 6905932695 at d180955; claim: comment 6906660590; lane request 6906637305 on mailbox #33873. Independence: implemented in an os-steve project thread, dispatched by domain:spec#2 (os-steve); reviewed by os-tesla, who neither dispatched nor implemented it. One commit since Prior findings, by id:
① Derived judgments
② Semver level
CI completed before posting: 71 check-runs on this head, 58 success, 13 skipped, none failed. ③ Boundary flags
④ Design judgment
No must-fix, no should-fix. N1 (nit) — continues prior N2, unchanged: N2 (nit) — continues prior N3: the changeset's N3 (nit) — new, optional: the Implemented-by: VERDICT: PASS |
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (maintainer-limited fable quota, 2026-11-16T04:40Z) · head 99ff659 Merge-of-main review. origin/main
|
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 99ff659 · 2026-11-16T04:42Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-16T04:45Z. Delta review of this head against PASS 6906706417 at c83d119; claim: comment 6907535227; lane request 6907522282 on mailbox #33873. Independence: implemented in an os-steve project thread, dispatched by domain:spec#2 (os-steve); reviewed by os-tesla, who neither dispatched nor implemented it. One commit since
Read, not reviewed (outside the diff, at this head): Prior findings, by id:
① Derived judgments
② Semver level
CI completed before posting: 71 check-runs on this head, 58 success, 13 skipped, none failed. ③ Boundary flags
④ Design judgment
No must-fix, no should-fix. N1 (nit) — continues prior N1, unchanged: N2 (nit) — continues prior N3, optional: the Implemented-by: VERDICT: PASS |
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC ACCEPT · PR #34249 (#34200) · head
|
Requested by Steve · project thread
Fixes #34200
Clause-②: no (narrowing) — a
lookupFilters[].value{ $record }path on a lookup, master_detail or user field that names no field of the object owning that field, hops through a field that is not a relationship, names a leaf the referenced object lacks, or takes a second hop, parsed clean and published; it is now refused at error asobject-field-ref-unknownbyos lint,os validate,os buildand the runtime publish door, and reported (never refused) on the package publish receipt's object probe.Metadata-protocol: narrowed
Skills-docs: follow-up #34201 — no doc or skill teaches
{ $record }yet (its picker reader has not landed; both describes carry[PLANNED — not enforced]), so there is no teaching to correct here.维护者速读
lookupFilters里写{ $record: "路径" }(读取正在编辑的记录)时,lint 现在会核对路径:第一段必须是本对象的字段;有第二段时第一段必须是关系字段(lookup / master_detail / user / tree)、第二段必须是它指向对象的字段;超过一跳直接拒。acount.cb_market这类拼错的路径能顺利发布,要等选择器运行时才会悄悄失效。object-field-ref-unknown的新成员);一方 examples / 平台对象 / skills / 文档样例里实测 0 处$record,无存量受影响。回滚即 revert 本 PR。packages/lint/src/validate-object-field-refs.ts(新的lookupFilters$record槽位与一跳上限那段循环)、packages/lint/src/validate-object-field-refs.test.ts(拒收/放行成对用例)、packages/spec/src/migrations/entries/semantic/18.lookup-filter-record-path-unknown-refused.ts。pnpm --filter @objectstack/lint exec vitest run src/validate-object-field-refs.test.ts,预期 119 条全绿,其中$record一组 16 条。What changes
object-field-ref-unknowngains one member of its owner-addressed field-level sweep:fields.NAME.lookupFilters[N].value.$record. It is a new row ofFIELD_NAME_SLOTS(address: 'owner', path-resolved), with three new slot properties:pickerOnly— judged only onlookup/master_detail/user, the types whose picker is the only reader (matching how the module treats keys with no reader).maxHops: 1— a path with two hops is refused at the segment past the bound (takes a second hop at "parent"), before resolution. On the parsed path the schema regex already refuses two dots; this covers the rawos lintpath.ownFinding— a$recordmiss is never folded into the same entry's.fieldmiss: they name fields of two different objects, so both are reported. (The fold exists for thedependsOnpair, where one fix answers both.)resolveFieldPathagainst the OWNING object: unknown head →hop-unknown; hop through a non-relationship →hop-not-relationship; leaf the referenced object lacks →field-unknown; a hop whose referenced object is not in the stack, or an injected-column hop (owner_id.x), stays unjudged — the same cross-package policy as every other position in this sweep. Registry-injected columns are valid single names (created_at).valueis read. A{ $record }list member is already refused by the parse (refuseMalformedLookupFilterEntry, "never a member of a list"), so it is not judged a second time.{ $record }nested deeper inside a literal (value: { market: { $record: 'x' } }) is left unnamed by lint — pinned. Reasons: no reader resolves that shape, nothing first-party writes it (measured below), the rule is error-only so naming it would need a new advisory tier, and refusing an unresolved$recordthat reaches a filter is the server door's job.rule-explanations.ts: one new paragraph for the position (os explain object-field-ref-unknown).lookup-filter-record-path-unknown-refused, with the measured first-party exposure.First-party exposure (measured at
dfb8ed35, before the change)git grep -nE "[{,]\s*['\"]?\\$record['\"]?\s*:"across the whole repo, outsidefield.zod.tsand the generated references: the onlylookupFilters$recordobjects are the #34009 fixtures inpackages/spec/src/data/field.test.tsand the #34009 changeset. Zero hits inexamples/**,packages/**/srcplatform objects,packages/apps/**,skills/**,content/docs/**samples andui/**. Verdict under the new check: nothing to judge; no shipped app's picker changes.Tests
packages/lint/src/validate-object-field-refs.test.ts, new blocklookupFilters[].value.$record(16 cases), refused and accepted side by side:acount.cb_markettraverses "acount" … Did you mean "account"?account.cb_marktcrm_account,Did you mean "cb_market"?textfieldhop-not-relationshipaccount.parent.cb_market(every segment exists)"parent"valid_from)$recordreads the edited recordcreated_at)account.cb_markettreefield (parent_quote.quote_date)userfield (approver_user.department)owner_id.anything)$recordmiss +.fieldmiss on one entryFieldSchema.safeParse)userfield pickerThe two-hop message reads "at most one relationship hop". The two coverage-control lists (one-line verdict / one-line fix ≤ 200 chars) gain
.value.$record; theos explainfact list gains the new paragraph's facts. No existing test edited otherwise.Ablation (three runs through scripts/ablation-replace.mjs, each restored blob == HEAD)
read: readRecordReference,→read: () => undefined,):Tests 9 failed | 107 passed (116)— the 7 refusal cases and both coverage controls; every accepted case stayed green. Restored: blobd0591651212e== HEAD,git diff HEADempty.maxHops: 1,deleted):Tests 1 failed | 115 passed (116)— the two-hop case. Restored: blob == HEAD.userandtreedropped fromRELATIONSHIP_FIELD_TYPESinobject-graph.ts, where the set lives), atc83d1195:Tests 3 failed | 116 passed (119)— thetreepin, theuserpin, and the one-line-verdict bound (the ablatedtreeverdict is 207 characters, a side effect of the mutation). Restored: blob7216c756== HEAD,git diff HEADempty. The first attempt at this leg did not change the file, and the tool stopped it before the tests ran; the reading is from the second attempt, made with a distinct marker.The test imports
./validate-object-field-refs.jsrelatively (source, notdist), so no rebuild leg applies.Acceptance notes
lookup/master_detailheads; the implementation reuses the family'sresolveFieldPath, whose traversable set islookup,master_detail,user,tree(RELATIONSHIP_FIELD_TYPES). Auserfield is a lookup tosys_userandtreea self-lookup, each one stored foreign key. Accepted at review (record 6905932695) and pinned by theuser/tree/ injected-hop cases above.multiple: truelookup (or a multi-value leaf) has no single value, which the{ $record }declaration requires. Not judged here: it is a reader question for the picker card (ui: the lookup picker resolves { $record } from the form record, sends orEmpty, and re-queries on the referenced fields #34197), observation only.Verification
All local readings are at head
99ff6598. That is the merge oforigin/main43dd5656throughscripts/pm/os-regen-merge.sh, with no conflicts; step 2 took main's side of the generated artifacts.pnpm --filter @objectstack/spec check:generatedreports all 14 generated artifacts up to date, so nothing was regenerated.git diff origin/main...HEADmatchesgit diff dfb8ed35 c83d11952line for line apart from theindexlines: same 5 files,+321 / -8, the same hunk headers. Four blobs are identical.rule-explanations.tshas a new blob because main's fix(lint): the object_extension publish door refuses an extension field under a label its target already shows, or another field of the same extension shows (field-label-duplicate) #34132 edited the same file; its hunk is unchanged, and the fix(lint): the object_extension publish door refuses an extension field under a label its target already shows, or another field of the same extension shows (field-label-duplicate) #34132 entry (field-label-duplicate) is present at HEAD.@objectstack/linttypecheck+testunder the lock, after a full./packages/**rebuild:Test Files 212 passed (212),Tests 9065 passed (9065).!, Clause-② carries the(narrowing)arm):pnpm --filter @objectstack/dogfood testunder the lock, in the same hold, VERDICT command-exit 0.Test Files 470 passed | 3 skipped (473),Tests 3985 passed | 42 skipped (4027).Derived gate round at 99ff659: dispatch-gates --commands gives 92 families; --ran gives 92 run, 0 NOT-MEASURED, 0 UNRUN
All 92 exited 0 on their first run at this head.
Review: contract review PASS at
d180955e(record 6905932695). The delta review PASSed atc83d1195(record 6906706417). This head adds only the main merge to that reviewed diff.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmS3jo9CFJZXCvjc2n4