Repository navigation
feat(lint): warn when a text field named like a currency, country or time zone code declares no valueDomain - #35378
Conversation
Adds field/missing-value-domain to the os lint data-model sweep and the VALUE_DOMAIN_FIELD_NAMES word list beside the value-domain vocabulary. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgTAndxyZHfrVSU6UzD
…IN_FIELD_NAMES Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgTAndxyZHfrVSU6UzD
📓 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:
What this run could not see
Coarse fallback — 174 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 715e640e1160500cfacfb9646413275dd772c595 && git checkout 715e640e1160500cfacfb9646413275dd772c595
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 609b675135f1ea427aff463c551619a83368bcad add09fc6dadbad1b7ce0eeecdacb642d3ea2af66 && git checkout -B drift-repro 609b675135f1ea427aff463c551619a83368bcad && git merge --no-ff add09fc6dadbad1b7ce0eeecdacb642d3ea2af66
node scripts/docs-audit/affected-docs.mjs --json 609b675135f1ea427aff463c551619a83368bcad
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTAndxyZHfrVSU6UzD Final green head for L1:
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 维护者速读
席位核对 — REWORK (L1-a) · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTAndxyZHfrVSU6UzD The filled brief this card thread handed its isolated contract-review sub-agent, posted beside the record per Contract review brief — PR #35378 @
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTAndxyZHfrVSU6UzD Contract review record rendered by the isolated sub-agent at Contract reviewServed-tier: Read: card #35346 (body and comments 7001309642, 7001362779, 7002352530), PR #35378 (body, 10-file list, net diff from merge-base ① Derived judgments
② Semver level
③ Boundary flagsDev flags, from report 7002352530 (
SQL push-down: the diff holds no query, no id materialisation and no in-app join. Nothing to find. Author: the PR's ④ Design judgment
Tried, and held: a non-string field name; a prototype-named field; version skew between lint and spec ( No must-fix. S1 (should-fix) — under
S2 (should-fix) — the docblock of
Nits. None changes the round.
The two findings above were derived from the tree. The seat's L1 note on the PR thread (7005985759) was posted while this review ran and is outside the brief's input set. It was seen while checking the thread for a record on this head, and it names the same docblock sentence as S2. Implemented-by: VERDICT: PASS |
The word-list docblock names only the reader that exists today; the explain entry, changeset, rule comment and fix line say a strict os lint run fails until the domain is declared; the message wording reads right for all three domains. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgTAndxyZHfrVSU6UzD
|
repo:objectstack#1 · os-sales · session_01L6bhgTAndxyZHfrVSU6UzD Final green head after fix round 1:
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 维护者速读
席位核对 — ACCEPT (L1-a, delta) · repo:objectstack#1 · head
|
…-9k6izv Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgTAndxyZHfrVSU6UzD
|
repo:objectstack#1 · os-sales · session_01L6bhgTAndxyZHfrVSU6UzD Delta contract review record, rendered by the same isolated sub-agent at Contract reviewServed-tier: Read: the one fix-round commit between the two heads (6 files, 21 lines added, 16 removed), card #35346 with its new comment 7006499899 (the fix-round report), PR comment 7007025570 (the head announcement), the PR body as it now stands, and the 73 check-runs on the head (60 success, 13 skipped, none red or pending). The two test files in the commit are the lane seat's ACCEPT at ① Derived judgments
② Semver level
③ Boundary flagsDelta from record 7006306625, which reviewed head 713c5aa. This record covers the one commit pushed since.
SQL push-down: the commit holds no query, no id materialisation and no in-app join. Nothing to find. Author: the PR's ④ Design judgment
Tried, and held: a text that still promises a correct field keeps its name (none left in the docblock, the rule comment, the explain entry, the fix line or the changeset); a text that tells an author to declare a domain on a field that holds something else (none: the fix keeps its condition, and paragraph 1 says what the write path then refuses); a moved export shape or stale generated file (none); a tracker number in a string an author is shown (none). No must-fix, no should-fix.
Nits. None changes the round.
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob L2 adoption · 2026-11-19T11:00Z · the seat checked the card thread's isolated |
|
repo:objectstack#1 · os-sales · session_01L6bhgTAndxyZHfrVSU6UzD Regen-provenance: 7007166996 · The pre-queue merge-forward ( |
|
repo:objectstack#1 · os-sales · session_01L6bhgTAndxyZHfrVSU6UzD Landing · 2026-11-19T11:31Z · head
State change: ready for review, then auto-merge into the merge queue. #35346 closes on merge via |
Requested by Sales · project thread
Fixes #35346
repo:objectstack#1 · os-sales · session_01L6bhgTAndxyZHfrVSU6UzD (card thread; claim 7001362779). Branch: platform-assigned claude/project-thread-9k6izv.
Clause-②: yes
Metadata-protocol: none
维护者速读
os lint新增一条警告field/missing-value-domain:text字段名是currency、currency_code、country、country_code、time_zone、timezone或tz(整名、不分大小写),又没写valueDomain时,提示应加哪个值域。词表放在 spec 的值域词汇旁边,只有一份。os lint的警告,不改os validate、os build、保存门的结果,也不新增任何可写的元数据键。回滚即撤销本 PR。packages/lint/src/data-model-rules.ts(R15 判定段:只看text且无valueDomain)、packages/spec/src/shared/value-domain.zod.ts(新词表VALUE_DOMAIN_FIELD_NAMES)、packages/lint/src/rule-explanations.ts(os explain文案)。pnpm --filter @objectstack/lint exec vitest run src/data-model-rules.value-domain-name-hint.test.ts,预期 15 个用例全部通过。What changes
VALUE_DOMAIN_FIELD_NAMESinpackages/spec/src/shared/value-domain.zod.ts, besideValueDomainSchema: a frozenRecordoverValueDomain(iso_4217_currency:currency,currency_code;iso_3166_alpha2:country,country_code;iana_time_zone:time_zone,timezone,tz). It adds no member to the vocabulary (the "does not widen" ruling in that file's header). Exported from@objectstack/spec/shared;api-surface/shared.jsonandexport-origins/shared.jsonregenerated.field/missing-value-domain(constantFIELD_MISSING_VALUE_DOMAIN, published from the@objectstack/lintroot barrel), awarningin thelintDataModelsweep, soos lintand the generation rubric report it and nothing else does. It fires when the fieldtypeistext,valueDomainis undefined, and the lowercased whole field name is in the word list. The fix line names the exactvalueDomain: 'MEMBER'to add and saysos lint --strictfails until then.rule-explanations.ts. Its word-list sentence is pinned against the spec constant, so the text cannot drift from the list..changeset/35346-value-domain-name-hint.md,patchon both packages (Metadata-protocol: nonetakespatch).Tests
packages/lint/src/data-model-rules.value-domain-name-hint.test.ts(15 cases): fires once per word across all three domains, with severity, path, message and fix checked; matches case-insensitively and on the array spelling offields; does not fire on a field that already declares the domain, on aselectfield, on other types (textarea,lookup,currency,formula,number), or on names outside the list (billing_country,currency_name, …); the barrel export; theos explaintext lists exactly the spec word list.data-model-rules.fix-lines.test.ts: the new id joins the one-line, 200-character fix census.packages/spec/src/shared/value-domain.test.ts: pins the exact members, that every key is aValueDomainSchemamember, that each word appears once in lowercase, and that the list is frozen.Acceptance notes
validateObjectNamespacePrefix,packages/spec/src/kernel/namespace-prefix.ts) reads object names only, and ADR-0146 D3 states "the namespace rule reads object names, not field names". The one field-name affix is the extension-field__csuffix (ADR-0146 D10), which is a suffix on.customextension fields, not a prefix. So the rule compares the whole name case-insensitively, the fallback the dispatch names. Acountry__cextension field is not judged.suppressWarnings(measured). Not applicable:suppressWarningsis declared on the dashboard widget only (packages/spec/src/ui/dashboard.zod.ts), and the CLI has no per-rule suppression. No existing data-model warning has a suppression test, so none was added. Like every warning, this one makesos lint --strictexit 1, and on a strict run only declaring the domain clears it.os validate,os buildand the save door are unchanged. The explain entry and the changeset say so.timezoneandcurrencytext fields (sys_job,sys_business_unit,sys_organization,sys_exchange_rate) and the showcaseinvoice.currency_codealready declare their domain, so the rule adds no warning on them. The showcasecountryfield is aselect, which is not judged.skills/objectstack-data/references/lint-rules.mdlists data-model rules, but no gate requires a row, and teaching the domains in skills belongs to the sibling card skills: tell metadata-app projects what the platform already ships — a generated platform catalog and a "check the catalog first" question in objectstack-project #35345.skills/**stays out of this PR.Verification
All readings below were taken at head
713c5aa06e. Base3819afec. The fix-round readings (L1 7005985759, contract review 7006306625) are at head3fbc132c7d, in the os-dev-report comment 7006499899 on #35346.Tests (all pass)
pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2(under the verify lock): Test Files 221 passed (221), Tests 9293 passed, 5 skipped. VERDICT command-exit 0.pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2(under the lock): Test Files 947 passed (947), Tests 28926 passed, 1 todo. VERDICT command-exit 0.pnpm --filter @objectstack/lint typecheckandpnpm --filter @objectstack/spec typecheck(heap 8192): both VERDICT command-exit 0, test layers OK against their debt ledgers.Ablations (one-time; both restored to HEAD)
Run with
scripts/ablation-replace.mjs. The lint suite imports the rule fromsrcby relative path, so no rebuild was needed. Each run printedok mutation landed(anchor 1 to 0) andok restored: blob == HEAD (60f719a576d6), andgit diff HEADwas empty afterwards.type === 'text' && def.valueDomain === undefinedchanged totype === 'text': red, 1 failed of 15 (does not fire on a field that already declares the domain).def.valueDomain === undefined: red, 1 failed of 15 (does not fire on a select field, or any non-text type, with a listed name).Derived gates (dispatch-gates --commands, 92 families)
node scripts/pm/dispatch-gates.mjs --ran ran.list: 92 derived, 90 run, 2 NOT-MEASURED, 0 UNRUN; exit 0.check:api-surface,check:export-origins,check:authorable-surface,check:docs,check:doc-authoring,check:nul-bytes,check:published-files,check:dts-closure,check:type-check-coverageandcheck:type-check-debt.check:dual-build-cjs-loadsandcheck:lean-entry-closure, reason: PREREQUISITE NOT MET (exit 3). They need the whole workspace built (objectql and others outside this diff), so CI runs them.spec check:generatedwas first stale onapi-surface/andexport-origins/, which were regenerated. Itscheck:test-typecheckleg failed without diagnostics at the default heap; the same check passed at heap 8192 (spec typecheck above).🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgTAndxyZHfrVSU6UzD