Repository navigation
fix(lint): the translation-reference rules judge a locale pack's picklists face - #24474
Conversation
…tion-reference rules `picklists.<name>` no package declares is `translation-target-unknown` (error); an option key under `picklists.<name>.options` that is not a value of the list or of a `picklistExtensions` entry for it is `translation-option-key-unknown` (warning) -- each at its field twin's severity. A list the stack only extends is skipped wholly. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D6F9axfoPzR7t8G1J7Ytzz
📓 Docs Drift CheckThis PR changes 1 package(s): 1 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 b5ed262e91032f8c1dcf58ac4b90097e5d170c70 && git checkout b5ed262e91032f8c1dcf58ac4b90097e5d170c70
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 31ce45c071bbcb6e92a730ce19ebf30dcfa361cb d237990699af42ced9b5e4b3bc86977a63f99fa5 && git checkout -B drift-repro 31ce45c071bbcb6e92a730ce19ebf30dcfa361cb && git merge --no-ff d237990699af42ced9b5e4b3bc86977a63f99fa5
node scripts/docs-audit/affected-docs.mjs --json 31ce45c071bbcb6e92a730ce19ebf30dcfa361cb
|
Review: ACCEPT · PR #24474 @
|
Fixes #23566
Clause-②: no
What changed
packages/lint/src/validate-translation-references.tsnow reads a locale pack'spicklistsface. Until now nothing read it, so a wrong key passedos lint --strictand was dropped silently at runtime. Two rules already covered the same mistakes elsewhere, and this change extends both of them to the new face. No rule id is added, and each finding carries the severity of its field-level twin (the triage ruling: "the two existing rules … extend to the picklist face, at their field-level twins' severity. No new rule id."):picklists.NAMEnaming a list that no package in the stack declarestranslation-target-unknown, with "Did you mean" from the declared list names; fix line: "Match the key to a picklist'sname, or drop it."picklists.NAME.options.KEYwhere KEY is not a value of that listtranslation-option-key-unknown, with the field twin's two arms: a key spelled as the DISPLAY LABEL is told the value to rename it to, and any other key gets the nearest declared valueWhat a key resolves against. The rule uses the same set the runtime uses.
lookupPicklistOption(@objectstack/spec/system) is called with the list's name and each served option's value read as text. For a picklist-bound field, the served options are the list's ownoptionsplus everypicklistExtensionsentry for it (PicklistServedFieldSchema). So the universe is the declaration's options together with the options every extension adds. Lists and extensions are read from the stack in hand and from everypackages[].manifestbody. Both keys have theconcatdisposition, which places them inside the ADR-0130 D4 assembled body, the same reasoning the other sibling-package folds use. When both the stack and a sibling declare a list, the declaration being judged keeps the slot (the dashboards' decision). Extensions are a union.What is not judged. If the stack only extends a list and no package of the stack declares it, the
picklists.NAMEsubtree is skipped wholly. The owner's options cannot be seen from here. This is rung 2b of the object ladder (objectExtensions) applied to a list.os explain translation-target-unknownandos explain translation-option-key-unknown(rule-explanations.ts) now name the face, and the module header documents it.Deviation from the field twin (one, deliberate)
The field twin's option-key fix line ends with "Declared values: …". The picklist fix line does not. It stays one line of at most 200 characters, the shape #22161 settled on, and the verdict's "Did you mean" names the nearest value. The field twin's hint is unchanged.
Tests (at head
d237990699, after mergingorigin/main26501ae24f)the picklist face (#23566)invalidate-translation-references.test.ts, one pin per leg:….picklists.salutation.options.mister,translation-option-key-unknown, warning. The test asserts the same rule and severity on the field twin.….picklists.not_a_list,translation-target-unknown, error. The near-misssalutatongetsDid you mean "salutation"?. The test asserts the field twin's orphan severity.field-no-consumerswarning is one 856-character line, printed by validate, build and dev alike — one-line verdict +rule:id + a pointer to the full reasoning (os explain, which today takes only schema names) #22161 one-line-verdict and one-line-fix rosters and to theos explainfact pins.pnpm --filter @objectstack/lint test: 145 files and 6871 tests passed, lock VERDICT command-exit 0.pnpm --filter @objectstack/lint typecheck: VERDICT command-exit 0.pnpm --filter @objectstack/spec test:repo: 69 files and 1134 tests passed, VERDICT command-exit 0.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 64 commands, and I ran all of them. Reconciled with--ran(each lineCMD :: exit N): 62 exit 0 and 2 NOT MEASURED.check:dual-build-cjs-loadsandcheck:lean-entry-closureexited 3 with PREREQUISITE NOT MET, because they need a whole-workspacepnpm buildthat I did not run locally. CI builds the full tree for them.picklists(git grep -n picklists -- examplesreturns 0 hits), so no shipped stack starts failing. HotCRM keeps its local guard until this ships (see the card's consumer note).Acceptance notes
content/docs/protocol/kernel/i18n-standard.mdx: the table of resolvable keys has nopicklists.{list}/picklists.{list}.options.{value}rows. The file is outside this card's claimed surface, so it is left for a docs follow-up. Carrier: none named.picklist: NAME) owned by a dependency outside the artifact. Apicklists.NAMEtranslation key for that list is reported astranslation-target-unknown. This matches the object twin's verdict for an object contributed by another installed package. It does not match the CLI'spicklist-reference-unverifiednotice for the reference itself.Generated by Claude Code