Skip to content

feat(runtime): flow and permission-set clone answers name their notice by a stable noticeCode - #29823

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

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

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread
Refs #29727 (leg 1, server. Leg 2, the Console mapping, belongs to the ui lane, so this PR does not close the card.)

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:流程与权限集的"新建类似"克隆应答在原有英文 notice 旁新增 noticeCode;流程固定一个码,权限集按落点三种变体各一个码。
  • 为什么改:控制台此前只能原样显示英文句子,中文界面看到英文;有了码,控制台可映射成自己的翻译,未知码仍回退 notice。
  • 风险与回滚:只加键,notice 字节不变(测试逐字钉住);回滚即撤销本 PR,旧控制台忽略新键。
  • 先看:packages/runtime/src/domains/permission-set-clone.ts(码与句子共用同一落点分类)、packages/runtime/src/flow-clone.ts、packages/runtime/src/domains/automation.ts(克隆应答那一行)。
  • 两分钟验证:pnpm --filter @objectstack/runtime exec vitest run src/domains/permission-set-clone.test.ts,预期全绿,含三个变体的码与原句逐字比对。
  • 需要你做的:无,席位落地。

Why

Both "New similar" clone answers carried only an English notice, which the Console prints verbatim, so a zh-CN screen showed English (#29727, from #29706 row 1). A server sentence reaches the Console translated by code: the Console maps a known code to its own key and keeps the wire text for an unknown one. This PR gives both sentences that code.

What changes

  • Flow clone door (POST /api/v1/automation/:name/clone). The answer carries data.noticeCode: 'FLOW_CLONE_DISABLED_COPY' beside the unchanged FLOW_CLONE_NOTICE. The code is exported as FLOW_CLONE_NOTICE_CODE next to the sentence in flow-clone.ts. The key is the optional one CloneFlowResponseSchema already declares (automation-api: CloneFlowResponseSchema declares an optional noticeCode beside notice, so the Console can translate the flow "New similar" notice #29758 / feat(spec): CloneFlowResponseSchema declares an optional data.noticeCode beside notice #29779), so no spec file moves, and the client's CloneFlowResponse type already carries it.
  • Permission-set clone door (POST /api/v1/security/permission-sets/:name/clone, server-only, no spec schema). permissionSetCloneNotice composes three sentences, so there is one code per variant: PERMISSION_SET_CLONE_ENVIRONMENT_WIDE, PERMISSION_SET_CLONE_IN_PACKAGE and PERMISSION_SET_CLONE_IN_CREATED_PACKAGE. No parameter key is needed, because the one value the sentence carries, the package, is already on the answer as data.package. A single permissionSetCloneLandingKind(landing) sorts a landing into its variant, and both the sentence and permissionSetCloneNoticeCode(landing) (through the exported PERMISSION_SET_CLONE_NOTICE_CODES table, keyed by that kind) are chosen from that one answer, so code and sentence cannot drift.
  • notice is unchanged on both doors, byte for byte, and stays the English fallback.
  • Route ledger. The two clone rows in route-ledger.ts now spell their data as { flow, packageId, notice, noticeCode } and { permissionSet, package, notice, noticeCode }.
  • Docs. content/docs/permissions/permission-sets.mdx names noticeCode in the permission-set clone answer, with one clause saying what it is for (claim amendment on runtime: the flow and permission-set "New similar" clone notices carry a code, so the Console can translate them (zh-CN shows English today) #29727, after the docs drift check). Nothing else on that page changed.
  • Changeset. @objectstack/runtime patch.

Tests

  • domains/automation-flow-clone.test.ts: a new case asserts the answer's noticeCode is FLOW_CLONE_DISABLED_COPY, and as a CONTROL asserts notice equals the English sentence spelled out literally (not read off the constant), plus the answer's exact key set.
  • domains/automation-flow-clone-custom-package.test.ts (real protocol, registry and store): the answer carries the code, and CloneFlowResponseSchema.parse keeps it.
  • domains/permission-set-clone.test.ts: each of the door's landing cases asserts its code (created pair, reused pair, writable package, and the environment-wide CONTROL, which also keeps its notice). A new table pins every variant's code and its full sentence literally, so a change to notice while touching codes reds.
  • Dogfood over HTTP: automation-flow-clone-door.dogfood.test.ts and permission-set-clone-door.dogfood.test.ts assert the codes on the served answers (created pair, then reused pair).

Acceptance notes

  • The order asked to add the optional field to the Console's type for the permission-set answer if one exists. One does (ui/packages/app-shell/src/views/metadata-admin/permission-set-clone.ts, PermissionSetCloned), but ui/** is outside this card's claimed file surface, so it is left for leg 2, which reads the code there anyway.
  • The flow notice's Console type needs nothing: the client's automation.clone() returns CloneFlowResponse['data'], which already declares noticeCode.

Verification

Head db94ab0b. All code readings were taken at ecac38e6, which has the same tree as da10eb94 (only the commit message was reworded, to drop a card trailer the pre-push hook refuses). db94ab0b adds the one docs line on top of that. For the docs line, check:doc-authoring, check:doc-anchors, docs-audit/check-affected-docs, check-drift-comment and check:nul-bytes each exit 0 at db94ab0b. The lychee lane is CI's.

Unit tests: the three door suites 78/78, and the full runtime suite
  • pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/automation-flow-clone.test.ts src/domains/automation-flow-clone-custom-package.test.ts src/domains/permission-set-clone.test.ts: Test Files 3 passed (3), Tests 78 passed (78).
  • pnpm --filter @objectstack/runtime test: Test Files 534 passed (534), Tests 8559 passed | 19 skipped (8578).
  • pnpm --filter @objectstack/runtime typecheck and build: exit 0.
Dogfood over HTTP: both door files 16/16

After pnpm --filter '@objectstack/dogfood^...' build: pnpm --filter @objectstack/dogfood exec vitest run test/automation-flow-clone-door.dogfood.test.ts test/permission-set-clone-door.dogfood.test.ts gave Test Files 2 passed (2), Tests 16 passed (16). The full dogfood battery was not owed: the title has no ! and the change has no narrowing arm.

Ablation: five mutations through scripts/ablation-replace.mjs, each landed on disk, each red, each restored

The unit suites import the runtime from src, so no dist step is involved. After each leg git diff HEAD was empty.

# Mutation Result
A1 flow door drops noticeCode (automation.ts) 2 failed / 76 passed: the new unit case and the real-stack answer case
A2 permission-set door drops noticeCode 4 failed / 74 passed: created pair, reused pair, writable package, environment-wide CONTROL
A3 the code collapses "created" into "in package" 2 failed / 76 passed: the created-pair door case and its table row
A4 CONTROL: the flow sentence drifts by one word 2 failed / 76 passed: the existing sentence case and the new byte-identity case
A5 CONTROL: the permission-set package sentence drifts 2 failed / 37 passed: the in-package and created-package table rows
Derived gates: 67 derived, 66 run, 1 NOT MEASURED

node scripts/pm/dispatch-gates.mjs --commands derived 67 families; every one ran and --ran reconciled: 67 derived famil(ies) accounted for, 66 run, 1 NOT-MEASURED. 65 exited 0 on the first run. check-plugin-teardown-shape.mjs --self-test exited 3 on the shallow clone, then 0 after git fetch --unshallow. pnpm check:dual-build-cjs-loads exits 3 because not every package has a dist in this tree: NOT MEASURED, left to CI.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (No spec change here.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint is CI's run.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English, except the maintainer brief, which the os-dev order writes in Chinese.

Generated by Claude Code

…e by a stable noticeCode

The flow clone answer carries FLOW_CLONE_NOTICE_CODE ('FLOW_CLONE_DISABLED_COPY')
beside the unchanged FLOW_CLONE_NOTICE, the key CloneFlowResponseSchema declares
since #29779. The permission-set clone answer carries one code per notice
variant (environment-wide, in a package, in a package created for it), chosen
from the same landing kind the sentence is composed from, so code and sentence
cannot drift. `notice` stays byte-identical as the English fallback. Route
ledger rows for both doors name the new key.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWvgXNaTVoBWSiMCCC
@github-actions github-actions Bot added size/m 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 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/runtime, touching 21 documentable anchor(s).

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

  • content/docs/api/metadata-api.mdx (via /packages/:id/ensure-customization (route, a path literal in note))
  • content/docs/permissions/permission-sets.mdx (via /packages/:id/ensure-customization (route, a path literal in note))
  • content/docs/permissions/system-context.mdx (via handleAutomationRequest (symbol, a top-level function), handlePermissionSetCloneWrite (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 61 of 219 client-bound route-ledger rows — the other 158 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 158: 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; 103 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 — 28 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 b0ef25f524b870433424b8ad797ef3801374f745 → packageMentionDocs.

Which tree this was computed on

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

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

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

The New similar section spelled the answer as { permissionSet, package, notice };
it now names noticeCode too, the code of the notice's variant that a console
translates, with notice staying the English fallback.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWvgXNaTVoBWSiMCCC
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#3 · os-warren · session_01JQwxbYyp6wSRcywGFK2L4A

维护者速读

席位核对

ACCEPT · domain:server#3 · head db94ab0be8f3b9ddfc5e7ecc0dbe2bd8b739701b · 2026-11-03T06:45Z · seat review of record at TIER_DEFAULT. Not governed: check-governed-merges --pr 29823 reports NOT governed, 182 lines. There is no packages/spec path: the contract landed in #29779. No second agent.

  1. Shape: draft, base main, Refs #29727 (leg 1 only; no closing keyword, by the order), Clause-②: no, Metadata-protocol: none (the body and the changeset agree; @objectstack/runtime patch). 11 files, +168/−14, all inside the claim and its docs amendment. The seat read the diff:
    • Both doors add noticeCode beside the unchanged notice.
    • permissionSetCloneNotice and permissionSetCloneNoticeCode both branch on the single permissionSetCloneLandingKind(landing).
    • The route-ledger rows spell { flow, packageId, notice, noticeCode } and { permissionSet, package, notice, noticeCode }.
  2. Premise measured: on origin/main, neither clone answer carried a code. CloneFlowResponseSchema.data.noticeCode is optional z.string() (feat(spec): CloneFlowResponseSchema declares an optional data.noticeCode beside notice #29779 f87239ae). The permission-set door has no spec schema (its route-ledger row is server-only).
  3. Gates on this head: check-runs pinned to db94ab0b: 54 total, 40 success, 14 skipped, 0 failed. Dev (os-dev-report 6596926079):
    • door suites 78/78; full runtime 534 files, 8559 passed; dogfood door files 16/16;
    • 5 ablations red, including two CONTROLs on sentence drift;
    • 67 derived gates, 66 run, check:dual-build-cjs-loads NOT MEASURED and answered by CI;
    • the docs line at db94ab0b: check:doc-authoring and check:doc-anchors exit 0.
  4. Prose checked against the diff: each changeset sentence holds against the diff:
    • "one code per notice variant": the three keys of PERMISSION_SET_CLONE_NOTICE_CODES.
    • "Code and sentence are chosen from the same landing kind": the one permissionSetCloneLandingKind both read.
    • "notice is unchanged, byte for byte": the CONTROL pins.
  5. Out of scope: leg 2 (ui) — the Console maps the code to studio-namespace keys in en and zh, and its PermissionSetCloned type reads noticeCode. Skills-docs: not owed (Metadata-protocol: none).
  6. Landing: not governed and under 3000 lines ⇒ the seat lands it (pr_ready + automerge_enable). At MERGED: landing record on runtime: the flow and permission-set "New similar" clone notices carry a code, so the Console can translate them (zh-CN shows English today) #29727 (stays open for leg 2), pm:dispatched removed, leg 2 handed to the ui lane, card thread stood down.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 3, 2026 06:46
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 3, 2026 06:46
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 42ff86f Nov 3, 2026
55 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-noal4l branch November 3, 2026 07:05
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/m 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.

1 participant