Repository navigation
test(example-todo): boot the MCP action drive with its Default Organization and run it in the example suite - #31230
Merged
Conversation
Pure rename, no content change, so the conversion that follows diffs against the original script. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5k9SPSJRVA5sTSKkU8
…zation and run it in the example suite The manual test:mcp script booted a kernel that registers no organization object, so the app seed and every system insert were refused with 'Organization is required' from step 3 on, and nothing ran it. It now mounts plugin-auth's identity objects (the reduced-kernel recipe that creates the Default Organization before AppPlugin seeds), pins that the seed landed, and runs as a vitest file in the example's own pnpm test. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5k9SPSJRVA5sTSKkU8
…ization boot Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5k9SPSJRVA5sTSKkU8
check:test-source-alias: the new suite imports @objectstack/mcp, @objectstack/runtime and @objectstack/plugin-auth, which resolved through dist/. Anchored array-form aliases point them at src/, with the console intercept disarm the config owed once it stopped re-exporting the preset. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5k9SPSJRVA5sTSKkU8
Contributor
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
Contributor
Author
|
domain:devx#3 · os-project-manager · session_01FEkQ5njkh3xbcDN6EtSfw7 席位核对Verdict: ACCEPT · head
Generated by Claude Code |
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Leehom · project thread
Fixes #30928
Clause-②: no
Metadata-protocol: none
维护者速读
examples/app-todo的 MCP 业务动作端到端脚本改成普通 vitest 测试test/mcp-actions.test.ts,随该示例自己的pnpm test在 CI 里跑;启动时挂上 plugin-auth 的身份对象(createIdentityObjectsPlugin()),于是装机在种子加载前就有默认组织。原test:mcp脚本删除。main上第 3 步失败(「Organization is required」):它的内核不注册组织对象,种子和系统写入都被拒;且没有任何流水线跑它。卡片要求「修好启动,再接入一条会跑的流水线或证明已有覆盖后删除」:实测没有重复覆盖,选接入。examples/app-todo/test/mcp-actions.test.ts的beforeAll启动顺序与第一条用例(默认组织与种子);②examples/app-todo/vitest.config.ts(三个平台包按源码解析);③examples/app-todo/package.json。pnpm --filter @objectstack/example-todo exec vitest run test/mcp-actions.test.ts,预期 9 条全绿。What changes
The manual
test:mcpscript now boots with an organization and runs in a lane.main(re-measured at4c318214)pnpm --filter @objectstack/example-todo test:mcpexits 1 at step 3: the app seed and the step-3 insert are refused withOrganization is required. The kernel registered no organization object, so nothing created the Default Organization asingleinstall holds before seeds load (ADR-0131 D3/D9). The suite now mountscreateIdentityObjectsPlugin()from@objectstack/plugin-auth: plugin-auth's identity objects with the same Default Organization invariantAuthPlugin.start()keeps, and no authentication mounted. This is the reduced-kernel composition plugin-auth'sidentity-objects-plugin.tsheader documents for an app's own test suite, andAppPluginalready orders it ahead of its seed. No platform package changes.test/mcp-actions.e2e.ts(atsxscript) becomestest/mcp-actions.test.ts(vitest; a pure rename commit first, then the conversion). The default vitest include picks it up, so it runs in the example's ownpnpm test, which CI's Test Core shards run. Thetest:mcppackage script is removed. Each step is one case withexpectassertions in place of the script'scheck()counter; step state no longer leaks between cases (steps 5 and 6 seed their own task).examples/app-todo/vitest.config.tsstops re-exporting the shared preset and declares anchored array-form aliases that resolve@objectstack/mcp,@objectstack/runtimeand@objectstack/plugin-authto theirsrc/index.ts, becausepnpm check:test-source-aliasrefused the new suite's threedist/imports (measured red, exit 1, on the first head). It keepsdisableConsoleIntercept: trueitself, asexamples/app-crm/vitest.config.tsdoes, becausecheck:console-intercept-disarmjudges only a bare preset re-export as the preset.test/seed-check.ts(bounded in-place fix, same defect class, same file family): the second manualtsxscript exited 1 onmainwith the same eightOrganization is requiredseed refusals; withcreateIdentityObjectsPlugin()mounted it printsFound Tasks: 8and exits 0. No lane runs it, and the new first case of the suite pins the same seed rows.Learn ObjectStack,Build a cool app): the card's failure, pinned.@objectstack/plugin-authis added as aworkspace:*devDependency of@objectstack/example-todo, with itspnpm-lock.yamlimporter link (3 lines, generated bypnpm install).test/node-shim.d.ts,test/task-completion-trigger.test.ts, and the one comment line inpackages/mcp/src/mcp-action-confirmation-member.test.tsthat names this file as where the confirmation gate's two halves run together (comment only; on the claim's amended surface).Tests
pnpm --filter @objectstack/example-todo exec vitest run test/mcp-actions.test.ts: 9 passed (9); the file line reads 906 ms (default reporter, file time).examples/app-todoon the final head (with the source aliases): Test Files 9 passed (9), Tests 249 passed (249), exit 0.pnpm typecheck(tsc --noEmit, includestest/**): exit 0.packages/mcp:vitest run src/mcp-action-confirmation-member.test.ts6 passed (6) (comment-only edit).tsx test/seed-check.ts: exit 1 before (eight seed refusals), exit 0 after (Found Tasks: 8).node scripts/ablation-replace.mjs --deleteof thecreateIdentityObjectsPlugin()line landed (anchor 1 -> 0, blob08e51a7e->e95cbeaa), the file then read 5 failed | 4 passed: the new boot case (Object 'sys_organization' not found) and steps 3, 5, 6, 7 (ValidationError: Organization is required, the card's failure). Restored: blob == HEAD08e51a7e,git diff HEADempty.Acceptance notes
Coverage measured before choosing (the card's "name which one"). The candidates that drive actions over MCP with more than a stubbed bridge:
packages/mcp/src/mcp-action-confirmation-member.test.tsandmcp-action-tools.test.tsdrive the realMCPServerRuntimedoor, but over a bridge double; the first file's header names this script as the only place the door and the runtime gate run together against a real engine.packages/runtime/src/action-confirmation-gate.test.tspins the gate predicate by callinginvokeBusinessActiondirectly, without the MCP door.packages/qa/dogfood/test/mcp-system-object-action-exposure.dogfood.test.tsdriveslist_actions/run_actionthrough live MCP on a booted showcase, including a 428 refusal and the confirmed call, but only for platformsys_useractions oftype: 'api'(a forward), and dogfood does not run in PR CI.mcp-delete-record-confirmation.dogfood.test.tsis thedelete_recordtool, notrun_action.None drives an app's
type: 'script'action with a registered handler, therequiredPermissionsgate (ADR-0066 D4), or theai.exposedgate on an app object throughMCPServerRuntime→HttpDispatcher.buildMcpBridge→ a real engine and driver. So no duplicate exists at a layer as close to the code, and the script is wired, not deleted.Why this boot and not the example testkit.
test/default-organization.testkit.ts(installDefaultOrganization) registers the organization after the engine is up and writes the row through the driver. Measured: called afterkernel.bootstrap()it is too late forAppPlugin's seed (eightOrganization is requiredseed refusals at boot), and step 3 is then refused withSystemWriteOrganizationRequiredErrorbecause the engine memoised the empty organization probe during the seed. The plugin creates the organization instart(), ahead of the seed, the way a real install does.@objectstack/example-todoisprivate: trueand ships nothing; the only non-example file is a test-file comment inpackages/mcp(not in that package'sfiles[]), soskip-changeset.Verification
Gate union derived by
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackon the final head, each exit captured before any pipe, reconciled with--ran, on heade2ebb1ea:--ran: "64 derived famil(ies) accounted for — 64 run, 0 NOT-MEASURED".59c1bd94) readpnpm check:test-source-aliasred (exit 1, the three newdist/imports); the source aliases are the fix, and the second run is green.node scripts/check-plugin-teardown-shape.mjs --self-testneeded its pinned fixture on this shallow clone (git fetch --depth=1 origin 621a4876), then exit 0.COMMAND :: exit Nline per family, kept with the seat.Scoped lint:
pnpm exec eslint --no-inline-config examples/app-todo packages/mcp/src/mcp-action-confirmation-member.test.ts, exit 0.CI families are read from this PR's check-runs, not re-run here.
Generated by Claude Code