Skip to content

fix(objectql): platformSystemApi on the api ObjectRepository.execute hands the dispatched action keeps the 'action' mark - #35733

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-35434-execute-keeps-action-mark
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-35434-execute-keeps-action-mark

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread
Fixes #35434
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用户无感;宿主代码里一个动作再去调用另一个动作时,被调用的动作若把自己拿到的接口交给「平台自用系统接口」函数,拿回的接口仍带动作标记,改成员、岗位、权限集分配、邀请会像权限文档写的那样被拒。
  • 为什么做:补上上一轮「动作处理器保留动作标记」修复在文档里注明「不覆盖」的那条路,让权限文档对动作的承诺在动作链式调用时也成立。
  • 出错会怎样:最坏是某个宿主动作经动作链调用、再经此函数写身份分配对象时被拒;仓库里目前没有这样的调用方,审计写入路径不变,回滚本次合并即可撤回。
  • 要你做什么:无。

What changes

Route B of the card (an origin flag set by execute and copied by derive, held in a facet module, never in engine.ts).

  • packages/objectql/src/engine-object-repository.ts: a module-local WeakSet keyed by ScopedContext instance, the dispatched action's origin flag, with markDispatchedActionApi / isDispatchedActionApi. ObjectRepositoryFacet.execute flags the api it hands the dispatched action. Neither helper is re-exported from either package entry.
  • packages/objectql/src/engine-scoped-context.ts: derive copies the flag to the child (so sudo(), withRunAs(...), a transaction's context, the seeds' and platformSystemApi's results keep it); platformSystemApi's facet body answers a flagged api with that api's own sudo(), as it already does for an app-authored api. Mark and flowRunId are kept.
  • packages/objectql/src/platform-system-api.ts header and row 1b of content/docs/permissions/system-context.mdx: the "not covered" clause is dropped, nothing else in that prose.
  • engine.ts is not touched, so the check:facade-delegation-only ceiling (ruling 6897467376) is unchanged. No published signature changes: ObjectRepository's constructor is exported from both entries, so route A (threading the calling api into it) would have changed a published signature; it would also not have kept the mark on the reach path, because runtime's action-door layer passes repositories through unchanged and objectql only ever sees the inner ScopedContext, which carries neither flag.
  • The flag is not the app-authored flag: the dispatched handler's permanent delete (ADR-0148 D3) still runs. The audit writer's hook api (buildHookApi, a fresh ScopedContext, never derived from a flagged api) is unchanged: platformSystemApi still takes the mark off there.

Tests

New packages/runtime/src/execute-dispatched-action-platform-system-api-35434.integration.test.ts (real ObjectQL, SQL driver, real SecurityPlugin):

  • dispatched from the action door's api (buildActionApi, an action handler chaining another) and from a bare engine api: an insert into each of the four identity-assignment objects through platformSystemApi(ctx.api), platformSystemApi(ctx.api.sudo()) and platformSystemApi(trx) is refused PERMISSION_DENIED / 403 naming an action body, and nothing lands; the handler's own sudo() as a control;
  • its insert into an ordinary object is owner-stamped with the caller;
  • CONTROL: a hook registered in code, fired by the dispatched handler's write, still takes the mark off and its platform write lands;
  • CONTROL: the dispatched handler's permanent delete still runs.
Red before the fix, green after, two ablations
  • Before the fix (head a7af719): Tests 9 failed | 2 passed (11), each failure insert on OBJECT through direct was not refused (OBJECT per case) and the owner stamp owner_id: null. Premise held.
  • After (head 532c6f3, merged with main): Test Files 2 passed (2) · Tests 21 passed (21) (this file plus action-door-platform-system-api.integration.test.ts).
  • Ablation 1, execute stops flagging (api: new ScopedContext(executionContext, this.engine),): ablation-replace landed (anchor 1 -> 0), objectql rebuilt, ablation-dist-preflight marker present in 4 built files; Tests 9 failed | 2 passed (11). Restore: blob == HEAD, git diff HEAD empty, rebuilt, --absent clean, Tests 11 passed (11).
  • Ablation 2, derive stops copying the flag: landed, present in 4 built files; Tests 8 failed | 3 passed (11) (the sudo() and transaction routes red, the direct route and controls green). Restore: blob == HEAD, --absent clean, Tests 11 passed (11).
Package suites
  • pnpm --filter @objectstack/objectql test at 532c6f3: Test Files 616 passed (616) · Tests 13907 passed (13907).
  • pnpm --filter @objectstack/objectql typecheck and pnpm --filter @objectstack/runtime typecheck: exit 0; check:test-typecheck: OK on both.

Acceptance notes

  • The claim's file surface lists engine-scoped-context.ts "only if route A needs it". Route B needs it too: derive and the platformSystemApi facet body live there. fix(objectql): a committed or rolled-back trio handle reads as closed #35541, the open PR that touched it at claim time, has since merged; overlap-check answered clean.
  • The pending changeset .changeset/35174-action-api-platform-system-api-mark.md (unreleased) said the execute path is not covered. It is edited here as a seat amendment (its "Not covered" bullet is dropped); see DELIBERATE CORRECTION below.
  • The two enumerations kept in the header ("two of the apis") and in row 1b name the app-authored hook api and the action door's api; per the card's fence only the "not covered" clause was dropped, and the third api is documented at the flag (engine-object-repository.ts).

Verification

Read first, by risk: packages/objectql/src/engine-scoped-context.ts (derive, platformSystemApi), then engine-object-repository.ts (execute).

Two-minute check: pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/execute-dispatched-action-platform-system-api-35434.integration.test.ts after building objectql, expect Tests 11 passed (11).


Generated by Claude Code

DELIBERATE CORRECTION

DELIBERATE CORRECTION: .changeset/35174-action-api-platform-system-api-mark.md (pending, from #35174 / PR #35383) drops one bullet, which this PR makes false:

  • Not covered: the api ctx.api.object(o).execute(name) hands the action it dispatches is built by the engine, not the action door, so platformSystemApi still takes the mark off there.

After: the bullet is removed; no other sentence of that note changed. This PR closes that path. The check-empty-changeset red is by design for this class; the seat confirms the correction by its same-head at-tier contract-review record (landing-operations.md), not by a maintainer wait.

…hands the dispatched action keeps the 'action' mark (failing first)

Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
Co-authored-by: Claude <noreply@anthropic.com>
…hands the dispatched action keeps the 'action' mark

Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
Co-authored-by: Claude <noreply@anthropic.com>
@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 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/objectql, touching 7 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/objectql/src/platform-system-api.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/ai/knowledge-rag.mdx (via executionContext (literal, a string literal in platformSystemApi))
  • content/docs/automation/jobs.mdx (via executionContext (literal, a string literal in platformSystemApi))
  • content/docs/permissions/system-context.mdx (via platformSystemApi (symbol, a method of class ScopedContextFacet))
  • content/docs/protocol/knowledge.mdx (via executionContext (literal, a string literal in platformSystemApi))
  • content/docs/ui/actions.mdx (via executionContext (literal, a string literal in platformSystemApi))
What this run could not see
  • 1 changed file(s) yielded no anchor (packages/objectql/src/platform-system-api.ts) — pages documenting those are invisible to this run
  • 2 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 — 21 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 03bce5c22a473cca2ca03eb85d0ca489783d610d → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 03bce5c22a473cca2ca03eb85d0ca489783d610d

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

…he execute path as not covered

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Check Changeset red at 186bbc489c · 2026-11-20T04:14Z

The only error is the DELIBERATE CORRECTION class on .changeset/35174-action-api-platform-system-api-mark.md (job 136077577385: "exists on the merge base and was not added by this PR"). It is by design: this PR makes that note's "Not covered: … execute …" bullet false and drops it, declared in the PR body's ## DELIBERATE CORRECTION section. The gate stays red for this class either way; the seat confirms the correction with a same-head at-tier contract-review record before landing (references/landing-operations.md). Check Changeset is not a required context and runs no merge_group judgement on this class.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

席位核对

L1: ACCEPT (L1-a, for area d7-B) at head 186bbc489c00f71d513eac6e3550aa13fa820ffb, read 2026-11-20T04:41Z. One PR-body correction is owed; it moves no head (see the end).

Checklist (l1-review-checklist.md), read on GitHub and in the head tree:

  • Shape. Draft, base main, Fixes #35434, the card delivered whole. Clause-②: no and Metadata-protocol: none sit at line start in the body and the new changeset.
  • Route B is sound.
    • DISPATCHED_ACTION_APIS is a module-local WeakSet<ScopedContext>. Only ObjectRepositoryFacet.execute sets it on a fresh api, and only ScopedContextFacet.derive copies it, on the instance's own facade.
    • markDispatchedActionApi / isDispatchedActionApi are module exports only. No package entry re-exports engine-object-repository or engine-scoped-context (checked with a grep of the head), so there is no new public name, and Clause-②: no stands.
    • engine.ts is untouched, so the check:facade-delegation-only ceiling is unaffected. The new import from engine-scoped-context into engine-object-repository is read only at call time, never at module evaluation, so the import cycle through engine.js is inert.
    • The flag can only tighten. On a flagged api, platformSystemApi answers the api's own sudo(): mark and flowRunId kept, so more writes are judged as an action body's, never fewer.
    • The flag is not the app-authored flag, so ADR-0148 D3's permanent-delete refusal does not newly bite a dispatched host handler.
    • buildHookApi still builds a fresh, unflagged ScopedContext, so the audit writer's platform write is unchanged.
    • Route A being measured infeasible (it would change ObjectRepository's published constructor, and objectql never sees runtime's wrapper) is a fair basis for B. B and A give the same behaviour; C would differ, so choosing B decided no product question.
  • Boundary. This changes a permission outcome, so I checked that it decides no new boundary. It enforces one already documented: row 1b says an action body's writes to the four identity-assignment objects are refused, and the execute path was the documented carve-out (L2 7003367719 S2, filed as a Bug). Removing a gap in a ruled refusal is not a human-floor decision.
  • Point (1): refusal pinned with code and status, and two ablations. Met.
    • The shared assertion helper checks err.code PERMISSION_DENIED and statusCode ?? status 403, plus "nothing lands", across all four identity-assignment objects, three routes (direct, sudo(), transaction) and two dispatchers (the action door's api and a bare engine api). It runs on a real ObjectQL, the SQL driver and the real SecurityPlugin.
    • Controls: the owner stamp, the code-registered hook's platform write landing, and the dispatched handler's permanent delete.
    • Base reading 9/11 red. Ablation 1 (execute stops flagging): 9 red. Ablation 2 (derive stops copying): 8 red, only the sudo() / transaction routes plus the owner stamp, the direct route green, exactly the shape the copy predicts. Both were rebuilt into dist with the preflight marker and restored blob-equal.
  • Prose, sentence by sentence.
    • New changeset: each bullet matches the code and a pin. The last sentence, "No new export, and no published signature changes", is true per the grep above.
    • system-context.mdx row 1b and the platform-system-api.ts header: only the "Not covered … still takes the mark off" sentence is removed. Row 2's "and by ObjectRepository.execute" (the mark) remains true.
  • DELIBERATE CORRECTION. The two Check Changeset reds are both check-empty-changeset's foreign-note refusal on exactly one file, .changeset/35174-action-api-platform-system-api-mark.md. I read the job log, and it names only that note. That note is pending, from PR fix(runtime): platformSystemApi on an action handler's ctx.api keeps the 'action' mark, and what it returns stays seam-wrapped #35383. Before: "- Not covered: the api ctx.api.object(o).execute(name) hands the action it dispatches is built by the engine, not the action door, so platformSystemApi still takes the mark off there." After: the bullet is removed, and no other sentence of that note changes. The removed sentence is false at this head (ablation 1 is exactly that path), so removing it is right, and restoring it would republish a false sentence. This diff changes code, so under landing-operations.md the confirmation that counts is a same-head at-tier L2 PASS that judges this rewrite; this L1 ACCEPT alone does not confirm it.
  • Gates. CI at 186bbc48: 40 success, 17 skipped, and 2 failure, both the Check Changeset refusal above. Lint & Repo Gates, TypeScript Type Check and Test Core are success.
  • Scope. engine-scoped-context.ts went beyond the claim's "only if route A" wording, and the body declares it with the reason (B needs derive and the facet body). Overlap is clean, and fix(objectql): a committed or rolled-back trio handle reads as closed #35541 has merged. Accepted. The 35174 note edit sits outside the claim surface as a seat amendment, declared above.

Point (2): L2. None of the four contract faces is touched (no Clause-②: yes, no narrowing arm, no packages/spec/src/**, no governed path). The same-head CONTRACT_REVIEW_TIER L2 is owed anyway, because the DELIBERATE CORRECTION on a code diff is confirmed only by that record, and it must judge the rewritten sentence of the 35174 note. Running it after this ACCEPT is fine; I see no reason to run it first. Brief the isolated reviewer with the diff and the two notes, not with this verdict.

Owed before the L2 and before landing: a PR-body correction. ## Acceptance notes still says the pending changeset .changeset/35174-action-api-platform-system-api-mark.md "is outside this card's file surface and is not edited here". The diff edits it, and the body's own ## DELIBERATE CORRECTION section says so. Rewrite that bullet to match, for example "edited here as a seat amendment; see DELIBERATE CORRECTION". It is a body edit and moves no head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 186bbc489c00f71d513eac6e3550aa13fa820ffb
Local-runs: none
Scope: .changeset/35174-action-api-platform-system-api-mark.md, .changeset/35434-execute-dispatched-action-keeps-mark.md + packages/objectql/src/engine-object-repository.ts, packages/objectql/src/engine-scoped-context.ts, packages/objectql/src/platform-system-api.ts, content/docs/permissions/system-context.mdx
Security-touching: yes

Read: card #35434 (body and all 5 comments), the PR body and its 7-file list, the net diff against merge base 97f342037d, the check-runs on the head, and the log of Check Changeset job 136077577385. packages/runtime/src/execute-dispatched-action-platform-system-api-35434.integration.test.ts was read as evidence. Code outside the diff was read, not reviewed.

① Derived judgments

  • Public surface: none added. Right. markDispatchedActionApi and isDispatchedActionApi are exported from the module engine-object-repository.ts only. packages/objectql/package.json exports has two entries, . and ./core; src/index.ts and src/core.ts re-export ObjectQL, ObjectRepository, ScopedContext from ./engine.js and platformSystemApi from ./platform-system-api.js by name, and neither names engine-object-repository or engine-scoped-context. The only importer of the two helpers is engine-scoped-context.ts:56. Not reachable from a package entry.
  • Published class faces: unchanged. Right. ScopedContext gains no member (the flag is a module WeakSet, derive stays private at engine.ts:6469); ObjectRepository's constructor and execute signature are untouched; engine.ts is not in the diff. The two facet this types widen by 'facade', an existing ScopedContextHost key (engine.ts:6846, facade: instance); the facet is not exported from either entry.
  • Accept-set change: one narrowing of a permission outcome, at the consumer the card names. Right. On the api ObjectRepositoryFacet.execute builds, and on every api derive builds from it, ScopedContext#[PLATFORM_SYSTEM_API] now answers sudo() (mark and flowRunId kept) where it stripped both. So an insert, update or delete of sys_member, sys_user_position, sys_user_permission_set, sys_invitation through it is refused by plugin-security, and an insert into an ordinary object is owner-stamped. Nothing else changes outcome: the dispatched handler's direct writes and its sudo() already carried the mark at the merge base (the test's ownSudo control).
  • Dual build: right. The WeakSet is module-local, so each built copy holds its own. The writer (execute, reached through an ObjectRepository of copy X) constructs copy X's ScopedContext, and both readers are reached through that instance's own stubs (derive, [PLATFORM_SYSTEM_API]), which call copy X's facet. Writer and reader cannot be different copies. The header's sentence saying so holds.
  • Gate verdicts, from the head's check-runs. Every concluded run is success or skipped except Check Changeset (red twice, a third run in progress at read time). In job 136077577385 the one failed step is Reject an empty-frontmatter changeset added by this PR, and its one error is the M row on .changeset/35174-action-api-platform-system-api-mark.md (the COLLISION / DELIBERATE CORRECTION refusal). Its other steps passed: a changeset is present, 2 declaring changesets, no major, LEVEL AXIS patch with Clause-②: no and Metadata-protocol: none. The red is the declared class and nothing else.

② Semver level

  • .changeset/35434-execute-dispatched-action-keeps-mark.md: @objectstack/objectql patch. Right. The published change is in objectql's src alone; the runtime file is a test, the docs page ships in no package. A bug fix with no surface change is a patch.
  • .changeset/35174-action-api-platform-system-api-mark.md: frontmatter unchanged (@objectstack/runtime patch); the diff is one deleted line.
  • Clause-②: no. Agreed: no export added, removed or re-typed at either entry, no packages/spec/src path, no governed path, no schema. No (narrowing) arm is declared and none is owed by face: the tightened outcome is a refusal the page already states for an action body, on an api the same page said was missed (see ④).
  • Metadata-protocol: none. Agreed.

③ Boundary flags

  • Deviation: engine-scoped-context.ts touched under route B. Accepted. derive and the platformSystemApi facet body are in that file, and route B cannot keep the flag across sudo() or a transaction without derive (the PR's second ablation is that case). fix(objectql): a committed or rolled-back trio handle reads as closed #35541 is merged into the branch; Type Check and Test Core are green on the head.
  • Deviation: PR body section order. No contract effect. PR-body guards are green.
  • Deviation: two overlapping local gate sweeps. Moot here: the head's check-runs are the verdicts.
  • Deviation: file surface amended to include the 35174 note. This is the correction this record is owed for; judged in ④. Confirmed.
  • Route A rejected. The reason given holds in the tree: ObjectRepository is exported from both entries, and runtime's keepActionDoorProvenance passes repositories through unchanged (action-execution.ts, its repository mapper returns the repository as given), so execute runs on the engine's repository and sees no runtime layer.
  • Out-of-scope note, carrier: none: the header's "two of the apis" and row 1b's enumeration still name two apis. Not accepted as carrier-less. See S2.
  • open_questions: none. security_findings: none. I found no finding the dev should have raised beyond S1 and S2.
  • SQL push-down. No query, id materialisation or in-app join is added. The change is an instance flag and a branch. No finding.
  • Nothing to escalate.

④ Design judgment

Security. The change enforces a refusal the page already documents; it decides no new boundary. Row 1b on main already says an action body's system context is refused these writes and that ObjectRepository.execute sets the mark; this path was a stated miss of that rule, and the module header says outright that neither flag is a security boundary (a host handler holds the engine, whose createContext({ isSystem: true }) builds an unmarked system api). No reach is added or removed for host code.

Paths that must stay allowed, each read in the code:

  • The audit writer. The only production caller of platformSystemApi is plugin-audit/src/audit-writers.ts:1526, on a hook's api. A hook's api is buildHookApi(opCtx.context) at all five dispatch sites (engine-insert.ts:656, engine-update.ts:703, engine-delete-and-aggregate.ts:251, engine-find.ts:565 and :883), and buildHookApi is new ScopedContext(...) over the write's context, never derive from the writer's api. So a hook fired by a dispatched handler's write holds an unflagged api and the mark still comes off. The test's first CONTROL pins this.
  • A host handler's permanent delete. The flag is separate from appAuthored; ScopedContextFacet.object wraps the repository only on appAuthored, which execute never sets. The second CONTROL pins it, on the api and on platformSystemApi of it.
  • Every other system context. createContext (engine-compatibility-section.ts:127), buildHookApi and appAuthoredHookApi construct without flagging; only execute and a flagged parent's derive add to the set.

Flag leak: the set grows only at those two sites, and derive is the single constructor behind sudo(), withRunAs(...), both transaction branches, [PLATFORM_SYSTEM_API] and the seeds. It cannot reach an api not descended from a dispatched action's. Entries are weakly held.

Attempts to break it:

  • sudo(), then platformSystemApi: derive flags the child; pinned (sudo route).
  • Transaction: the joined and owned branches go through derive; the no-transaction-support branch hands back this.facade, the flagged instance itself. Pinned for the owned branch (trx route).
  • withRunAs('user'), then platformSystemApi: child flagged, the spread keeps the mark, sudo() re-elevates with it. withRunAs with no userId returns UnscopedHookApi, which has no such member, so platformSystemApi answers undefined.
  • Seeds: derive or this.facade. Flag kept either way.
  • Nested execute (the dispatched handler dispatches a third): a fresh api, flagged at construction.
  • execute from a non-dispatched api (bare engine api, an app-authored hook's wrapped repository, the action door's passed-through repository): all reach the same facet body. Pinned for two of them.
  • Chain platformSystemApi(platformSystemApi(api)): flagged in, flagged out.
  • A handler building its own api from the engine it holds: unflagged, as before, and declared not a boundary.
    None broke it.

.changeset/35174-action-api-platform-system-api-mark.md (the correction).

  • The dropped bullet, "Not covered: the api ctx.api.object(o).execute(name) hands the action it dispatches is built by the engine, not the action door, so platformSystemApi still takes the mark off there": its first half is still true, its conclusion is false at this head (engine-scoped-context.ts:136). Shipped beside the 35434 note in one release it would contradict it. Dropping it is correct.
  • Every remaining sentence was read against the head. The action-door flag, the permanent delete, the audit writer's api and the derivation walk are runtime's and untouched by this diff. The last bullet ("@objectstack/objectql is unchanged but for its module header") describes PR fix(runtime): platformSystemApi on an action handler's ctx.api keeps the 'action' mark, and what it returns stays seam-wrapped #35383's own change and stays true of it. Nothing else in the note is false, and nothing else in it changed: the diff is that one line.
  • The correction is confirmed.

.changeset/35434-execute-dispatched-action-keeps-mark.md.

  • Lead paragraph: holds (execute marks 'action'; at the merge base the api was a bare new ScopedContext, neither flag).
  • Bullet 1: holds, sentence by sentence, per the derive analysis above; PERMISSION_DENIED / 403 "whichever api dispatched" and the owner stamp are pinned.
  • Bullets 2 and 3: hold (the two CONTROLs).
  • Bullet 4, second sentence ("No new export, and no published signature changes"): holds (①).
  • Bullet 4, first sentence: see S1.

packages/objectql/src/engine-object-repository.ts. The docblock on the set agrees with the code line by line. execute flags the one api it builds.

packages/objectql/src/engine-scoped-context.ts. derive and platformSystemApi agree with their docblocks and with platform-system-api.ts's contract. ScopedContextFacet.sudo.call(this) on a flagged, non-app-authored api adds no 'hook' mark and keeps the 'action' one, which is what the owner stamp needs.

packages/objectql/src/platform-system-api.ts, content/docs/permissions/system-context.mdx row 1b. The removed clauses were false at this head. Every remaining sentence is true. See S2 for what they now leave out.

Findings:

S1 (should-fix) — .changeset/35434-execute-dispatched-action-keeps-mark.md, last bullet: "This closes the path the previous note on platformSystemApi named as not covered." At this head no note names it: the same PR deletes that bullet from the 35174 note, and both notes ship in one release. The sentence was written before the fix round and now points at text that will never be published. Reword it to stand alone, for example "This is the path the action-door fix in this release did not reach." Not a must-fix: the note's claims about behaviour are all true.

S2 (should-fix) — packages/objectql/src/platform-system-api.ts header ("That line holds on two of the apis the automation is handed") and row 1b ("On an app-authored hook's api and on the api an action door hands its handler ... and on every api derived from either") still enumerate two apis. At this head the line holds on three, and "two of" now reads as a limit the code no longer has. Neither sentence is false, and the card's Done-when asked only for the clause to go, so this does not block; but the page is the census of system-context behaviour and the third api is documented only at the flag. The dev's carrier: none is not accepted: name the dispatched action's api in both enumerations, here or on a filed follow-up card.

N1 (nit) — the integration test pins the direct, sudo() and owned-transaction routes from two dispatch origins. The withRunAs(...) and seed derivations the note also names, a nested execute, and the owner stamp from the bare engine origin rest on the single derive seam, read in code, not on a case.

No must-fix.

Implemented-by: claude/issue-35434-execute-keeps-action-mark
Reviewed-by: session_01L9qibwJEh7hMPPvagWM1g7

VERDICT: PASS

…mApi enumerations; the changeset bullet stands alone

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 0a28c2810934861aaadc66e469e2af4295c216dd
Local-runs: none
Scope: .changeset/35174-action-api-platform-system-api-mark.md, .changeset/35434-execute-dispatched-action-keeps-mark.md + packages/objectql/src/engine-object-repository.ts, packages/objectql/src/engine-scoped-context.ts, packages/objectql/src/platform-system-api.ts, content/docs/permissions/system-context.mdx
Security-touching: yes

Delta record. It follows record 7030697220 on 186bbc489c00f71d513eac6e3550aa13fa820ffb and reads only the delta to this head: one commit, 0a28c28109, 3 files, +11/-5 (.changeset/35434-execute-dispatched-action-keeps-mark.md, content/docs/permissions/system-context.mdx, packages/objectql/src/platform-system-api.ts). Everything the earlier record judged outside these hunks is byte-identical at this head and stands as judged there.

① Derived judgments

  • The delta is prose and one block comment. No executable line, export, signature or accept set changes; .changeset/35174-action-api-platform-system-api-mark.md, engine-object-repository.ts and engine-scoped-context.ts are not in it. The earlier record's derived judgments carry over unchanged.
  • Gate verdicts on this head: NOT IN at read time. Concluded and success: Auto Label, Check Documentation Links, Check PR Size, Dogfood Regression Gate, Governed Surface Queue Guard, PR-body guards, Spec property liveness, Test UI, filter. Still in_progress: Check Changeset, Build Core, Build Docs, Flag docs affected by code changes, every Lint job, every Type Check job, Plan Test Core shards (so Test Core has not started), Live E2E UI. This record judges the sentences; it does not stand in for those runs. The seat reads their conclusions before it lands. Check Changeset is expected red for the same DELIBERATE CORRECTION row as before (the 35174 note is unchanged since 186bbc489c); any other red is new and is not covered here.

② Semver level

  • Unchanged: @objectstack/objectql patch; the frontmatter of both notes is untouched by the delta.
  • Clause-②: no. Agreed, as before.
  • Metadata-protocol: none. Agreed.

③ Boundary flags

  • The dev's one carrier-less out-of-scope note (the two enumerations) is now answered in the tree; see S2.
  • No new flag, deviation or open question arises from a prose-only commit. SQL push-down: nothing added. Nothing to escalate.

④ Design judgment

Each changed sentence, against the code at this head:

  • .changeset/35434-execute-dispatched-action-keeps-mark.md, last bullet: "This is the path the action-door fix in this release did not reach." True, and it stands alone: the action-door fix is the pending 35174 note (runtime's keepActionDoorProvenance), whose layer never wraps the api execute builds. It no longer refers to deleted text.
  • platform-system-api.ts header: "three of the apis ... and on every api derived from any of them", plus the third bullet. True clause by clause: the api carries the dispatched action's origin flag (markDispatchedActionApi in execute); derive copies it (engine-scoped-context.ts:91); the member answers with the api's sudo() (:136), so the 'action' mark stays; it is not the app-authored flag, and the reason given for the action door's flag (the permanent delete, ADR-0148 D3) is the reason given at the set's own docblock.
  • Row 1b: the enumeration now names the api ObjectRepository.execute hands the action it dispatches, "and on every api derived from any of them". True, same evidence. The rest of the row is unchanged.

Findings:

S1: closed
S2: closed
N1: open, a nit, unchanged (no test in the delta); it does not block.

No must-fix, no should-fix.

Implemented-by: claude/issue-35434-execute-keeps-action-mark
Reviewed-by: session_01L9qibwJEh7hMPPvagWM1g7

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

席位核对

L1 delta: ACCEPT on content (L1-a, for area d7-B) at head 0a28c2810934861aaadc66e469e2af4295c216dd, read 2026-11-20T04:50Z. This covers the delta from my ACCEPT at 186bbc48 (7030623398), whose other findings carry over.

Delta: one commit (0a28c281, parent 186bbc48), three files, prose and comments only. No code line moves, and the test file is untouched.

  • S1, .changeset/35434-…, last bullet. The new text, "This is the path the action-door fix in this release did not reach. No new export, and no published signature changes.", stands alone. It no longer leans on the 35174 note's removed "Not covered" bullet. Both notes ship in the same release, so "this release" is true.
  • S2, the platform-system-api.ts header. "two of the apis … either" becomes "three … any of them". The new third bullet says execute's api carries the dispatched action's origin flag, derive copies it, and platformSystemApi answers it with sudo(), mark kept, and it is not the app-authored flag. That matches DISPATCHED_ACTION_APIS, ScopedContextFacet.derive and ScopedContextFacet.platformSystemApi at this head. One punctuation change on the previous bullet (. to ;).
  • S2, system-context.mdx row 1b. The enumeration now names "the api ObjectRepository.execute hands the action it dispatches (ctx.api.object(o).execute(name))", with "derived from any of them". Every other sentence in the row is unchanged, and it is true at this head.
  • The PR body correction I asked for is done. ## Acceptance notes now says the 35174 note "is edited here as a seat amendment … see DELIBERATE CORRECTION".
  • Gates, not yet measured. CI at 0a28c281 had not concluded when I read it: 9 success, 15 skipped, 18 in_progress. I record no gate reading for this head. Before landing, the area confirms every check run is success or skipped, except the two Check Changeset runs. Those may stay red only as the same foreign-note refusal on .changeset/35174-action-api-platform-system-api-mark.md alone, read from the log as at 186bbc48.

Contract review. The delta L2 by the same reviewer covers S1 and S2 at this head, and it is still the record that confirms the DELIBERATE CORRECTION (landing-operations.md). Landing waits for that PASS at 0a28c281.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Landing · 2026-11-20T05:18Z · head 0a28c2810934861aaadc66e469e2af4295c216dd

Probe Reading
L1 ACCEPT 7030623398 at 186bbc48, delta ACCEPT 7030759599 at this head
L2 (CONTRACT_REVIEW_TIER) PASS 7030697220 at 186bbc48 (S1, S2 should-fix), delta PASS 7030755180 at this head (S1, S2 closed; N1 nit open, non-blocking) — confirms the DELIBERATE CORRECTION of .changeset/35174-action-api-platform-system-api-mark.md
check-governed-merges.mjs --pr 35733 NOT governed, 0 of 7 paths; +292 / −18 ≤ 3000
CI at this head 39 success, 15 skipped, 1 red = Check Changeset, the declared foreign-note refusal on the 35174 note only (log read; explained in 7030218346): red by design in its source, pull_request-only (no merge_group), not required
K (Affected-set diff base 03bce5c → origin/main) 3 (< 15) · no merge=os-regen path

State: pr_ready + automerge_enable under the maintainer's standing landing go-ahead (2026-10-30: 「按 pm-dispatch 审过的pr你可以自主落地」). On MERGED, #35434 closes by Fixes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 05:18
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 44680251229 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (3/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/approval-read-over-mcp.dogfood.test.ts > an approver's agent lists the approvals waiting on them over MCP (#32442, read half) > ⭐ the query tool's tex
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected 'Query records from an object with opt…' to contain 'sys_approval_request'
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 16 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Queue-failure triage · 2026-11-20T05:47Z

Failed build 44680251229 (base b529eb9bc7) is the stacked build behind the S1 root #35662 in #35756, so this PR inherited the approval-read-over-mcp.dogfood red. It does not cause it: the diff touches only the objectql platformSystemApi flag, docs and changesets, not the MCP query tool text the assertion reads. GitHub already rebuilt this entry on base 509289c6a8. That build is 44680530329: CI success, Dogfood Regression Gate (3/3) green. #35736's build stacked on it is green too. The entry is still queued, so there is no requeue and no action. Root-cause discussion stays in #35756.

Merged via the queue into main with commit 4890cd0 Nov 20, 2026
55 of 56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35434-execute-keeps-action-mark branch November 20, 2026 05:56
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.

platformSystemApi on the api ObjectRepository.execute hands a dispatched action sheds the 'action' mark

2 participants