Skip to content

fix(i18n): server t() fills {{ name }} holes written with spaces, as the Console does - #38265

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-vv5p1j
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-vv5p1j

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #38092
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Clause-②: yes (widening)
Metadata-protocol: semantic
Skills-docs: none — skills/objectstack-i18n already teaches the {{variable}} form; the spaced form is tolerated to match the Console, not a new form to teach

维护者速读

  • 翻译里把占位符写成花括号内带空格的形式时,服务端发出的通知和报错现在会填上值,和控制台显示一致;以前服务端原样印出花括号。
  • 替写翻译的搭建者解决:同一句翻译在控制台正常、在服务端消息里露出花括号。
  • 只改服务端两处翻译替换的规则,不带空格的写法照旧;出问题最多是某句消息填值不对,可以直接撤回。
  • 无

What changes

  • packages/services/service-i18n/src/file-i18n-adapter.ts: interpolate matches {{, optional whitespace, a word, optional whitespace, }}, so {{ name }} and tab-spaced holes are filled like {{name}}. A hole with no value is written back exactly as matched ({{ missing }}), where the old code re-spelled it as {{missing}}. Docblocks say so.
  • packages/core/src/fallbacks/memory-i18n.ts: the in-memory fallback t() gets the same pattern and the same write-back.
  • Single braces ({name}) are still not a placeholder on either side.
  • Changeset: @objectstack/core, @objectstack/service-i18n minor (Metadata-protocol: semantic: on the server a translation string's {{ name }} now means a placeholder instead of literal text).

Not changed: packages/spec (the validation / operation message override interpolator has the same gap; the seat files it as its own card), ui, locale packs, HotCRM, skills.

Tests

  • packages/services/service-i18n/src/file-i18n-adapter.test.ts, a new top-level describe: the same bundle string goes to FileI18nAdapter.t() and createMemoryI18n().t(), and each answer must equal what the Console's i18next answered for that template (measured, table below): {{name}}, {{ name }}, a tab plus two spaces, single braces, and a spaced hole with no value.
  • packages/core/src/fallbacks/fallbacks.test.ts: one test in core's own suite ({{ name }} filled, a spaced hole with no value kept as written), so core alone catches a regression.

Per-form readings (params { name: 'Ada' }):

Template Console (i18next 26.4.0) main FileI18nAdapter / createMemoryI18n this PR, both
Hi {{name}}! Hi Ada! Hi Ada! Hi Ada!
Hi {{ name }}! Hi Ada! Hi {{ name }}! Hi Ada!
tab and two spaces Hi Ada! as written Hi Ada!
Hi {name}! Hi {name}! Hi {name}! Hi {name}!
Hi {{ missing }}! Hi {{ missing }}! Hi {{ missing }}! Hi {{ missing }}!

Acceptance notes

  • Premise measured on origin/main bd5407ec before any edit: a probe fed one template to real i18next 26.4.0 (the Console's dependency, its default {{ }} interpolation), createMemoryI18n().t() and FileI18nAdapter.t(). Readings are the "Console" and "main" columns above.
  • Same gap, not fixed here (seat ruling, claim 7237673531): interpolateValidationMessage in packages/spec/src/system/validation-message.ts fills translated validation and operation message overrides and still reads only {{label}}. The probe measured a {{ label }} override printed as written. The seat files it as a separate card.
  • Three more copies of the old pattern fill only the platform's own English catalogs, which carry no spaced holes, so no author reaches them: plugin-audit activity-summary-message.ts, plugin-approvals approval-notification-text.ts, core security/change-record-owner.ts. Their docblocks say they follow "the convention both t() use", which is now only true for unspaced holes. Left as is.
  • One widening, nothing narrowed: every string that rendered before renders the same, except that a spaced hole with a value is now filled.

Verification

  • Two-minute check: pnpm --filter @objectstack/service-i18n exec vitest run src/file-i18n-adapter.test.ts shows 61 passed, 10 of them the new block.
  • Read first: interpolate in file-i18n-adapter.ts, then the t() return line in memory-i18n.ts.
Local readings at cc1fe06
  • pnpm --filter @objectstack/service-i18n test: Test Files 4 passed, Tests 87 passed; typecheck exit 0.
  • pnpm --filter @objectstack/core typecheck && pnpm --filter @objectstack/core test: Test Files 158 passed, Tests 3807 passed.
  • Ablations through scripts/ablation-replace.mjs, each restore blob == HEAD and git diff HEAD empty:
    • adapter pattern reverted: 2 failed (FileI18nAdapter spaced, tab).
    • memory pattern reverted, core rebuilt and marker read in dist/: core suite 1 failed; adapter suite 2 failed (createMemoryI18n spaced, tab). After restore and a forced core rebuild, dist/index.js carries the new pattern on the memory line.
    • adapter write-back re-spelled as {{key}}: 1 failed (spaced hole with no value).
  • dispatch-gates --ran with recorded exit codes (gates-ran-cc1fe06c.list): 67 derived, 65 exit 0, 2 NOT MEASURED (exit 3: check-plugin-teardown-shape --self-test, fixture commit outside the shallow clone; check:dual-build-cjs-loads, needs a full pnpm build), 0 unrun. check:lean-entry-closure exit 0 after an objectql build.
  • overlap-check.mjs VERDICT clean exit 0 against origin/main 98bd8de.

Generated by Claude Code

…the Console does

FileI18nAdapter.t() and createMemoryI18n().t() now accept whitespace
inside the braces, matching the Console's i18next; a hole with no value
is written back exactly as authored.

Claude-Session: https://claude.ai/code/session_01L9qibxWAZYhFuv668TruUa
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/core, @objectstack/service-i18n, touching 1 documentable anchor(s).

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/kernel/services-checklist.mdx (via createMemoryI18n (symbol, a top-level function))
What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 41 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 73ec085afa2f9689ef96263a9c25b82cde6fda47 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from eb3cbf3317960b1e91cc180aa82c454bb98aff12 — the merge of head f447517c5b7c8c8e229781c9a9a73498d02eccd1 into base 73ec085afa2f9689ef96263a9c25b82cde6fda47, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin eb3cbf3317960b1e91cc180aa82c454bb98aff12 && git checkout eb3cbf3317960b1e91cc180aa82c454bb98aff12
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 73ec085afa2f9689ef96263a9c25b82cde6fda47 f447517c5b7c8c8e229781c9a9a73498d02eccd1 && git checkout -B drift-repro 73ec085afa2f9689ef96263a9c25b82cde6fda47 && git merge --no-ff f447517c5b7c8c8e229781c9a9a73498d02eccd1

node scripts/docs-audit/affected-docs.mjs --json 73ec085afa2f9689ef96263a9c25b82cde6fda47

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 73ec085afa2f9689ef96263a9c25b82cde6fda47 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-28T11:36Z

Contract review

Served-tier: TIER_DEFAULT
Head-sha: cc1fe06c4107e03c771f7ce589a93374ef81da06
Local-runs: none

Why TIER_DEFAULT: the review is owed by the Clause-②: yes (widening) declaration alone. The diff touches no packages/spec/src/**, no governed path and no narrowing, and Metadata-protocol: semantic creates no face. It is run in the seat's L1 thread, with no second agent.

① Derived judgments

  • D1 The accept set of both server t() (FileI18nAdapter interpolate, createMemoryI18n().t()) widens from /\{\{(\w+)\}\}/ to /\{\{\s*(\w+)\s*\}\}/: right. A bundle string with spaces or tabs between the braces and the name was printed literally on the server and filled by the Console's i18next. Now both fill it. An unspaced {{name}} matches exactly as before.
  • D2 The missing-value answer is the matched text verbatim: right. For an unspaced hole this is byte-identical to the old {{${name}}}. A spaced hole keeps its spaces, never re-spelled, which matches i18next 26.4.0's own answer (its default leaves a hole with no value as written). params[name] == null in core is the same test as the old ??, so null and undefined are treated as before.
  • D3 {name} (single braces) is still not a placeholder: right, and it agrees with the skill's line "double-brace {{variable}} placeholders only — single braces pass through" (skills/objectstack-i18n/SKILL.md ~270).
  • D4 No export, type or schema moves. II18nService keeps its signature.
  • D5 Behaviour only an author could notice: a translation that wanted the literal text {{ name }} while a name param is passed now gets the value. That is the Console's reading of the same string, and it is the point of the card.

② Semver level

Right. @objectstack/core and @objectstack/service-i18n take a minor: a semantic kind takes at least minor on a package the diff moves (AGENTS.md Post-Task 3). Clause-②: yes (widening) is the right arm, because more authored strings are filled and none is refused. It is not breaking, so no ADR-0087 marker is owed. Both declaration lines are line-initial in the PR body and the changeset. Check Changeset is green.

③ Boundary flags

No must-fix, no should-fix.

Implemented-by: claude/project-thread-vv5p1j
Reviewed-by: session_01L9qibwSEecrzDjKjbk24r1

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-28T11:36Z

L1-a ACCEPT at cc1fe06c4107e03c771f7ce589a93374ef81da06.

  • Contract. The record is 7238665113: TIER_DEFAULT, PASS, no must-fix and no should-fix. It is owed by Clause-②: yes (widening) alone. There is no published-schema, governed or narrowing face, so it was run in this thread with no second agent.
  • Claim against surface (claim 7237673531). The diff matches the claim file for file: the two interpolators, the one describe in file-i18n-adapter.test.ts (2 servers × 5 forms), the one assertion in fallbacks.test.ts, and one changeset with the two minors. Scope A holds. The spec interpolateValidationMessage is left to its own card (A translated validation or operation message written with {{ label }} (spaces inside the braces) prints the braces, because the spec's own interpolator still reads only {{label}} #38266), and the three platform-only copies are in the Acceptance notes.
  • Changeset, read sentence by sentence: it holds. "A placeholder with no value is still left exactly as written, spaces included" matches D2. "Single braces ({name}) are still not a placeholder" matches D3. "No change is needed in your bundles" is true for every unspaced hole.
  • Evidence (report 7238112039).
    • service-i18n: 87/87. core: 3807/3807. Both type-check clean.
    • The per-form table equals the measured i18next 26.4.0 answers.
    • All three ablation legs went red and were restored. The core leg was checked on dist with its preflight marker.
    • 67 derived gates: 65 exit 0. The 2 NOT MEASURED are covered by green CI at this head.
  • Checks at this head: 57 success, 11 expected skip, 0 failed, 0 pending. mergeable clean.
  • Relation. Fixes #38092 is right: both server t() now read the Console's spaced form, which is the card's ask.
  • For the sibling A translated validation or operation message written with {{ label }} (spaces inside the braces) prints the braces, because the spec's own interpolator still reads only {{label}} #38266. Record ③ states the rules it must match: \s* inside the braces, a missing value written back verbatim, and single braces not a placeholder.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-28T12:12Z

Contract review

Served-tier: TIER_DEFAULT
Head-sha: f447517c5b7c8c8e229781c9a9a73498d02eccd1
Local-runs: none

A mechanical delta from record 7238665113 (TIER_DEFAULT PASS at cc1fe06c4107e03c771f7ce589a93374ef81da06) to this head. The new head merges main 73ec085 into cc1fe06 and adds no other commit. The review is still owed by the Clause-②: yes (widening) declaration alone, so it stays at TIER_DEFAULT, run in the seat's L1 thread.

① Derived judgments

  • E1 The merge is mechanical. git diff 98bd8dee cc1fe06c | git patch-id --stable and git diff 73ec085a f447517c | git patch-id --stable both read 95a6e15f. git show --cc of the merge is empty. The net diff is the same 5 files, +56/−6.
  • E2 D1 to D5 of record 7238665113 stand unchanged. main between 98bd8de and 73ec085 touched none of the 5 files, and nothing in it moves the two t() interpolators or their callers.

② Semver level

Unchanged and right: @objectstack/core and @objectstack/service-i18n minor, Clause-②: yes (widening), Metadata-protocol: semantic.

③ Boundary flags

No must-fix, no should-fix.

Implemented-by: claude/project-thread-vv5p1j
Reviewed-by: session_01L9qibwSEecrzDjKjbk24r1

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-28T12:14Z

L1-a delta: ACCEPT at f447517c5b7c8c8e229781c9a9a73498d02eccd1. It follows my ACCEPT 7238671722 at cc1fe06c. The new head merges main 73ec085 and adds no other commit.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Landing · 2026-11-28T12:17Z · zone o3-ux (seat card thread)
Head-sha: f447517c5b7c8c8e229781c9a9a73498d02eccd1

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 28, 2026 12:18
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit d085e6c Nov 28, 2026
69 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-vv5p1j branch November 28, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants