Repository navigation
feat(runtime): flow and permission-set clone answers name their notice by a stable noticeCode - #29823
Conversation
…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
📓 Docs Drift CheckThis PR changes 1 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 28 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 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
|
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
|
domain:server#3 · os-warren · session_01JQwxbYyp6wSRcywGFK2L4A 维护者速读
席位核对ACCEPT ·
|
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
POST /api/v1/automation/:name/clone). The answer carriesdata.noticeCode: 'FLOW_CLONE_DISABLED_COPY'beside the unchangedFLOW_CLONE_NOTICE. The code is exported asFLOW_CLONE_NOTICE_CODEnext to the sentence inflow-clone.ts. The key is the optional oneCloneFlowResponseSchemaalready declares (automation-api: CloneFlowResponseSchema declares an optionalnoticeCodebesidenotice, 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'sCloneFlowResponsetype already carries it.POST /api/v1/security/permission-sets/:name/clone, server-only, no spec schema).permissionSetCloneNoticecomposes three sentences, so there is one code per variant:PERMISSION_SET_CLONE_ENVIRONMENT_WIDE,PERMISSION_SET_CLONE_IN_PACKAGEandPERMISSION_SET_CLONE_IN_CREATED_PACKAGE. No parameter key is needed, because the one value the sentence carries, the package, is already on the answer asdata.package. A singlepermissionSetCloneLandingKind(landing)sorts a landing into its variant, and both the sentence andpermissionSetCloneNoticeCode(landing)(through the exportedPERMISSION_SET_CLONE_NOTICE_CODEStable, keyed by that kind) are chosen from that one answer, so code and sentence cannot drift.noticeis unchanged on both doors, byte for byte, and stays the English fallback.route-ledger.tsnow spell theirdataas{ flow, packageId, notice, noticeCode }and{ permissionSet, package, notice, noticeCode }.content/docs/permissions/permission-sets.mdxnamesnoticeCodein 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.@objectstack/runtimepatch.Tests
domains/automation-flow-clone.test.ts: a new case asserts the answer'snoticeCodeisFLOW_CLONE_DISABLED_COPY, and as a CONTROL assertsnoticeequals 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, andCloneFlowResponseSchema.parsekeeps 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 tonoticewhile touching codes reds.automation-flow-clone-door.dogfood.test.tsandpermission-set-clone-door.dogfood.test.tsassert the codes on the served answers (created pair, then reused pair).Acceptance notes
ui/packages/app-shell/src/views/metadata-admin/permission-set-clone.ts,PermissionSetCloned), butui/**is outside this card's claimed file surface, so it is left for leg 2, which reads the code there anyway.automation.clone()returnsCloneFlowResponse['data'], which already declaresnoticeCode.Verification
Head
db94ab0b. All code readings were taken atecac38e6, which has the same tree asda10eb94(only the commit message was reworded, to drop a card trailer the pre-push hook refuses).db94ab0badds 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-commentandcheck:nul-byteseach exit 0 atdb94ab0b. 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 typecheckandbuild: 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.tsgaveTest 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 nodiststep is involved. After each leggit diff HEADwas empty.noticeCode(automation.ts)noticeCodeDerived gates: 67 derived, 66 run, 1 NOT MEASURED
node scripts/pm/dispatch-gates.mjs --commandsderived 67 families; every one ran and--ranreconciled:67 derived famil(ies) accounted for, 66 run, 1 NOT-MEASURED. 65 exited 0 on the first run.check-plugin-teardown-shape.mjs --self-testexited 3 on the shallow clone, then 0 aftergit fetch --unshallow.pnpm check:dual-build-cjs-loadsexits 3 because not every package has adistin this tree: NOT MEASURED, left to CI.Human Minimum
packages/specholds no runtime logic. (No spec change here.)pnpm lintis CI's run.main, one pull request.packages/specnot touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code