Skip to content

feat(spec, runtime, lint, core): a hook writes the sentences it declares in the organization's language (ctx.text) - #34545

Merged
os-zhuang merged 19 commits into
mainfrom
claude/project-thread-l1nf08
Nov 17, 2026
Merged

os-zhuang merged 19 commits into
mainfrom
claude/project-thread-l1nf08

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Part of #34374

Clause-②: yes (widening) — a hook may now declare texts and its code may call ctx.text; translation bundles accept hooks.<hook>.texts.<key>.message; @objectstack/core exports readOrganizationTextLocale. Nothing that was accepted before is refused
Metadata-protocol: added
Skills-docs: follow-up #34546

This is the hook half of #34374 (ruling 6913660232 option B, parameter 7; split recorded on the card by repo:objectstack#2). The action half is left to PR2: action-written text (objects.<obj>._actions.<act>.* / globalActions.<act>.*, e.g. HotCRM's send_email script action writing 'Email: ' + subject) lands after #34273 merges, reuses #34273's shared declared-entry factory, starts from fresh main, and is the PR that closes the card. This PR does not touch action.zod.ts.

维护者速读

  • 改了什么:钩子可以声明自己写进记录给人读的句子(texts),运行时用 await ctx.text('key', { … }) 取,按组织语言给出(Localization 设置有人设过就用它,否则应用的 i18n.defaultLocale),从不按触发保存的那个人的语言。
  • 为什么改:HotCRM 的线索/工单钩子把「Follow up with qualified lead: …」这类英文句子写进任务标题,中文、日文组织里大家读到的都是英文;裁定 B 第 7 项要求和已声明的钩子拒绝语同一规则。
  • 风险与回滚:纯新增,未声明 texts 的钩子行为不变;缺译文写声明原文,不失败;只有 Localization 设置读不出来(非「未注册」)时那次 ctx.text 拒绝。回滚即 revert。
  • 先看:packages/runtime/src/sandbox/hook-text.ts(取语言、选译文、填洞),然后 packages/spec/src/data/hook.zod.ts 的 texts 与保存期检查。
  • 两分钟验证:pnpm --filter @objectstack/runtime exec vitest run src/sandbox/hook-text.integration.test.ts,预期 11 条全过(返工后加了「译文渲染不了回落到声明句」在两条路径上各 1 条)。
  • 需要你做的:无,席位落地;动作一半在 PR2(等 actions: an action body has no refusal catalogue — a person-facing throw from an action stays in the author's language #34273 合并)。

What changes

  • Spec — HookSchema.texts (packages/spec/src/data/hook.zod.ts, hook-refusal-codes.ts): a hook declares texts: { <snake_case key>: { message, params? } }. params names the {{ }} holes, under the same closed-scope rule a declared refusal's message follows; a text with no params is plain and a hole in it is refused. Save-time checks: texts on an expression body or on a hook with neither body nor handler is refused at texts; a ctx.text('<literal>') key the hook does not declare is refused at body.source / handler (comments and strings are masked; a computed key is left to the run).
  • Spec — translation face (i18n-resolver.ts, translation.zod.ts): the key is hooks.<hook>.texts.<key>.message (hookTextMessageKey); the translation bundle's hooks.<hook> group accepts texts.
  • Core — one reading of the organization's language (packages/core/src/organization-locale.ts): readOrganizationTextLocale(getService, organizationId) — the Localization setting somebody set (source !== 'default'), else the app's i18n.defaultLocale, else nothing. An unregistered Localization namespace/key (SETTINGS_UNKNOWN_NAMESPACE / SETTINGS_UNKNOWN_KEY) is "not set"; any other read failure propagates. The flow record write (service-automation) used its own private copy of exactly this; it now calls the shared one, answers unchanged.
  • Runtime — ctx.text(key, params?) (packages/runtime/src/sandbox/hook-text.ts, body-runner.ts, quickjs-runner.ts, script-runner.ts, app-artifact-handlers.ts): translate the template first (through the i18n service, negotiated as refusals are), then fill the holes through the formula template engine (renderHookTemplate, shared with the refusal filler, which keeps its behaviour). A missing translation answers the declared message; a translation whose holes do not render is dropped for the declared message, filled, with a warning that says so; an undeclared key throws a SandboxError naming the hook and the key. Same answer on a sandboxed js body (installed on the VM's ctx) and an in-process handler (the withInProcessHookTitle seam).
  • Lint (i18n-walk.ts, validate-translation-references.ts, validate-hook-refusal-templates.ts): os i18n extract scaffolds hooks.<hook>.texts.<key>.message with the declared sentence; objectstack validate refuses a hooks.<hook>.texts.<key> translation over a key the hook does not declare (nearest key offered). The compile half of a hook sentence (hooks: the refusal catalogue (refusals) cannot translate a handler-authored hook's refusals, and holds one sentence per code — a TS hook has no way to refuse in the user's language #33214) now judges texts.<key>.message for an entry with params beside the refusal sentences: logic, an unknown formatter, an empty hole and currency with no code are errors at objectstack validate, compile and the publish gate's hook write.
  • Docs: automation/hooks.mdx (new section), automation/hook-bodies.mdx (ctx.text row), ui/translations.mdx (key row).
  • Generated: dropped-refinements baseline (the new HookText object-level check and the texts.valueType sites), liveness rows (hook.texts, translation.hooks.texts), and the check:generated --fix outputs (api-surface, export-origins, declaration-map, reference docs, strictness ledger, liveness counts, and the two generator-owned skills/*/references/_index.md lines that list HookTextSchema).

Not changed: no backfill of rows already written (parameter 6); no org.locale root (parameter 8); a string a hook builds itself is written as it is (parameter 4).

Tests

  • packages/runtime/src/sandbox/hook-text.integration.test.ts (new): the HotCRM lead follow-up shape on the real ObjectQL + SqlDriver (better-sqlite3) + QuickJSScriptRunner + in-memory i18n, on both the sandboxed body and the in-process handler path, every assertion on the stored task row. An en-US caller in a zh-CN app writes the zh-CN translation, holes filled; a ja-JP Localization setting somebody set wins and is asked in the write's organization (CONTROL: the source: 'default' placeholder does not count); no translation writes the declared sentence filled; SETTINGS_UNKNOWN_KEY answers the app default while SETTINGS_STORE_UNAVAILABLE rejects the update with no task written; an undeclared key rejects naming hook and key; a translation whose holes do not render writes the declared sentence filled and warns so (CONTROL: a translation that renders, with a known formatter, is written).
  • packages/spec/src/data/hook-texts.test.ts (new): schema acceptance, key pattern, hole rules, alias, expression-body / no-code refusal, handler acceptance, literal undeclared key at body.source and handler, masked-comment/string/computed-key CONTROL, run-time message, translation face, key spelling.
  • packages/core/src/organization-locale.test.ts: readOrganizationTextLocale — set wins in the organization; no settings / placeholder → app default; unregistered namespace/key → app default; other failure rejects; no lookup → nothing.
  • packages/lint/src/validate-hook-refusal-templates.test.ts: a hook text with params — CONTROLs accepted (a path, a known formatter, currency:EUR, plain text); an unknown formatter, logic and an empty hole refused as errors at texts.<key>.message; currency with no code refused naming currency:EUR; a text with no params not read; a text and a refusal on one hook each at its own path; part of the stack expression pass; refused at the publish gate's hook write (CONTROL passes).
  • packages/lint/src/validate-translation-references.test.ts, i18n-walk.test.ts: declared text passes; undeclared key refused with suggestion; key on a hook with no texts refused; the walk yields the key with the declared sentence from the hook bucket.
  • Forced test changes: packages/metadata-protocol/src/protocol.meta-types-degenerate-derivation.test.ts (hook serves 24 top-level properties, was 23); packages/spec/src/system/metadata-form-zod-reconciliation.test.ts (a root ledger row for hook.texts); packages/spec/src/type-alias-convention.pin.test.ts pins HookTextSchema as an isomorphic alias (ADR-0122; no default, no transform, beside HookRefusalSchema) and moves the pin count by one (857 after merging main, which added two). No other existing test was changed.

Acceptance notes

  • Action half → PR2 (after actions: an action body has no refusal catalogue — a person-facing throw from an action stays in the author's language #34273), as above.

  • The Studio hook form (hook.form.ts) gets no texts row in this PR: adding one needs its labels and help text translated in the eleven metadata-forms bundles, which is outside this half's file surface. The form↔Zod reconciliation records the omission as a root ledger row, owed to a follow-up card. A hook authored in Studio can still carry texts through its source. Filed: Studio hook form: add the texts row (11 locale packs) and retire its reconciliation-ledger omit #34575.

  • ctx.text is a pull API rather than a write-time marker because the HotCRM hooks truncate and compose the sentence (both cut to 255 characters) before writing it.

  • New public names, confirmed by the seat: texts, ctx.text, HookTextSchema, hookTextMessageKey. readOrganizationTextLocale is kept because its reading differs from main's readOrganizationLocaleSetting (it is built on it, not beside it); its JSDoc carries the side-by-side table below.

    the Localization setting answers… readOrganizationLocaleSetting readOrganizationTextLocale
    set (source: 'tenant', ja-JP) ja-JP ja-JP
    the source: 'default' placeholder undefined the app default (zh-CN)
    no settings service undefined the app default (zh-CN)
    SETTINGS_UNKNOWN_KEY rejects the app default (zh-CN)
    SETTINGS_STORE_UNAVAILABLE rejects rejects

    Read by a probe at head over both exports (app default zh-CN, organization org_1). The flow record write's private copy of the second column (service-automation) is gone; the seed loader keeps the first.

  • Needs a contract-tier review (Metadata-protocol: added).

Verification

Every heavy run went under os-verify-lock.

  • Head 7b8d110 merges main d57d6ee through scripts/pm/os-regen-merge.sh (merge 5e33619, then the regeneration commit 7b8d110). packages/spec/dropped-refinements.baseline.json conflicted only in its measured header (main 268 / 1116, this PR +1 schema / +6 sites) and was recomputed from the merged body, 269 / 1122; authorable-surface/data.json and content/docs/references/data/hook.mdx were regenerated from the merged tree (gen:schema, gen:docs) rather than text-merged. After the merge: check:generated 14/14; @objectstack/spec tests 848 files, 27168 passed; @objectstack/lint 214 files, 9107 passed; runtime sandbox + app-artifact-handlers 52 files, 649 passed; spec, lint and runtime typecheck exit 0 (runtime's first run was red on a stale local driver-turso build, green after rebuilding it). check-governed-merges.mjs --pr 34545 at 7b8d110: "0 of 48 path(s) hit the register after 2 generated-artifact lift(s) (13 surfaces govern objectstack). ✅ NOT governed". Outside the baseline and the generated docs and surface, this PR's diff against main is line-for-line the one reviewed at 8929099 (git diff 31096af8 8929099e against git diff d57d6eed 7b8d110d, same changed lines).

  • Head 8929099 is L1 rework round 1 (review 6937770388), plus a merge of main 31096af:

    • Item 1: validate-hook-refusal-templates.ts judges hook texts; hook-text.ts falls back from a translation that does not render to the declared message, filled. @objectstack/lint validate-hook-refusal-templates.test.ts 24/24; runtime hook-text.integration.test.ts + hook-refusal suites 49/49.
    • Ablations (restored, git diff empty after each): the lint pass skipping texts ⇒ 7 of 24 red (every refusal case, the stack pass and the publish gate; the 4 CONTROLs and the no-params case stay green). The run-time fallback writing the unrendered translation ⇒ 2 of 11 red (the new case, both paths).
    • HookTextSchema.params, its JSDoc, automation/hooks.mdx and the changeset now say where each hole is refused (parse, or os validate / compile / the publish gate). The liveness row hook.texts.params is re-anchored at renderHookTemplate.
    • Merge of main 31096af: the alias pin count resolves to 857 (main 854 → 856, this PR +1), with both history lines; gen:schema and gen:docs exit 0; check:generated failed check:liveness on its first run (the hook.texts.params citation named the replaced filler) and passed 14/14 after the re-anchor above.
    • Gates: dispatch-gates --commands derived 129 families at 8929099; all 129 ran: 128 exit 0, and check:skill-examples exit 3 on a stale @objectstack/client dist (nothing measured), exit 0 on its rerun after pnpm --filter @objectstack/client build.
    • node scripts/pm/check-governed-merges.mjs --pr 34545 at 8929099, in a built tree: "governed-surface predicate: 0 of 48 path(s) hit the register after 2 generated-artifact lift(s) (13 surfaces govern objectstack). ✅ NOT governed". Both skills/*/references/_index.md lines read as a pure gen:skill-refs regeneration on this tree ([finding] skills/*/references/_index.md is generator-owned (gen:skill-refs) yet sits inside the skills/** governed-merge fence — every spec PR touching an indexed headline is forced to carry a governed-surface file #11705).
  • @objectstack/runtime sandbox + app-artifact-handlers suites: 10 files, 308 passed (the hook-text pin 9/9 again at head). @objectstack/core organization-locale.test.ts: 10 passed. @objectstack/lint walk + translation references: 255 passed. @objectstack/service-automation: 286 files, 4076 passed. @objectstack/spec hook texts + hook refusals: 113 passed.

  • Typecheck (tsc --noEmit) of core, runtime, lint, service-automation: exit 0. pnpm --filter @objectstack/spec check:generated: 14/14 green after --fix; check:test-typecheck green.

  • Ablation (scripts/ablation-replace.mjs, restored, blob == HEAD, git diff HEAD empty): replace the translation pick in hook-text.ts with undefined ⇒ 6 of 9 integration tests red (every translated-language pin, both paths); the 3 that stay green are the missing-translation fallback (both paths) and the undeclared-key refusal, which read no translation.

  • Head df9ac15 merges main 8dd8192. packages/spec/dropped-refinements.baseline.json conflicted only in its measured header (main moved sites 1090 → 1114, this PR 1090 → 1096); the header was recomputed from the merged body, 267 schemas / 1120 sites, and authorable-surface/data.json was regenerated with gen:schema. After the merge: check:generated exit 0; @objectstack/spec local tests 848 files, 27148 passed; runtime sandbox + app-artifact-handlers 52 files, 647 passed; runtime and service-automation typecheck exit 0 (runtime's first run was red on a stale local driver-turso build, green after rebuilding it).

  • Head 70a4381 fixes Test Core (2/8) at aae87d7: scripts/dropped-refinements.test.ts checks that the ledger's measured header totals equal its body. The hand-edited rows for HookText and the four hook texts.valueType sites were added, but the header still read 266 schemas / 1090 sites; it now reads 267 / 1096. @objectstack/spec local project: 847 files, 1 failed before the fix (this test), 27/27 in the file after.

  • Head aae87d7 fixes three red CI checks at d4e652a:

    • Type Check · workspace: the new pin imported EngineInsertOptions, which @objectstack/spec/data does not export; it now names DataEngineInsertOptions. pnpm --filter @objectstack/runtime typecheck (with check:test-typecheck) exit 0; core, lint and service-automation typecheck exit 0.
    • Test Core (2/8): metadata-form-zod-reconciliation.test.ts refused texts as accepted by the Zod but not offered by the hook form. A root ledger row (omit, hook, texts) now records why: the Studio row is owed to a follow-up (see Acceptance notes). 76/76.
    • Test Core (6/8): protocol.meta-types-degenerate-derivation.test.ts pins the top-level property count /meta/types serves; hook 23 → 24 for texts, with its history line. @objectstack/metadata-protocol: 355 files, 1 failed before the fix (this pin), 18/18 in the file after.
    • Affected gates rerun: check:query-options-erasure, check:slot-lookup, check:test-source-alias, check:type-check-debt exit 0; check:generated exit 1 on a first run beside a concurrent build and exit 0 on a second run.
  • Head d4e652a: the changeset's Clause-② line now reads yes (widening), matching Metadata-protocol: added (CI Check Changeset refused no beside added). check-empty-changeset and check:changeset-fixed exit 0.

  • Head a3a4bb5 merges main 107d2e8. GitHub read the PR as conflicting because both sides moved the generated schema counts in content/docs/references/index.mdx (this PR +1 in Data, main +1 in UI), and GitHub does not use the repo's merge driver for generated artifacts. The local merge applied that driver. Resolution: gen:docs on the merged tree (1667 schemas: Data 188, UI 177), then check:generated 14/14 and check:docs exit 0. check-governed-merges --pr 34545: NOT governed, and both skills/*/references/_index.md lines are a pure gen:skill-refs regeneration on this tree ([finding] skills/*/references/_index.md is generator-owned (gen:skill-refs) yet sits inside the skills/** governed-merge fence — every spec PR touching an indexed headline is forced to carry a governed-surface file #11705).

  • Head 7bebb37 (35212cf plus a JSDoc table on readOrganizationTextLocale and the Skills-docs line in the changeset): core organization-locale.test.ts 10 passed and tsc --noEmit exit 0; the same 129-family derivation, of which the 26 changeset/docs/core families reran with exit 0. At 35212cf, merged with main after branching from e8cba8f. Gates: dispatch-gates --commands derived 129 families; all 129 ran with exit 0 at this head, and --ran reports 129 run, 0 NOT-MEASURED, 0 UNRUN. On the first round check:query-options-erasure caught two erased options bags in the new pin (now typed) and check:spec-parsed-alias asked for the HookTextSchema pin (added); the exit-3 prerequisites (shallow clone, unbuilt client-react and other dists) were built and every family rerun.


🤖 Generated with Claude Code

https://claude.ai/code/session_01ADHkmNwjZuUekdsr5UH3GP

@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation protocol:data protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 5 package(s): @objectstack/core, @objectstack/lint, @objectstack/runtime, @objectstack/service-automation, @objectstack/spec, touching 51 documentable anchor(s). ⚠️ 12 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/api-surface/system.json, packages/spec/authorable-surface/data.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/automation/hook-bodies.mdx (via ScriptContext (symbol, a top-level interface), body.source (literal, a string literal in refuseUndeclaredLiteralTextKey; a string literal in undeclaredHookTextKeyAtSave))
  • content/docs/automation/hooks.mdx (via crm_task (literal, a string literal in a comment in HookSchema), follow_up_subject (literal, a string literal in a comment in HookSchema; a string literal in a comment on a changed line))
  • content/docs/kernel/architecture.mdx (via getService (symbol, a field of interface HookTextOptions; a field of interface InProcessHookOptions))
  • content/docs/kernel/cluster.mdx (via getService (symbol, a field of interface HookTextOptions; a field of interface InProcessHookOptions))
  • content/docs/kernel/runtime-services/audit-service.mdx (via getService (symbol, a field of interface HookTextOptions; a field of interface InProcessHookOptions))
  • content/docs/kernel/runtime-services/settings-service.mdx (via SETTINGS_UNKNOWN_KEY (literal, a string literal in isUnregisteredSetting), SETTINGS_UNKNOWN_NAMESPACE (literal, a string literal in isUnregisteredSetting))
  • content/docs/kernel/services-checklist.mdx (via getService (symbol, a field of interface HookTextOptions; a field of interface InProcessHookOptions))
  • content/docs/plugins/anatomy.mdx (via getService (symbol, a field of interface HookTextOptions; a field of interface InProcessHookOptions))
  • content/docs/plugins/development.mdx (via getService (symbol, a field of interface HookTextOptions; a field of interface InProcessHookOptions))
  • content/docs/protocol/kernel/config-resolution.mdx (via SETTINGS_UNKNOWN_KEY (literal, a string literal in isUnregisteredSetting), SETTINGS_UNKNOWN_NAMESPACE (literal, a string literal in isUnregisteredSetting))
  • content/docs/protocol/kernel/index.mdx (via getService (symbol, a field of interface HookTextOptions; a field of interface InProcessHookOptions))

⛔ 3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via HookSchema (symbol, a top-level const))
  • content/docs/releases/v17/17-1.mdx (via crm_task (literal, a string literal in a comment in HookSchema))
  • content/docs/releases/v17/17-7.mdx (via HookSchema (symbol, a top-level const), bindAppArtifactHandlers (symbol, a top-level function), SETTINGS_UNKNOWN_KEY (literal, a string literal in isUnregisteredSetting))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 12 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/api-surface/system.json, packages/spec/authorable-surface/data.json, …) — pages documenting those are invisible to this run
  • 4 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 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; 123 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 — 185 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 60552cd9398ad516ed367cd41530188fe97542be → packageMentionDocs.

Which tree this was computed on

This run read content/docs from b4be2bf1fe57667d52b373ba68b108db576b5261 — the merge of head 7b8d110d6c524f77f7a808dd227b8b10039644da into base 60552cd9398ad516ed367cd41530188fe97542be, 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 b4be2bf1fe57667d52b373ba68b108db576b5261 && git checkout b4be2bf1fe57667d52b373ba68b108db576b5261
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 60552cd9398ad516ed367cd41530188fe97542be 7b8d110d6c524f77f7a808dd227b8b10039644da && git checkout -B drift-repro 60552cd9398ad516ed367cd41530188fe97542be && git merge --no-ff 7b8d110d6c524f77f7a808dd227b8b10039644da

node scripts/docs-audit/affected-docs.mjs --json 60552cd9398ad516ed367cd41530188fe97542be

⚠️ 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 60552cd9398ad516ed367cd41530188fe97542be → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…erves 24 properties; texts' Studio row is recorded as owed

Claude-Session: https://claude.ai/code/session_01ADHkmNwjZuUekdsr5UH3GP
Co-authored-by: Claude <noreply@anthropic.com>
…ext rows it lists

The ledger gained HookText and four hook `texts.valueType` sites by hand
but its measured header still read 266 schemas / 1090 sites; it now reads
267 / 1096, which is what its body holds.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmNwjZuUekdsr5UH3GP
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmNwjZuUekdsr5UH3GP

Test Core (3/8) at 70a4381 failed in @objectstack/mcp#test, reading 2026-11-17T02:45Z.

  • The job log could not be read from this container (the log host is refused by its proxy), and the check's annotations name only packages/mcp … pnpm run test exited (1), not a test. So the failing test is NOT MEASURED here.
  • The same tree passes locally: pnpm --filter @objectstack/mcp test at 70a4381 (under os-verify-lock), 66 files, 1226 passed, 0 failed.
  • At the previous head aae87d7, every Test Core shard except 2/8 passed, with the same runtime, spec-source and core changes this PR carries. The only change since is two numbers in packages/spec/dropped-refinements.baseline.json (its measured header), which @objectstack/mcp does not read.

Reading: this looks like a flake outside this PR's change, not a regression. The next step is one re-run of the failed jobs once the run completes; if it fails again, the failure is real and I will fix it.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRXuRn93HphKp7kXEz

Re-run reading (area o2-D) — run 44001704215 @ 70a4381b

Read the job log of Test Core (3/8) (job 133767960037). The one failure:

  • packages/mcp/src/mcp-file-tools.test.ts:950 — read_file extracts PDF and Word text on a worker pool, off the request thread > out of CPU budget on the worker: the pages read so far, truncated, with the budget note, as in-process — received content: "none" instead of "text" (truncated).
  • 1 failed | 1225 passed in @objectstack/mcp; every other package in the shard passed.

Judgement: flake. The case races a CPU budget on a worker thread (whether any page finished before the budget ran out depends on runner load), and this PR touches no file under packages/mcp/ nor anything it imports; the same tree passes 66/66 files locally and main @ ed45eb92 is green on this shard. Re-running the failed jobs once via scripts/pm/rerun-failed.mjs; a second failure is treated as real.

…-l1nf08

# Conflicts:
#	packages/spec/dropped-refinements.baseline.json
…-l1nf08

# Conflicts:
#	packages/spec/dropped-refinements.baseline.json
…surface on the merged tree

Discharges the os-regen deferral of the merge of main d57d6ee: both
files are generated, so they are rebuilt from the merged tree rather
than text-merged.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmNwjZuUekdsr5UH3GP
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRXuRn93HphKp7kXEz

Final head for review (main merge): 7b8d110d6c524f77f7a808dd227b8b10039644da (card #34374 PR 1, branch claude/project-thread-l1nf08). It merges main d57d6ee into 8929099 (L1 ACCEPT 6939309851 and L2 PASS 6939428411 named 8929099) through os-regen-merge.sh: the dropped-refinements.baseline.json header recomputed to 269 schemas / 1122 sites, authorable-surface/data.json and references/data/hook.mdx regenerated; outside those, the PR's diff against main is line-for-line the one reviewed at 8929099. CI on this head, latest run per check: 56 success, 12 skipped, 0 failed; git merge-tree against main 8bc0808 clean. check-governed-merges.mjs --pr 34545 in a built tree: 0 of 48 paths after 2 generated-artifact lifts, NOT governed. Owed: L1 and L2 deltas on this head; then the seat's governed step. The PR stays a draft and unarmed.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmTHGRTjPqZAcBuo9WH

席位核对

L1 delta (merge of main only) · ACCEPT · head 7b8d110d6c524f77f7a808dd227b8b10039644da (final head 6940452806) · card #34374 (PR1, hook half) · over my ACCEPT 6939309851 at 8929099e · read 2026-11-17T06:19Z

Delta read

  • Commits since 8929099e: 5e336193 merges main d57d6eed; 7b8d110d regenerates on the merged tree. No other commit of the PR's own.
  • Same change against the new base. git diff 31096af8 8929099e (reviewed) and git diff d57d6eed 7b8d110d (now) list the same 48 files, +1492 / −120. File by file, the added and removed lines are identical in 47 of them, content/docs/references/data/hook.mdx and packages/spec/authorable-surface/data.json included.
  • The one file that differs, packages/spec/dropped-refinements.baseline.json: only the two measured counters, because main moved them. Before: 266 → 267 schemas, 1114 → 1120 sites. Now: 268 → 269, 1116 → 1122. The PR's own increment is the same (+1 schema, +6 sites), and the site lines it adds are unchanged (manifest.hooks.element.texts.valueType and its siblings).
  • Gates at this head: check-runs on 7b8d110d…: 72 runs, 60 success, 12 skipped, 0 failed. Lint & Repo Gates, TypeScript Type Check, Check Changeset, Spec property liveness, Dogfood Regression Gate and Build Docs are all success; the baseline gate in the spec build accepted the recomputed counters. git merge-tree --write-tree against today's origin/main 8bc08084 is clean.

The verdicts 6937770388 and 6939309851 stand for everything outside this delta.

Owed after this

  • L2: owed, CONTRACT_REVIEW_TIER, on this head. This delta is a merge plus regeneration, so a Regen-provenance: continuation of a record on 8929099e is the L2 seat's call.
  • Landing tier: spec face, handed to the seat for Tier H. The area reads 0 of 48 paths governed in a built tree (6940452806); this container did not re-measure it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 7b8d110 · 2026-11-17T06:19Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 7b8d110d6c524f77f7a808dd227b8b10039644da
Local-runs: none
Scope: packages/spec/src/data/hook-refusal-codes.ts, packages/spec/src/data/hook.zod.ts, packages/spec/src/system/i18n-resolver.ts, packages/spec/src/system/translation.zod.ts, skills/objectstack-data/references/_index.md, skills/objectstack-platform/references/_index.md + packages/runtime/src/sandbox/hook-text.ts, packages/runtime/src/sandbox/body-runner.ts, packages/runtime/src/sandbox/quickjs-runner.ts, packages/runtime/src/sandbox/script-runner.ts, packages/runtime/src/sandbox/hook-refusal-catalogue.ts, packages/runtime/src/app-artifact-handlers.ts, packages/core/src/organization-locale.ts, packages/services/service-automation/src/plugin.ts, packages/lint/src/i18n-walk.ts, packages/lint/src/validate-hook-refusal-templates.ts, packages/lint/src/validate-translation-references.ts
Security-touching: yes

Delta record over 6939428411 (PASS on 8929099e). Since that head the branch carries two commits: 5e336193, a merge of main d57d6eed, and 7b8d110d, a regeneration on the merged tree. Inputs read: the git objects of both heads and both bases, record 6939428411, the lane's announcement 6940452806, the PR body and labels, and the 72 check-runs on this head (60 success, 12 skipped, none failed, none pending). The rest of the diff is the lane seat's ACCEPT at TIER_DEFAULT (6940472422 on this head).

① Derived judgments

The lane's claim, read from the git objects: git diff 31096af8 8929099e and git diff d57d6eed 7b8d110d list the same 48 paths with the same status, +1492 / -120 each. Compared file by file, the added and removed lines are identical in 47 paths. One path differs:

  • packages/spec/dropped-refinements.baseline.json: only the two measured counters. Before: 266 to 267 schemas, 1114 to 1120 sites. Now: 268 to 269, 1116 to 1122. Main moved its own header to 268 / 1116 by adding two entries (ui/RecordActivityProps, ui/RecordChatterProps, one site each). The PR's own increment is unchanged: one entry (data/HookText) and six sites. Right.

Five blobs moved between the two heads; in every one the movement from 8929099e to 7b8d110d is line for line main's own change from 31096af8 to d57d6eed:

So the accept sets, exports and key spellings judged in 6939428411 are the ones on this head. Its ① judgments hold as written and are not re-reviewed here.

② Semver level

Unchanged. Clause-②: yes (widening), Metadata-protocol: added and Skills-docs: follow-up #34546 read the same on the PR body, and the changeset blob is the one judged at 8929099e. Main's change to hook.zod.ts is prose on keys this PR does not touch, so it adds nothing to what this PR publishes. Check Changeset concluded success on this head.

③ Boundary flags

  • Every flag and open question answered in 6939428411 stands: no file that answer rests on moved in the PR's own hunks.
  • Baseline header: the gate is packages/spec/scripts/dropped-refinements.test.ts ("its header totals match its body"), which requires publishedSchemasWithDroppedRefinements to equal the entry count and droppedRefinementSites to equal the sum of sites lengths. Counted from the blob at this head: 269 entries, 1122 sites, equal to the header. Every Test Core shard concluded success. Entry bodies: the only body lines this PR adds are the same six site lines and the data/HookText entry as at the old head; no other entry differs from main's. The site-by-site check against the built schemas is build-schemas.ts, which the spec build runs; Build Core concluded success.
  • Regenerated artifacts: check:authorable-surface and check:docs run in Type Check · source gates, which concluded success, as did Build Docs and Lint · docs & code guards. Both files also equal a plain text merge of main's change and the PR's.
  • The security label is on the PR (labels read: documentation, size/xl, tests, tooling, security, protocol:data, protocol:system). Security-touching: yes is meant, for the reason 6939428411 gives: the capability-free host bridge behind ctx.text. Nothing in this delta changes that reading.
  • The lane's account (6940452806) says the diff is line for line the reviewed one outside the baseline header, authorable-surface/data.json and hook.mdx. Read from the tree, the PR's own lines in those two generated files are also identical; only the header differs. The account is accurate and slightly conservative.
  • SQL push-down: no code moved; no new id materialisation and no in-app join.
  • origin/main is five commits past d57d6eed; none touches any of the 48 paths.

④ Design judgment

No must-fix, no should-fix.

packages/spec/src/data/hook.zod.ts. The PR's texts key, HookTextSchema and refuseUndeclaredLiteralTextKey compose with main's change exactly as before: same strictObject shape and alias rows, same object-level check chain, same describes. Main's edit is confined to HookContextSchema.provenance prose about what the audit writer records. No sentence of the PR's JSDoc or describes speaks of provenance, the audit writer or performedBy, so none is made false. Main's #34503 (a before* hook's ctx.api writes now roll back with the write) was also read against the texts JSDoc: its example writes through ctx.api and makes no claim about commit or rollback, and ctx.text reads through the settings and i18n services, not ctx.api. Main changed no source file under packages/runtime/src/sandbox, packages/lint/src, packages/core/src/organization-locale.ts or packages/spec/src/shared between the two bases, so the first consumer is the code 6939428411 read.

packages/spec/src/data/hook-refusal-codes.ts, packages/spec/src/system/i18n-resolver.ts, packages/spec/src/system/translation.zod.ts, both skills _index.md files, and every implementing file after the +: blobs identical to 8929099e. The 6939428411 judgments hold. The two index lines still state the export list of hook.zod.ts, to which main added no export.

Nits N1 to N5 of 6939428411 stand unchanged, each with the disposition recorded there. No new nit.

Implemented-by: claude/project-thread-l1nf08
Reviewed-by: session_01ADHkmP44onN8RMzsPMqjRq

VERDICT: PASS

@objectstack-fleet

objectstack-fleet Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA

Seat record · 2026-11-17T06:24Z · Head-sha: 7b8d110

维护者速读

  • 改了什么:钩子可以声明自己写进记录、给人读的句子(texts),运行时用 await ctx.text('key', { … }) 取,按组织语言给出:Localization 设置里有人设过就用它,否则用应用的 i18n.defaultLocale;从不按触发保存的那个人的语言。翻译包接受 hooks.<hook>.texts.<key>.message。
  • 为什么改:HotCRM 的线索/工单钩子把「Follow up with qualified lead: …」这类英文句子写进任务标题,中文、日文组织里大家读到的都是英文;hooks and actions: a sentence a hook or action writes into a record is picked in the organization's language, as a declared hook refusal is (sibling of #34062, ruling B parameter 7) #34374 的裁定 B 第 7 项要求它和已声明的钩子拒绝语走同一规则。
  • 风险与回滚:纯放宽(Clause-②: yes (widening)),没声明 texts 的钩子行为不变;缺译文时写声明原文,不失败;只有 Localization 设置读不出来(不是「未注册」)时那一次 ctx.text 被拒。回滚即撤回本 PR。
  • 先看:packages/runtime/src/sandbox/hook-text.ts(取语言、选译文、填洞),然后 packages/spec/src/data/hook.zod.ts 的 texts 与保存期检查。
  • 两分钟验证:pnpm --filter @objectstack/runtime exec vitest run src/sandbox/hook-text.integration.test.ts,预期 11 条全过。
  • 需要你做的:用 os-zhuang 审读并批准这个契约放宽(碰 packages/spec)。契约复审 PASS 6940533319,钉在 Head-sha 7b8d110d6c524f77f7a808dd227b8b10039644da。批准在案后由席位翻 ready,经合并队列落地。本卡的动作那一半在 PR2,排在 actions: an action body has no refusal catalogue — a person-facing throw from an action stays in the author's language #34273 合并之后。

席位意见:同意合并。有 HotCRM 实测拉动,新键只在声明时生效,失败方向是写出声明原文,不会写空或报错。

席位核对

  1. 形态:48 个文件(含生成物),+1492/−120,Part of #34374;Clause-②: yes (widening),Metadata-protocol: added,Skills-docs: follow-up #34546。
  2. 前提实测:卡线程在本 PR 前实测了 HotCRM 钩子写英文标题;集成测试 11 条覆盖取语言、选译文、缺译文、译文渲染不了回落到声明句和读不出设置五种情况。
  3. 门禁 check-runs:head 7b8d110d 上 72 条,60 绿、12 跳、0 红;mergeable clean。check-governed-merges 在建好的树上读 NOT governed(两份 skills/**/references/_index.md 是生成物,豁免);契约复审提醒合并队列的守卫没有生成器,在那里这两份仍算受管,所以无论如何按交人处理。
  4. 接受的偏差:L1-b2 ACCEPT 6940472422(合 main 后的 delta,逐行与已审 head 相同;前序 6939309851)。契约复审 PASS 6940533319(前序 6939428411),无 must-fix/should-fix;N1、N2 记为接受的偏差。复审标了 Security-touching:沙箱钩子新增读组织语言的宿主桥,未见泄漏,已挂 security 标签。
  5. 范围外去向:N3 → cli i18n-coverage: the hook bucket is labelled "hook refusals" but now also counts missing hook texts #34670(覆盖报告把钩子桶叫「hook refusals」,已敲分诊);技能教学 → skills: teach hook texts and ctx.text in the automation and i18n skills #34546。
  6. 落地条款:os-zhuang 授权批准在案后,席位翻 ready,经合并队列落地;Part of,卡不自动关,PR2 合并后再关。

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 17, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 17, 2026 06:26
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 17, 2026
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 17, 2026
Merged via the queue into main with commit 11e0441 Nov 17, 2026
84 of 85 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-l1nf08 branch November 17, 2026 06:58
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 protocol:data protocol:system security size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants