Skip to content

feat(runtime): a sandboxed body can do time-zone date maths, through Intl.DateTimeFormat - #29031

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

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-n1omdg

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #28898

Clause-②: no
No published schema, type, export or error code moves. The one packages/spec change is the job handler key's .describe() text (and the reference page regenerated from it); the accept set is identical. The sandbox's globals are not declared by any spec schema: ScriptBodySchema.source is a string, and what it may call is the runtime's answer, which is what changes here.

Metadata-protocol: none
What a metadata author can write is unchanged: no key, value, type or default moves. A body source that calls Intl.DateTimeFormat was already accepted at every door; it now runs instead of throwing ReferenceError.

维护者速读

  • 改了什么:沙箱(QuickJS)里有了 Intl.DateTimeFormat,完整的一整个构造器(format/formatToParts/formatRange/formatRangeToParts/resolvedOptions/supportedLocalesOf),结果由服务器自己的 Intl 算出,所以 IANA 时区和夏令时边界与服务器一致。Intl 的其它成员都不存在。钩子、动作、作业三种 body 共用同一个 runner,所以三者同时获得。os build 的降级判断随之按成员判:只用 Intl.DateTimeFormat 的 handler 现在能降级成 body,用 Intl.NumberFormat 等仍打包。作业 handler 的弃用说明补了一句"时区日期计算可用 Intl.DateTimeFormat 迁到 body"。
  • 为什么改:duly#147 的派单作业要按每个职责自己的时区算当前周期,沙箱没有 Intl,作业就离不开已弃用的 handler。席位裁定走纯运行时路线,不给 ctx 加日期助手,作业上下文契约不动。
  • 风险与回滚:跨边界只有纯值(一个 JSON 字符串 + 最多两个毫秒数进,一个 JSON 字符串出,在沙箱内解析),桥是闭包参数而非全局,"现在"取沙箱自己的 Date.now(),无新 I/O。回滚即 revert,无数据迁移。
  • 先看:packages/runtime/src/sandbox/sandbox-intl.ts(垫片与宿主侧的值清洗、错误转译);packages/cli/src/utils/detect-free-identifiers.ts 的 MEMBER_JUDGED_GLOBALS 与 collectReferences 的成员分支;packages/cli/src/utils/sandbox-globals-probe.test.ts 的点号探针。
  • 两分钟验证:pnpm --filter @objectstack/runtime exec vitest run src/sandbox/sandbox-intl.test.ts,预期 Tests 12 passed (12)。
  • 需要你做的:无,席位落地。

What changes

  • packages/runtime/src/sandbox/sandbox-intl.ts (new): installSandboxIntl(vm) installs globalThis.Intl (non-enumerable, like the built-in) with one member, DateTimeFormat: callable with or without new, supportedLocalesOf, and the whole prototype (format as a bound getter, formatToParts, formatRange, formatRangeToParts, resolvedOptions, Symbol.toStringTag). The VM-side constructor keeps only a plain-value snapshot of locales and of the option keys DateTimeFormat reads; every call asks the host to answer with a host Intl.DateTimeFormat built from that snapshot (a per-invocation cache of at most 64 formatters, dropped with the VM).
    • In: an op name, ONE JSON string, at most two numbers. The host re-reads the JSON and keeps only the known option keys with primitive values.
    • Out: one JSON string, parsed inside the VM, so resolvedOptions() and the parts arrays are VM objects. A host error becomes a VM RangeError / TypeError with the host's message: the body's own throw, never a host refusal relayed.
    • The bridge is a closure argument of the shim (no global), and the shim captures JSON, Date.now and friends at install, so a body replacing them cannot steer the host. format() with no argument takes "now" from the VM's own clock.
  • packages/runtime/src/sandbox/quickjs-runner.ts: execute() calls installSandboxIntl(vm) right after installCtx. Every body kind (hook, action, job, and the L1 expression path) goes through execute(), so this is one seam and one global set.
  • packages/cli/src/utils/detect-free-identifiers.ts: the measured allowlist learns member granularity. New MEMBER_JUDGED_GLOBALS = {'Intl'}; collectReferences records a non-computed Intl.NAME read as Intl.NAME; SANDBOX_GLOBALS gains Intl.DateTimeFormat; NODE_ONLY_GLOBALS swaps Intl for the ten other Intl members Node 22 has. A bare Intl use (const I = Intl, Intl[k]) or an unlisted member is reported host-only, so that handler stays bundled (the safe direction). A local or parameter named Intl still binds it.
  • packages/cli/src/utils/extract-hook-body.ts: the host-only refusal sentence says "of Intl it provides Intl.DateTimeFormat only" when an Intl name is refused, and "would throw" where it said "would throw ReferenceError" (a missing member throws TypeError).
  • packages/spec/src/system/job.zod.ts: the handler docblock and .describe() (the deprecation message) say time-zone date maths moves to body through Intl.DateTimeFormat. content/docs/references/system/job.mdx regenerated (gen:schema && gen:docs).
  • content/docs/automation/jobs.mdx: one bullet under "What running in the sandbox means": Intl.DateTimeFormat is there whole, nothing else of Intl is, the feature test, and that hook and action bodies share it.
  • .changeset/28898-sandbox-intl-date-time-format.md: @objectstack/runtime, @objectstack/cli, @objectstack/spec patch; both declaration lines.

Tests

  • New packages/runtime/src/sandbox/sandbox-intl.test.ts (12, real QuickJS). Every expected value is computed with the host's Intl in the test, never a literal (CI's ICU differs from a container's).
    • The card reproduction: formatToParts of two instants either side of New York's 2026-03-08 spring-forward, in America/New_York and Asia/Shanghai, equals the host's (anti-vacuity: the zone name changes in New York and not in Shanghai).
    • format, resolvedOptions, formatRange, formatRangeToParts equal the host's; the period-start shape (calendar date of one instant in two zones: 2026-03-08 vs 2026-03-09); callable without new, bound format getter, instanceof, both toStringTags, supportedLocalesOf; options read at construction.
    • Errors: an invalid timeZone throws the host's RangeError text as a VM RangeError (and uncaught, fails the run with that text); format(NaN), formatRange(0), formatToParts('not a date') throw what the host throws.
    • Absent, not half-working: Object.getOwnPropertyNames(Intl) is ['DateTimeFormat'], typeof Intl.NumberFormat is 'undefined', Intl is not enumerable.
    • Isolation: answers are VM-made (Object.prototype / Array.prototype), fresh per call; no global named like the bridge; a foreign receiver throws TypeError; replacing JSON.stringify / Date.now steers nothing.
    • One seam: a hook body and an action body answer the same. Through the job door: a jobBodyRunnerFactory job reports period 2026-03-09.
  • New packages/qa/dogfood/test/job-body-time-zone-date.dogfood.test.ts (1): a booted stack declares a job whose body inserts each zone's calendar date of one instant; the job service triggers it, and GET /data/tzj_period reads both zones' own dates (anti-vacuity: the two dates differ; the job is listed as scheduled first).
  • cli: detect-free-identifiers.test.ts (+3: Intl.DateTimeFormat has no free name; the bare namespace is reported; an unlisted member is reported), extract-hook-body.test.ts (+1: a handler using Intl.DateTimeFormat lowers), hook-body-lowering.test.ts (+1: no finding for it), sandbox-globals-probe.test.ts (dotted names probed as namespace-then-member; +1: every member-judged namespace measures present and owns every dotted member). The objectstack build lowers an inline hook handler that references Intl into the QuickJS body — detect-free-identifiers allowlists host globals the sandbox does not provide, so the handler passes validate/typecheck/test/build and throws ReferenceError in production #14301 refusal pins move from Intl.DateTimeFormat to Intl.NumberFormat, a member the sandbox still lacks, so the class stays pinned.
Red first, green, ablations
  • Red on base a3640933 (new runtime test, unchanged source): Tests 12 failed (12), each ReferenceError: 'Intl' is not defined (the hook case: hook 't' threw: ReferenceError: 'Intl' is not defined).
  • Green: src/sandbox/ Test Files 35 passed (35), Tests 341 passed (341).
  • Ablation, runtime (scripts/ablation-replace.mjs, anchor installSandboxIntl(vm); hit once, blob f779c2c2 to 8af3c789; the test imports src): Test Files 1 failed | 34 passed (35), Tests 12 failed | 329 passed (341): exactly the 12 Intl cases. Restored: blob f779c2c2 == HEAD, git diff HEAD empty.
  • Ablation, cli (anchor 'Intl.DateTimeFormat', deleted from SANDBOX_GLOBALS, the four files, all src): Tests 4 failed | 136 passed (140): the three new lower-it pins and the named-cases pin. The partition pin stays green, as it must: a name removed from a set is no longer probed, which is why the named-cases pin exists. Restored: blob 7df744bf == HEAD, git diff HEAD empty.
  • Dogfood, red leg on a rebuilt dist (call replaced by void installSandboxIntl;, blob f779c2c2 to a8815ee9; pnpm --filter @objectstack/runtime build; ablation-dist-preflight "marker absent from all 12 built files"): Tests 1 failed (1), the job logged job 'tzj_period_stamp' threw: ReferenceError: 'Intl' is not defined and the read was {}. Restored: blob == HEAD, git diff HEAD empty; restore leg rebuilt, preflight "marker present in 2 built files", "working tree clean against HEAD", Tests 1 passed (1).

Acceptance notes

  • Hook and action bodies share the runner (measured: every production call site of hookBodyRunnerFactory, actionBodyRunnerFactory and jobBodyRunnerFactory, in app-plugin.ts and app-artifact-handlers.ts, hands the body to a QuickJSScriptRunner, one class in separate instances, and QuickJSScriptRunner.execute() is the only place a VM is made; git grep "new QuickJSScriptRunner" outside tests: 5 hits, all those factories), so they get the same Intl.DateTimeFormat, as the order rules. The L1 expression path goes through execute() too.
  • Why the cli moved in this PR. sandbox-globals-probe.test.ts measures the sandbox's globals against the lowering allowlist, so the runtime change alone reds it (Intl measures present). Moving Intl wholesale to the sandbox set would have lowered a handler using Intl.NumberFormat into a body that throws, the objectstack build lowers an inline hook handler that references Intl into the QuickJS body — detect-free-identifiers allowlists host globals the sandbox does not provide, so the handler passes validate/typecheck/test/build and throws ReferenceError in production #14301 failure class; leaving it host-only would keep printing "Intl is not provided by the sandbox", which this change makes false. Judging per member is the smallest honest change, and it is why DateTimeFormat is whole: a lowered handler calling formatRange must not throw where the in-process one works.
  • Published value change (cli hook-body subpath). HookBodyExtractionError.freeIdentifiers / nodeOnlyIdentifiers now name the member (Intl.NumberFormat) where they named Intl; the error's shape and members are unchanged (published-subpath-hook-body.pin.test.ts green). The refusal sentence's host-only branch changed as listed above; the module-scope sentence the docs quote is byte-identical (its pin is green).
  • What a body can learn. new Intl.DateTimeFormat().resolvedOptions() reports the server's default locale and time zone, which a body could not read before. Values, not objects; noted for the seat, not treated as a leak.
  • Not done, out of scope. QuickJS's own Date.prototype.toLocaleString(locale, { timeZone }) exists and ignores its arguments; a handler using it lowers today and formats in the server zone. Not changed here (not class a/b/c with a measured reach). Dedupe words: toLocaleString timeZone sandbox ignored.
  • Overlap. Before opening: none of the 31 open PRs touches packages/runtime/src/sandbox/**, the four cli files, system/job.zod.ts or automation/jobs.mdx (file lists read per PR); search for quickjs, sandbox, detect-free-identifiers, Intl, job body, hook body among open PRs found no related one.

Verification

Run on aed5e295 (base a3640933). Each test command under os-verify-lock (VERDICT command-exit 0 unless stated).

Package suites, type checks, lint
  • Builds: pnpm --filter '@objectstack/cli^...' build exit 0; pnpm --filter '@objectstack/dogfood^...' build exit 0; pnpm --filter @objectstack/spec build exit 0.
  • pnpm --filter @objectstack/runtime test: Test Files 514 passed (514), Tests 8279 passed | 19 skipped (8298).
  • @objectstack/cli unit tier (vitest run --project unit): Test Files 366 passed, 2 failed for packages/cli is not built (the two published-subpath-*.pin files); after pnpm --filter @objectstack/cli build those two: Test Files 2 passed (2), Tests 29 passed (29). So 368 of 368 files green. The integration tier is declared to CI (no integration-tier file or spawn entry touched).
  • pnpm --filter @objectstack/runtime typecheck and pnpm --filter @objectstack/cli typecheck: exit 0, both check:test-typecheck: OK.
  • Dogfood: the new file Tests 1 passed (1) on the built dist. The full battery is not owed (no ! in the title, no narrowing arm).
  • eslint --no-inline-config over the eleven changed source and test files: exit 0.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands (derived on aed5e295 against merge base a3640933): 108 families, each run with timeout 900 bash -c CMD from /dev/null, exit captured before any pipe; record pm-orders/server/28898-gates-ran.txt (CMD :: exit N). Reconciled:

✓ dispatch-gates --ran: 108 derived famil(ies) accounted for — 108 run, 0 NOT-MEASURED (a DERIVED zero — all 108 recorded an exit code and none of them is 3).

All 108 exit 0, among them check:docs (235 generated files in sync), check:generated (All 14 generated artifacts are up to date), check:authorable-surface, check:api-surface, check:type-check-debt, check:nul-bytes, check:test-source-alias, check:i18n-coverage, check:dual-build-cjs-loads and check:skill-examples. A first pass on b4099da2 (before the dogfood file) read 104 at 0 and 4 at 3 (prerequisite not met: the plugin-teardown self-test needed its pinned commit fetched; the other three needed builds of packages outside this diff); the final pass above ran after git fetch --depth=1 of that commit and the dogfood closure build. Families CI owns (Test Core, the type-check lanes, pnpm lint) are read on this PR's check-runs.


Generated by Claude Code

…hrough plain values

Hooks, actions and jobs share the QuickJS runner, so all three get the
same global: the whole DateTimeFormat API (format, formatToParts,
formatRange, formatRangeToParts, resolvedOptions, supportedLocalesOf),
answered by the host's Intl from a plain-value snapshot of the locales
and options. Every other Intl member stays absent.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5paXMpX75J4HCKYU6Z
…ames Intl.DateTimeFormat

The sandbox now provides Intl.DateTimeFormat and nothing else of Intl,
so the free-identifier check reads a member reference as Intl.NAME:
Intl.DateTimeFormat lowers, every other member (and the bare name)
stays host-only and bundled. The globals probe measures the members.
The job handler deprecation text and the jobs guide say time-zone date
maths moves to body through Intl.DateTimeFormat.

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

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/cli, @objectstack/runtime, @objectstack/spec, touching 29 documentable anchor(s).

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

  • content/docs/automation/jobs.mdx (via formatRange (literal, a string literal in SHIM; a string literal in installSandboxIntl), formatRangeToParts (literal, a string literal in SHIM; a string literal in installSandboxIntl), formatToParts (literal, a string literal in SHIM; a string literal in installSandboxIntl), resolvedOptions (literal, a string literal in SHIM; a string literal in installSandboxIntl), timeZone (literal, a string literal in DATE_TIME_FORMAT_OPTION_KEYS))
  • content/docs/concepts/metadata-lifecycle.mdx (via JobSchema (symbol, a top-level const))
  • content/docs/getting-started/quick-reference.mdx (via JobSchema (symbol, a top-level const))
  • content/docs/protocol/kernel/i18n-standard.mdx (via timeZone (literal, a string literal in DATE_TIME_FORMAT_OPTION_KEYS))

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

  • content/docs/releases/v17/17-7.mdx (via JobSchema (symbol, a top-level const))

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
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 60 of 216 client-bound route-ledger rows — the other 156 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 156: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 101 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 — 180 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 ab085a048241b0bf1fde06696fc6cbf659a6707f → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json ab085a048241b0bf1fde06696fc6cbf659a6707f

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

@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 2, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: aed5e2959f15158dac89cb24d1f280486b42e628
Local-runs: none
Scope: packages/spec/src/system/job.zod.ts + content/docs/references/system/job.mdx (regenerated from it), content/docs/automation/jobs.mdx (the sandbox claim the text makes), packages/runtime/src/sandbox/sandbox-intl.ts and packages/runtime/src/sandbox/quickjs-runner.ts (the capability the text asserts), packages/cli/src/utils/detect-free-identifiers.ts, packages/cli/src/utils/extract-hook-body.ts and packages/cli/src/utils/sandbox-globals-probe.test.ts (the lowering claim), .changeset/28898-sandbox-intl-date-time-format.md

Reviewed: the net diff of aed5e295 against merge-base a3640933 (3 commits, 14 files, +860/−33), card #28898 with triage 6568654195, the claim 6569189598 and the os-dev-report 6570529017, the PR body, and the head's check-runs. Nothing was built, run or re-run; the PR was read from the fetched objects, no worktree.

① Derived judgments

Schema face (the hits path). packages/spec/src/system/job.zod.ts changes one .describe() string and its docblock on JobSchema.handler; the Zod chain (z.string().optional()) is byte-identical. Accept set unchanged: right. content/docs/references/system/job.mdx carries the same sentence (one row, the handler cell); no other committed artifact held the old text, so the regeneration is complete: right. The sentence asserts a runtime fact ("Intl.DateTimeFormat with a timeZone option is available in the sandbox (nothing else of Intl is)"); read against sandbox-intl.ts it is true on this head (one own member, DateTimeFormat, Intl non-enumerable, the constructor whole). Prime Directive 10's corollary (never advertise what the runtime does not deliver) holds.

Sandbox safety — the main question. Read sandbox-intl.ts and the execute() seam in quickjs-runner.ts line by line.

  • What crosses, in. The VM-side shim calls host(op, stringify({ l, o }), a, b): op is a shim-chosen literal, the JSON string is produced by JSON.stringify captured at install, a/b pass through Number() (or undefined, which the shim replaces with the VM's own Date.now() for format/formatToParts and leaves undefined for the range calls, so the host sees exactly what it would see natively). The host reads them with vm.getString and vm.dump on number handles; nothing is retained. readSnapshot re-parses the JSON on the host and copies only the twenty ECMA-402 option keys with primitive values into a fresh object, and accepts locales only as a primitive or an array of primitives. No body-chosen key is ever assigned on the host (__proto__ in the JSON cannot land anywhere), and no VM object is handed to the host Intl. Right.
  • What crosses, out. One vm.newString(JSON.stringify(answer)); answer is { ok, value } or { ok: false, name, message }. value is a string, a parts array, a resolved-options object or a locale list — all JSON-plain. The VM parses it with the captured JSON.parse, so every object a body receives is VM-made (pinned by the isolation test: Object.prototype / Array.prototype, fresh per call). No host object, function, prototype or error object reaches the VM: verified.
  • The bridge. host is passed as the one argument of the shim factory and the host-side handle is disposed after install; the VM function survives only inside the shim's closure. No global names it (pinned: the only /intl|bridge/i global is Intl). A body cannot reach it through caller/arguments.callee (strict shim). Verified.
  • Host errors. Everything in the callback, vm.getString included, is inside one try; the catch forwards only name (whitelisted to RangeError/TypeError, else Error) and message as strings. The VM constructs its own RangeError/TypeError/Error from the message, so the stack a body sees is the VM's. No host stack, path or object leaks. The messages are the host's own ICU sentences (e.g. the invalid-zone text), which is what the order asked for. Right.
  • Unbounded host work. A sync host callback runs inside the VM slice, so its time is charged to the body's CPU budget by the next interrupt check (cpuMs + (now − sliceStart)), and the wall ceiling backs it. Input size is bounded by the VM memory cap (32 MB default): a huge locale string or option value reaches the host once, costs O(n) and is refused by ICU with a RangeError before it is cached; a long but valid locale array costs the host O(n) canonicalisation per call, bounded by the same budget. formatRange is two numbers in, one string out. The per-invocation formatter cache is keyed by the raw snapshot and capped at 64 entries, cleared wholesale and dropped with the VM; its worst case is 64 × (a snapshot that fits the VM heap), reachable only by a body that spends its own CPU budget building distinct multi-megabyte valid snapshots. Bounded by the existing limits; no new amplification class. Right, with one note under ③.
  • Clock and I/O. "Now" is the VM's Date.now captured at install (pinned: a body replacing Date.now or JSON.stringify steers nothing). Formatting performs no I/O. Right.
  • The L1 path. installSandboxIntl runs before the expression branch, so L1 expressions get it too; the host call is synchronous, so a sync expression can use it. Consistent with "every body kind".
  • supportedLocalesOf and resolvedOptions. Both answer values only. A default-constructed formatter's resolvedOptions() reports the host's default locale and time zone (the dev's own flag). Judged acceptable, and the default should NOT be pinned in this PR — see ③ for the recommendation and its reasons.

No sandbox-escape-class finding. No private record was written.

One seam. QuickJSScriptRunner.execute() is the only place a VM is made; every production new QuickJSScriptRunner (five sites: app-plugin.ts ×2, app-artifact-handlers.ts ×3) is wrapped by hookBodyRunnerFactory, actionBodyRunnerFactory or jobBodyRunnerFactory; the only other ScriptRunner implementor is UnimplementedScriptRunner, which throws. So hook, action and job bodies (and L1 expressions) share the global set — the order's conditional ("if they share it, they get the same, and say so in the changeset") is met, and the changeset, the PR body and jobs.mdx each say so in words. Honest and intended. Right.

CLI lowering (detect-free-identifiers.ts, extract-hook-body.ts). Needed: sandbox-globals-probe.test.ts measures the real sandbox against the two sets, so with Intl now present the base's NODE_ONLY_GLOBALS entry Intl would red the partition pin, and moving Intl wholesale into SANDBOX_GLOBALS would lower a handler using Intl.NumberFormat into a body that throws (TypeError now, not ReferenceError) — the #14301 class. Judging per member (MEMBER_JUDGED_GLOBALS = {Intl}; a non-computed Intl.NAME read is recorded as Intl.NAME; a bare or computed use stays reported as Intl, the bundling direction; a local named Intl binds its members through the root) is the smallest correct change, and the probe test now measures the namespace present and every dotted member under a listed namespace. Right.
Behaviour of an existing handler after lowering: a handler that used only Intl.DateTimeFormat was bundled on the base and will lower on its next os build; because the sandbox answers with the host's own Intl.DateTimeFormat, its output, its default locale and zone, and its errors are the in-process ones. The one divergence I can construct is a BigInt or Symbol passed as locales (the shim passes undefined where the host throws TypeError), which no real handler does. Date.prototype.toLocale* with a timeZone option is a method, not a free identifier, so such a handler lowered before this PR as well; the dev's out-of-scope note on it is accurate and not introduced here. Right.
Published cli hook-body subpath: HookBodyExtractionError's members, types and readonly-ness are unchanged (published-subpath-hook-body.pin.test.ts asserts exactly kind, originLabel, freeIdentifiers, nodeOnlyIdentifiers); only the values can now be a dotted spelling (Intl.NumberFormat). The module-scope refusal sentence that the docs quote is byte-identical; the host-only branch gained a parenthesis and dropped the word ReferenceError, and nothing in content/docs or the tests quotes that branch. Right.

Metadata and migration text. jobs.mdx gains one bullet; the example passes timeZone; the feature test it names is the one the order asked for. Right.

② Semver level

  • Changeset: @objectstack/runtime patch, @objectstack/cli patch, @objectstack/spec patch, with Clause-②: no and Metadata-protocol: none on the PR body and in the changeset body. Matches.
  • Clause-②: no is right: no exported name, type, schema shape or error code moves. The sandbox's globals are not a published accept set — ScriptBodySchema.source is z.string() and no spec schema declares what it may call — so a body gaining a global is runtime capability, as the order expected. The cli subpath value change (a diagnostic string array that can now carry Intl.NAME) is a value, not a member or a type; the shape pin is green, and the changeset names the change in words. Not a widening of a published surface.
  • Metadata-protocol: none is right: no key, value, type or default moves; handler stays accepted and deprecated; the text change ships as description. none takes patch; spec patch is the floor for shipped description text.
  • No BREAKING banner, no ADR-0087 disposition owed.

③ Boundary flags

  • Dev flag 1 (open_questions is empty; carried in out_of_scope_findings): a default-constructed formatter's resolvedOptions() tells a body the server's default locale and time zone. Answered: acceptable as values; recommend NOT pinning the default to UTC or en-US. Reasons: (a) the order's contract is "behaves as the host's for the same input", and the cli now lowers a handler on the strength of that equivalence — a pinned default would make a lowered handler answer differently from its in-process original; (b) the sandbox's own Date already runs in the host's local zone (QuickJS resolves the offset through the host, which is why toLocaleString formats in the server zone, as the dev observed), so a pinned Intl default would give a body two different "default zones"; (c) the zone was already derivable from new Date().getTimezoneOffset(), and the default locale is deployment configuration, not a secret. Determinism across hosts is the author's to declare by passing timeZone (and a locale), which every example in this PR does. Follow-up, not blocking: one sentence in jobs.mdx saying the default locale and zone are the server's, so always pass timeZone.
  • Dev flag 2: Date.prototype.toLocaleString(locale, { timeZone }) ignores its arguments in QuickJS. Pre-existing, outside this diff, no measured reach; noting it is the right disposition under Prime Directive 10 (a note, since there is no reproduced defect at a public door yet). Not escalated.
  • Cache memory note (mine, not blocking): the formatter cache is keyed by the raw snapshot string; a hostile body can hold up to 64 distinct valid snapshots on the host for the life of one invocation, each bounded by the VM heap and paid for in its own CPU budget. Existing limits bound it; a smaller key or cap would only tighten a bound that already exists.
  • Evidence read, not re-run (read-only shape). Red on base: all 12 new runtime cases evaluate Intl inside the VM, so 12/12 ReferenceError: 'Intl' is not defined on a3640933 is the only possible reading, consistent with the report. Ablations: the runtime ablation count (12 red of 341) matches the file; the cli ablation's four names (the three lower-it pins plus the named-cases pin) are exactly the tests that assert Intl.DateTimeFormat lowers or is in SANDBOX_GLOBALS, and the dev's explanation of why the partition pin stays green is correct (a name in neither set is not probed, which is why the named-cases pin exists); the dogfood red leg on a rebuilt dist is described with its preflight markers both ways. Derived gates: 28898-gates-ran.txt holds 108 lines, 108 at exit 0, and the report's --ran line reads 108/108 with 0 NOT-MEASURED. Consistent.
  • CI on the head at review time: 24 success, 12 skipped, 31 in_progress (Test Core 1–8, Type Check lanes, Build Core, Test UI, Live E2E UI), 0 failed. Governed Surface Queue Guard, Check Changeset, Lint · PM dispatch-gates, Dogfood Regression Gate are success. The seat reads the check-runs again before enqueue; the landing's check-② is not this record's to grant.
  • Overlap: 0 of the 44 open PRs touch packages/runtime/src/sandbox/**, the cli lowering files, system/job.zod.ts, automation/jobs.mdx, references/system/job.mdx or the dogfood file. None.
  • Author: PR user.login is objectstack-fleet[bot]; no author note owed.
  • Governed surfaces: none touched (no .claude/**, docs/adr/**, workflows, AGENTS.md).

Implemented-by: claude/project-thread-n1omdg
Reviewed-by: session_0186vfjHHMsRXC9EUT9hTFMo

VERDICT: PASS


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo

席位核对

ACCEPT · domain:server seat 2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo · 2026-11-02T06:32Z · head aed5e295 · claimed by seat 2 on #28898

The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」.

  1. Shape:
  2. Contract review at CONTRACT_REVIEW_TIER: PASS on this head (6570714011).
    • The sandbox bridge passes only plain values, and host work is charged to the body's budget.
    • One seam serves hooks, actions and jobs, as the order allowed.
    • The CLI's per-member Intl judgement is needed.
    • The default resolvedOptions() stays the host's answer. A docs sentence, "always pass timeZone", is a follow-up and does not block.
  3. File surface wider than the claim: the CLI lowering files are forced by the sandbox-globals probe, and the review accepts them.
  4. Gates: CI on this head showed 33 success, 12 skipped, 0 red and 23 still running at the time of this ACCEPT. Auto-merge waits for them, and the merge queue re-runs CI against current main.
  5. Serial: none. No open PR touches these files.
  6. Landing: pr_ready + automerge_enable through the relay.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 06:33
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 2, 2026 06:34
@objectstack-fleet objectstack-fleet Bot removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 2, 2026
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 97ca257 Nov 2, 2026
74 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-n1omdg branch November 2, 2026 07:34
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo

Landing record · PR #29031

domain:server seat 2 · session_0186vfjHHMsRXC9EUT9hTFMo · 2026-11-02T07:44Z · card #28898

Reading Probe Result
Merged PR #29031 state merged, squash commit 97ca25707
On main git merge-base --is-ancestor 97ca25707 origin/main yes
Queue refs git ls-remote origin refs/heads/gh-readonly-queue/* matching 29031 0
Content git grep -c installSandboxIntl origin/main -- packages/runtime/src/sandbox/quickjs-runner.ts present

Release: ships patch for runtime, cli and spec at the next release.


Generated by Claude Code

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:system size/l 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.

Job body sandbox has no Intl, so a job that needs time-zone date maths cannot migrate from the deprecated handler key to body

1 participant