Repository navigation
fix(spec, core, plugin-security, plugin-approvals, plugin-audit, service-analytics): platform refusals carry a userMessage in the caller's language - #34811
Conversation
…ice-analytics): platform refusals carry a userMessage in the caller's language The 404 RECORD_NOT_FOUND, the 403 unreadable-query-field refusal (all four producers), the 403 DELEGATION_SCOPE_VIOLATION and the per-row 409 RECORD_LOCKED now mark the end user's sentence as userMessage, rendered from three new keys of the shared operation-message catalog (en, zh-CN, ja-JP, es-ES) in the request locale, else the workspace default. Code, status and message are unchanged. Claude-Session: https://claude.ai/code/session_01ADHkmPhCxzY1uTqhToLhkv Co-authored-by: Claude <noreply@anthropic.com>
Tests that pin the exact shape of a not-found row now expect the end user's sentence beside code, message and status. The REST field-access route test builds the read path's not-found with the real producer, and the runtime CONTROL for an unmarked row moves to a write naming an undeclared field, since a missing id is now marked. Claude-Session: https://claude.ai/code/session_01ADHkmPhCxzY1uTqhToLhkv Co-authored-by: Claude <noreply@anthropic.com>
…lection The three test files edited for the not-found userMessage reach a source that imports a dependency inside a function body; each now loads it at module top, as check:test-source-alias asks of a file a change edits. Claude-Session: https://claude.ai/code/session_01ADHkmPhCxzY1uTqhToLhkv Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 11 package(s): 31 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 11 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 192 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 c3effc4229c8d0ff287174db4ef1086f4357c1c9 && git checkout c3effc4229c8d0ff287174db4ef1086f4357c1c9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d576509c80575197b3218aeb1f55884e5ed06ea6 d0668d12a8e6ec3a02a2efd20560e87fa6f90cba && git checkout -B drift-repro d576509c80575197b3218aeb1f55884e5ed06ea6 && git merge --no-ff d0668d12a8e6ec3a02a2efd20560e87fa6f90cba
node scripts/docs-audit/affected-docs.mjs --json d576509c80575197b3218aeb1f55884e5ed06ea6
|
The flat RECORD_NOT_FOUND body now includes userMessage in the caller's language; the two pages that print that body show it. Claude-Session: https://claude.ai/code/session_01ADHkmPhCxzY1uTqhToLhkv Co-authored-by: Claude <noreply@anthropic.com>
An interface of two optional fields is a weak type: TypeScript refuses a context that declares neither (hook and middleware contexts, test callers) for it. The caller is now typed `object` and its two locale fields are read defensively, which the ladder already did. Claude-Session: https://claude.ai/code/session_01ADHkmPhCxzY1uTqhToLhkv Co-authored-by: Claude <noreply@anthropic.com>
The MCP data doors relay a declared userMessage; with no caller locale in reach the not-found refusal's is the English one. The metadata door carries no userMessage channel, so its sites keep the three-field answer. Claude-Session: https://claude.ai/code/session_01ADHkmPhCxzY1uTqhToLhkv Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-support-ai · session_01WGufzi8zDwpH6wX7ZPUcHR 席位核对L1 first review (full) · REWORK · Head-sha: There is no earlier L1 or contract-review record on any head. Inputs:
The four markings read correct where they are made. The sentences name no field, id or API name. Must-fixM1. Seven paths fall outside the claimed surface, and the card has no amendment for them. Claim 6944041623 names the catalog, the core helper, the listed
I read Should-fixS1. Row 3 is incomplete on the action and flow-start doors, and the body says the caller is out of reach there when it is not.
(a) is a one-parameter change in a claimed file and closes the row the card names. Nits
Checklist (the rest holds)
Owed, for the seat: a contract review at CONTRACT_REVIEW_TIER. It is owed for the non-test |
…found refusals answer in the caller's language refuseDeniedSubjectLoad, refuseDeniedSubjectLoadBeforeDispatch and the bulk faces' assertRecordExists take the caller's execution context, and every caller that holds one passes it, so their RECORD_NOT_FOUND userMessage follows the request locale, then workspaceLocale, then en, as the data door's own miss does. code, status and message do not move. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX
…d exports and catalog keys Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX
…new pin files check:test-source-alias asks each edited test file whose source under test loads a workspace dependency inside a function body to load it at module top. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX
|
repo:objectstack#3 · os-support-ai · session_01WGufzi8zDwpH6wX7ZPUcHR 席位核对L1 delta review · ACCEPT (code); landing waits on gates · Head-sha: This reviews the delta from L1 6949320766 (REWORK at
No new findings. Gates at this head, as read now. Landing waits for these:
This ACCEPT does not stand in for those gates. Owed, for the seat: the contract review at CONTRACT_REVIEW_TIER on this head, which you said you would run once after the S1 fix. This comment readies, queues and arms nothing. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfr1xZSFZzCR8HnqXX Red read · PR #34811 · head
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: First seat contract review of this PR: no earlier contract-review record exists on the PR or on card #34699 at any head, so this is a review of the whole net diff against ① Derived judgments
② Semver levelClause-②: yes (widening). Declared on the PR body and in the changeset, identically, with
③ Boundary flags
④ Design judgmentNo must-fix, no should-fix.
Implementing files, sentence by sentence:
Nits (no effect on correctness or the contract; left as accepted deviations, since a fix in these files moves the head):
Implemented-by: VERDICT: PASS |
…aram protocol.ts sits under a facade line ceiling of 11705 (ruling 6897467376), and an open sibling PR takes the remaining headroom. Drop the delegation-side comment; the facet body in protocol-record-reads.ts already says what `caller` decides. No behaviour change. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX
|
repo:objectstack#3 · os-support-ai · session_01WGufzi8zDwpH6wX7ZPUcHR 席位核对L1 delta review (main merge + line trim) · ACCEPT; landing waits on gates · Head-sha: This reviews the delta from L1 6953842787 (delta ACCEPT at
There is nothing new to review. The rerun on Gates at this head: CI was still running when this was read (24 of 47 checks in progress, none failed). This ACCEPT does not stand in for green. Owed, for the seat: your contract review on the post-S1 code, if it has not been posted yet. This delta adds no code to it. This comment readies, queues and arms nothing. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfr1xZSFZzCR8HnqXX Red read · PR #34811 · head
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: Delta review over the seat's full contract review 6953960778 (PASS at head The hop
① Derived judgmentsUnchanged from the baseline, each still right on this head: the catalog gains three keys in four locales and moves no existing text;
② Semver levelClause-②: yes (widening). Unchanged on the PR body and in the changeset, with ③ Boundary flags
④ Design judgmentNo must-fix, no should-fix.
Implementing files: twelve of the thirteen are byte-identical to the baseline head in this PR's hunks and untouched by main. The thirteenth, Nits carried from the baseline, unchanged and still open as accepted deviations (no effect on correctness or the contract; a fix in these files moves the head):
Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfr1xZSFZzCR8HnqXX Landing · PR #34811 (card #34699, p1) · head
|
Requested by Yibo Wang · project thread
Fixes #34699 (server rows 1, 3, 4 and 5 as narrowed by the card's
Premise corrected; the ui rows live on #34740)Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
userMessage,按请求语言(否则工作区默认语言,再否则英文)给出;数据、动作执行、流程启动三个入口对同一条"记录不存在"给同一种语言;code、状态码与 message 不变。userMessage,缺的是服务端没给。packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts(两处标注)、packages/core/src/utils/record-not-found.ts、packages/spec/src/system/operation-message.ts(新增三键四语)。pnpm --filter @objectstack/plugin-security exec vitest run src/platform-refusal-user-message.test.ts,预期 10 条全绿,其中 zh-CN 用例断言中文句子。check-governed-merges.mjs --pr 34811判 NOT governed,0/43 路径,849 行),L1 通过、席位契约复审(contract review owed)PASS 且 CI 全绿后,由 o3-J 区落地。What changes
The platform answers four refusals with an end user's sentence on
userMessage, in the caller's language: the requestlocale, elseworkspaceLocale, elseen(the ladder the operation-message catalog already uses).code, HTTP status andmessagedo not move; the operator half stays inmessage.RECORD_LOCKED)plugin-approvalslifecycle-hooks.ts: only the per-row lock; the three operator-facing bound refusals stay unmarkedRECORD_NOT_FOUNDrecord_not_found(new)recordNotFoundErrorin@objectstack/core, now taking the caller; every call site that has a context passes itPERMISSION_DENIED)query_field_not_readable(new)plugin-approvalspayload-predicate-guard.ts,plugin-auditparent-field-query-guard.ts,service-analyticsfield-read-admission.ts; the aggregate-role refusals stay unmarked (they are not row queries)DELEGATION_SCOPE_VIOLATIONdelegation_scope_violation(new)packages/spec/src/system/operation-message.ts: three placeholder-free keys inen,zh-CN,ja-JP,es-ES. None names a field, id, object or wire code.record_not_foundreads the same for a missing row and an unreadable one (ruling 5985885287, existence hiding).packages/core/src/utils/operation-user-message.ts(new, exported):operationUserMessage(key, caller)resolves the ladder againstBUILTIN_OPERATION_MESSAGESand renders throughrenderOperationMessagewith the built-in catalog. It is for producers that hold noi18nservice, so it consults no deploymenterrors.KEYoverride; the security middleware's markings go through its ownuserFacingDenialMessage, which does. The caller is typedobject(any context) and itslocale/workspaceLocaleare read defensively.mapDataErrorand the batch-row classifier already relay a declareduserMessage; nothing in the transport changed.RECORD_NOT_FOUNDbody examples incontent/docs/protocol/kernel/http-protocol.mdxanderror-handling.mdxnow showuserMessage.refuseDeniedSubjectLoadandrefuseDeniedSubjectLoadBeforeDispatch(runtime/src/action-execution.ts) take the caller, and every caller that holds the execution context passes it: the declarative update arm, the hand-off pre-check, the flow-start row admission (refuseUnreadableFlowStartRecords, shared byPOST /automation/:name/trigger, the declaredtype: flowendpoint and the action door's flow branch) and the dispatch arm of every other action (action-dispatch.ts). So a routed row the caller cannot read, or an id that names nothing, answers the zh-CN sentence there exactly as the data door does for the same miss.assertRecordExists(metadata-protocol/src/protocol-record-reads.ts, reached when the engine's update resolvednullinstead of refusing) takes the row's write context fromprotocol-batch-data.ts.runtime/src/domains/mcp.ts'srefuseDeniedSubjectLoadcall and the MCP metadata door). Their not-found carries the EnglishuserMessage; the MCP data doors relay it, the MCP metadata door carries nouserMessagechannel and answers as before.@objectstack/coregains two public exports,operationUserMessageand the typeUserMessageCaller, andrecordNotFoundErroran optional third parameter;@objectstack/specgains three catalog keys,record_not_found,query_field_not_readableanddelegation_scope_violation; the/data404 body and the batch rows gain auserMessagekey. Nothing is removed or narrowed. The changeset carries the same two declaration lines and stayspatch(Metadata-protocol: none).Tests
New:
plugin-security/src/platform-refusal-user-message.test.ts(10): realObjectQLover a realSqlDriverwith the realSecurityPlugin; zh-CN, workspace fallback andenfor rows 3, 4, 5, plus relay through the realmapDataError, plus a CONTROL that a readable query is admitted. The delegated gate is a stub that throws the gate's real error class (the gate's own verdicts are pinned indelegated-admin-gate.test.ts).core/src/utils/operation-user-message.test.ts(7): the ladder and the not-found envelope.spec/src/system/operation-message.test.ts: every locale defines the three keys, no placeholders, no wire vocabulary, distinct texts, zh-CN render, unknown-locale fallback, deployment override.payload-predicate-guard.test.ts,activity-predicate-guard.test.ts,field-read-admission-gate.test.ts,record-lock-user-facing-message.test.ts.runtime/src/flow-start-record-admission.test.ts(3, this round): the action door (POST /actions, a routed row the zh-CN caller cannot read) and the flow-start door (POST /automation/:name/trigger, a row key the zh-CN caller cannot read) answer the zh-CNrecord_not_foundsentence withcode, status andmessageunchanged and no run; CONTROL: the same start by a caller with no locale answers the English sentence.metadata-protocol/src/protocol.bulk-record-not-found.test.ts(2, this round): an engine whose update resolvesnullfor a missing row;updateManyDataandbatchDataupdate give the zh-CN caller the zh-CN sentence on the row, CONTROL a caller with no locale the English one.Forced changes (tests that pin the exact error shape, now expecting the added field):
metadata-protocol/src/protocol.batch-row-driver-text.test.ts,protocol.batch-row-http-status.test.ts: the not-found batch row now carriesuserMessage.runtime/src/batch-row-http-status-real-driver.integration.test.ts: same.plugin-approvals/src/record-lock-batch-row-status.integration.test.ts: the lock row carriesuserMessage; its own-property list endsstatusCode, userMessage.rest/src/record-field-access-route.test.ts: the stub of the read path's not-found is now built by the realrecordNotFoundError, so the "same 404 as the read path" comparison compares like with like.mcp/src/mcp-coded-refusal.test.ts(data-door sites) andmcp/src/stdio-data-bridge.not-found.test.ts: the MCP not-found envelope carries the EnglishuserMessage.runtime/src/duplicate-record-user-message-doors-33790.test.tsCONTROL: "a row whose producer marked nothing" used an id naming no row, which is now marked; it moves to a write naming an undeclared field. Its assertion (nouserMessage) is unchanged.Ablation (each leg red, then restored;
git diff HEADempty on the touched source afterwards):recordNotFoundErrormarking deletedlockedError(sentence)without the user halfrefuseDeniedSubjectLoaddrops its caller (recordNotFoundError(objectName, recordId ?? '')), viascripts/ablation-replace.mjs(anchor 1 → 0, blobd9aad0e27984→9e3e53af6067)flow-start-record-admission.test.ts: the action-door and flow-start-door pins; the CONTROL stays green); restored, blob == HEADd9aad0e27984,git diff HEADempty; green leg 35 / 35Acceptance notes
refuseDeniedSubjectLoadandassertRecordExistshad "no caller context in reach" was wrong and is gone. The fix also passes the caller ataction-dispatch.ts's dispatch arm (refuseDeniedSubjectLoadBeforeDispatch), which the verdict listed as taking none: its caller holdsec, and it is the path of every script, body and flow action, so without it the action door would still answer English. The out-of-surface paths of every round are named in claim amendment 6952327352 on i18n (zh-CN): platform-authored refusals and console strings still answer in English — approval record lock, master-record denial, not-found, masked-field filter, delegated-scope, "No options" #34699.origin/mainis merged in (c7362a7650).run_actionhand-off pre-check (subjectVerdictRefusal,action-dispatch.ts) rebuilds the refusal frommessage,statusandcodeonly, so the caller passed atrefuseDeniedSubjectBeforeHandOffdoes not reach that MCP answer asuserMessage. MCP door, outside this PR's rows; noted, not filed (not measured at a public door).overlap-check.mjsat this head:origin/mainand feat(flow designer): the publish checks show before the publish, worded for the builder #34850, feat(i18n): a dependent package's fieldPatches text is translated from that package's own translations #34784, fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move #34709 merge cleanly; fix(audit): a search the server widens never names a column the caller may not query #34817 (open, ready) now conflicts onplugin-audit/src/parent-field-query-guard.ts, a file the first round edits (it merged cleanly at the takeover). Whichever of the two lands second merges the other.Verification
This round (head
1130a716e0)origin/mainmerged atc7362a7650(clean, no generated artifact deferred). After the merge, the dependency closure of@objectstack/runtimewas rebuilt, and later every package underpackages/(turbo run build --concurrency=2, lock verdict exit 0). The suites and typechecks below ran under the shared verify lock, and the exit codes are the commands' own.Package suites and typechecks
pnpm --filter @objectstack/metadata-protocol typecheck5ea3c15d15, again at1130a716e0pnpm --filter @objectstack/runtime typecheck(includescheck:test-typecheck)5ea3c15d15, again at1130a716e0pnpm --filter @objectstack/metadata-protocol test5ea3c15d15pnpm --filter @objectstack/runtime test(projectlocal)5ea3c15d15mcp-coded-refusal.test.ts+stdio-data-bridge.not-found.test.ts5ea3c15d15record-field-access-route.test.ts5ea3c15d15flow-start-record-admission.test.ts·protocol.bulk-record-not-found.test.ts1130a716e01130a716e0changes only those two test files (one module-top import each), so the two files and both typechecks were re-run there.Derived gates
node scripts/pm/dispatch-gates.mjs --commands(no paths) derives 128 families for this PR's change set; the list is the same at5ea3c15d15and at1130a716e0. First pass at5ea3c15d15: 124 exit 0; three exited 3, PREREQUISITE NOT MET, because packages had nodist/(spec check:skill-examples,check:dual-build-cjs-loads,check:i18n);check:test-source-aliasexited 1 on the two new pin files (their source under test loads@objectstack/lintand@objectstack/metadatainside a function).1130a716e0adds the module-top imports the gate asks for. After the full package build, all four were re-run at1130a716e0: each exit 0. The ratchet familiescheck:type-check-coverageandcheck:type-check-debt, andcheck:cross-package-test-inputs, were re-run at1130a716e0: exit 0. Reconciliation:dispatch-gates.mjs --ranwith an exit code on every line → 128 derived, 128 run, 0 NOT-MEASURED.check-nul-bytes.mjs: OK. No exported symbol was renamed or removed, socheck-platform-checklist.mjswas not owed. CI runs the full farm on the PR.Earlier rounds (through head d50700b)
Package suites (shared box, under the verify lock): core, plugin-security, plugin-approvals, plugin-audit, service-analytics, service-print, metadata-protocol, rest, objectql (13603 tests), runtime, spec (27174 tests). The first run surfaced the six forced shape pins above; each failing file was re-run green after its fix.
Merge-tree against the open PRs that share a file (none shares a hunk), and against main:
git merge-treeaction-execution.ts)08a588b12bengine-update.ts)13741cb992engine-delete-and-aggregate.ts)779d1aa330origin/main6dd5716329Derived gates:
node scripts/pm/dispatch-gates.mjs --commandsderives 102 for this file surface. After a fullturbo run build, all 102 ran at21b0016086: 101 exit 0, andcheck:test-source-aliasexit 1 on three test files this change edits (their source under test loads a dependency inside a function body).f3d1774be2adds the module-top imports the gate asks for; the gate then exits 0 and the three files re-run green.f8ef82d7bbadds the two doc examples, which derive 23 more docs gates: all 23 exit 0, and the four earlier doc-reading gates (check:doc-authoring,check-affected-docs,check-drift-comment, speccheck:docs) re-ran exit 0. Reconciliation:dispatch-gates.mjs --ran→ 125 derived, 125 run, 0 NOT-MEASURED. CI's workspace type check then caught a weak-type error (a context declaring neither locale field was refused for the caller type) inplugin-auditand the rest test;1fce1406e2types the caller asobject, andturbo run typecheckover the 11 touched packages passes (52/52 tasks). CI's Test Core shard 9 then caught the two MCP shape pins above;d50700b346updates them. Before that push, the two MCP files re-ran green, and the other packages whose tests name the not-found refusal ran locally, all exit 0: plugin-auth, service-settings, downstream-contract, client, driver-sql, organizations, plugin-sharing, http-conformance, scenarios, service-mailbox, service-storage, verify, plugin-hono-server, types.check-platform-checklist.mjs --changed-from origin/main: OK, 21 anchors judged, 0 lost.eslint --no-inline-configon the changed.tsfiles: exit 0.Human Minimum
packages/specholds no runtime logic. (Only catalog strings added.)pnpm lintpasses. (eslint run on the changed files.)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (No generated artifact moves: the keys are catalog strings, not schema.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX