Repository navigation
fix(lint): os validate and the publish gate refuse an affinity field that does not point at its caller fact's object - #39026
Conversation
… that does not point at its caller fact's object Claude-Session: https://claude.ai/code/session_01WGufzfW9cn6HikHhefGc4Q Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfW9cn6HikHhefGc4Q Co-authored-by: Claude <noreply@anthropic.com>
… pointer Claude-Session: https://claude.ai/code/session_01WGufzfW9cn6HikHhefGc4Q Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 14 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 6 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 20e2d7c870505d2966cadc306786bebaded70c03 && git checkout 20e2d7c870505d2966cadc306786bebaded70c03
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c748e7dfd647ca9b4e679d59425f358c9ff84b04 4a2868656e2ec5ff6e51812b82e0d3f20c761b5d && git checkout -B drift-repro c748e7dfd647ca9b4e679d59425f358c9ff84b04 && git merge --no-ff 4a2868656e2ec5ff6e51812b82e0d3f20c761b5d
node scripts/docs-audit/affected-docs.mjs --json c748e7dfd647ca9b4e679d59425f358c9ff84b04
|
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzfW9cn6HikHhefGc4Q 2026-12-02T03:54Z · |
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm L1 review · PR #39026 (#38503) · head 9161bc0 · 2026-12-02T04:23ZACCEPT on code at
Next: once #39025 merges, the card thread merges main and sends the green head; I post the delta and the zone lands. |
Claude-Session: https://claude.ai/code/session_01WGufzfW9cn6HikHhefGc4Q Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm L1 delta · PR #39026 (#38503) · head 4a28686 · 2026-12-02T05:26ZACCEPT, on head
Next: zone landing. The merge closes #38503. |
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS 席位核对ACCEPT — PR #39026 @
落地
State change: ready for review + auto-merge, by the owning seat; on merge it closes #38503. |
Requested by Yibo Wang · project thread
Fixes #38503
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
PR 2 of 2 for #38503. PR 1 (#38606, merged) added
source.affinityand the save door's refusal of an entry whosefielddoes not point at the object itscallernames (affinityTargetRefusalTextin@objectstack/service-knowledge). That door judges only a source written through the metadata API. This PR adds the same verdict where a source a package ships or code registers is judged:packages/lint/src/validate-knowledge-source.ts: new ruleknowledge-source-affinity-field-not-caller-target(error), invalidateKnowledgeSource, so it runs inos validate,os build,os lintand at the runtime publish gate. The target is read through the spec's one answer for a field's target (referenceTargetOf, so auserfield points atsys_user), compared withsys_userforcaller: 'user'andsys_business_unitforcaller: 'business_unit'. Same scope as the save door: only a field thatmetadataFieldslists (otherwise the parse refuses it) and the object declares (a missing field isknowledge-source-field-unknown, once; a system column the platform adds is not judged). The message and hint are the save door's sentence, split at its fix; lint cannot import a runtime service, so the predicate is composed here from the same spec function, asknowledge-source-document-by-not-parent-linkis.packages/lint/src/rule-explanations/knowledge-source.ts,rule-explanations.ts,index.ts: theos explainentry and the barrel export.content/docs/protocol/knowledge.mdx,content/docs/ai/knowledge-rag.mdx: the sentence "Saving a source also refuses afieldthat does not point at the object itscallernames" was only true of the save; it now names the save,os validateand the publish gate, and the rule id (ADR-0161 K2: docs move with the code)..changeset/38503-validate-affinity-target.md:@objectstack/lintpatch.Clause-②: no/Metadata-protocol: none, as the claim (7333581918) and thedocumentByprecedent changeset declare: the save door already refuses this entry, and the key itself is new in this release line, so no released accept set narrows. Nopackages/spec/srcchange, so no contract-review face.The card's measured three-arm comparison was taken on PR 1 (record in #38606's body: arm 2 82.6%, arm 3 86.7%, run-to-run 79.5–84.1 vs 86.4–87.5) and the maintainer ruled it needs no comparison (seat answer 7257868078 on #38503). This PR changes no ordering.
Tests
packages/lint/src/validate-knowledge-source.affinity.test.ts(18 tests): six refusals atos validate(user caller on a lookup to another object, on a text field, on a lookup to the units; a unit boost on a user field;neareston a lookup tosys_user;neareston a lookup with no target), each pinning rule, severity, path, where, the field, what it points at and the fix; controls for every admitted pairing and for a source withoutaffinity; per-index reporting; unlisted field left to the parse; unknown field reported once; system columns not judged; an unadmitted caller left to the parse; a fields array; the publish door refusing with the wordsos validateprints, and its control; the barrel export andos explain.target === expected || true) reds 9 of the 18; restored from the commit.pnpm --filter @objectstack/lint test: 260 files, 10,299 passed, 5 skipped, 1 failed (coversover 60 characters), fixed in 9161bc0; that file re-run: 9/9.pnpm --filter @objectstack/lint typecheck: 0.Acceptance notes
Verification
Read first:
validate-knowledge-source.ts(affinityTargetRefusaland the loop at the end ofvalidateKnowledgeSource), then the test'sREFUSEDtable.Two minutes:
pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-knowledge-source.affinity.test.tsanswers 18 passed.Local derived gates (dispatch-gates --commands)
At 9161bc0: 96 derived commands; 92 exit 0 (the two lint doc gates after building
@objectstack/lint, which they read compiled). NOT MEASURED, left to CI:check:dual-build-cjs-loads,check:lean-entry-closureand@objectstack/spec check:skill-examples(PREREQUISITE NOT MET: they read built output of packages outside the lint closure);check-plugin-teardown-shape.mjs --self-test(checker-health only; its fixture commit is unreachable from this shallow clone);check:query-options-erasureandcheck:type-check-debt(stopped at a 240 s local cap).Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzfW9cn6HikHhefGc4Q