feat(spec,objectql,rest): 发布 audit-provenance 与 import-coercion 词表 (#3786, #4173) - #4197
Merged
Merged
Conversation
…rcion vocabularies (#3786, #4173) Two more hand-copied lists retired the same way: one spec export, derivation at every consumer, and a conformance test where derivation alone cannot reach. AUDIT_PROVENANCE_FIELDS (spec/data): the four columns applySystemFields injects on audit-tracked objects. The list existed in at least four copies across two repos — the registry's injection if-chain, the rule-validator's preserveAudit allowlist ("Kept in sync with the registry" — by nothing), and two objectui render surfaces. The registry's injection is now table-driven, keyed by the tuple with `satisfies Record<AuditProvenanceField, …>` so an undeclared member is a compile error; the rule-validator derives its set from the same tuple; FIELD_GROUP_SYSTEM_FIELDS' audit prefix derives from it too. Injection is byte-identical — a conformance test pins every injected column's shape against the pre-refactor definitions. IMPORT_BOOLEAN_TRUE_TOKENS / IMPORT_BOOLEAN_FALSE_TOKENS / IMPORT_REFERENCE_TYPES (spec/data): the /import coercion vocabulary #4173 asked for. rest's import-coerce.ts derives BOOL_TRUE / BOOL_FALSE / REFERENCE_TYPES from them; IMPORT_REFERENCE_TYPES ships with the legacy 'reference' spelling included, retiring the `+ 'reference'` literal both ends carried separately. objectui's mirror retires once this publishes — the path is written in that file's own header (objectui#3043). Verified: spec 7142 tests green, six gates PASS; the objectql suites this diff touches (registry, rule-validator: 159 tests, incl. the new conformance case) pass; the objectql/rest failures visible locally reproduce identically on a clean tree (24 = 24, 1 = 1 — stale sibling dist, not this change). Closes #4173. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UXGj3Z5TmwSV6RK2oGc3cb
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 110 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#3786 系列的两笔收尾,同一形状打包:spec 导出一份、消费方全部派生、派生够不到的地方加一致性测试。前置:#4178 已合并。
A.
AUDIT_PROVENANCE_FIELDS—— 跨两仓至少四份拷贝的 4 元清单created_at/created_by/updated_at/updated_by这份清单存在于:registry 的注入 if 链(源头)、rule-validator 的preserveAudit白名单(注释写「Kept in sync with the registry's auto-injected audit fields」—— 靠什么?什么都没有)、以及 objectui 两处渲染面。现在:
registry.ts注入satisfies Record<AuditProvenanceField, …>—— spec 加名字没配定义、或定义了 spec 删掉的名字,都是编译错误(APPROVER_VALUE_BINDINGS的老纪律)rule-validator.tsAUDIT_TIMELINE_FIELDS = new Set(AUDIT_PROVENANCE_FIELDS)—— 派生FIELD_GROUP_SYSTEM_FIELDSAUDIT_FIELD_BY_ROLE注入行为逐字节不变 —— 新增一致性测试把每个注入列的形状(type/label/reference/readonly/system/required/description)钉在重构前的定义上。这是「派生管不到的那半」:spec 元组决定哪些列存在,注入表决定每列长什么样,后者仍是 registry 的本地事实,所以用测试钉。
B. import-coercion 词表 —— Closes #4173
IMPORT_BOOLEAN_TRUE_TOKENS/IMPORT_BOOLEAN_FALSE_TOKENS/IMPORT_REFERENCE_TYPES从@objectstack/spec/data导出(与REFERENCE_VALUE_TYPES同处,#4173 建议的位置)。rest/import-coerce.ts的BOOL_TRUE/BOOL_FALSE/REFERENCE_TYPES全部改为派生;IMPORT_REFERENCE_TYPES按 issue 的「顺带」把 legacy'reference'拼写纳入,两端各自+ 'reference'的字面量残留一并退役。词表自身的纪律有测试:两集不相交、每个 token 已预归一化(lowercase + trimmed,否则永远匹配不上、却读起来像被接受的拼写)、中文与勾叉 token(是/对/✓/√、否/错/✗/×)逐名钉住 —— 丢一个就是两端同时的静默行为变化。
objectui 侧的退役路径对方已写在
importCoercionContract.ts的头注释里(objectui#3043),等本版本发布即可执行。验证
系列状态
至此 #3786 排查出的全部已知手抄清单要么已派生、要么已加闸门:framework 4 个 PR(#4120 / #4148 / #4170 / #4178)+ 本 PR,objectui 2 个(#3019 / #3043,后者为并行 agent 完成),cloud 1 个(#931)。仍开放的是两项产品决策(cloud#933 / cloud#934)与
.strict()收紧的排期 —— 后者现在有 #4178 的证据基座。Generated by Claude Code