Skip to content

fix(test): cover MCP App routes in the packed contract matrix without hand-enumerated fixtures (#401) - #417

Merged
ScriptedAlchemy merged 3 commits into
mainfrom
fix/401-contract-matrix-app-coverage
Sep 3, 2026
Merged

fix(test): cover MCP App routes in the packed contract matrix without hand-enumerated fixtures (#401)#417
ScriptedAlchemy merged 3 commits into
mainfrom
fix/401-contract-matrix-app-coverage

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #401. runPackedContractMatrix demanded a fixture entry for every compiled MCP App route (app:<id> / coverage: compiled route has no fixture entry) while the JSDoc, README, and agent-bundle/test header said apps were "non-app only" / "not registered at this level". The packed sweep is useful for apps (surface + ui:// read), so the sweep stays and the code and docs now agree:

  • App coverage per level. At every boundary that registers app resources (packed-stdio, packed-deleted-source, host-install, dev-epoch) app routes are part of the matrix: surface-completeness requires the compiled ui:// URI in listResources, sweep reads it. mcp-in-memory keeps apps not-applicable (surface only, no coverage/sweep).
  • apps: 'auto' | 'explicit' (default 'auto') on ContractMatrixOptions, PackedContractMatrixOptions, DevEpochContractMatrixOptions, InstalledHostContractMatrixOptions. With 'auto', an app route needs no fixture; coverage passes with reason app route auto-covered (apps: "auto"): the sweep reads its compiled MCP App resource URI. 'explicit' restores the old requirement.
  • { kind: 'resource' } typed fixture form (ContractResourceFixture; ContractRouteFixture.kind?: 'resource'). Legacy {} is still accepted, so no existing consumer breaks (a discriminated-union approach was tried and rejected because it broke { ...fixture, lifecycle } spreads on ContractRouteFixture). A resource fixture on a tool/prompt route is a coverage failure. The dev-epoch fixture validator (config/dev-contracts.ts) accepts kind.
  • Cancellation wording. runCancellation now records whether the abort timer fired before the call settled (abortFired captured inside the settlement .then). Settled-before-abort → not-applicable with invocation completed before abort; use an input that stays in flight past <n>ms. (or invocation rejected before abort (...) when it threw for an unrelated reason). failed('aborted callTool settled without throwing or rejecting.') is only reported when the abort was delivered in flight.
  • Docs: contract.ts header + JSDoc, README "Contract matrix" section (new per-level app-coverage and cancellation paragraphs, example), src/test/index.ts level table.
  • Changeset .changeset/401-contract-matrix-app-coverage.md (agent-bundle: minor — new public option/type).

Evidence

Local, from the worktree (logs under /tmp/lane-401/):

  • pnpm typecheck ✅, pnpm lint ✅ (0 errors / 0 warnings, 1046 files)
  • pnpm test:projection ✅ 73/73 (contract-matrix.test.ts 20/20 incl. 7 new)
  • pnpm build && pnpm test:integration:run ✅ 947 passed / 32 skipped / 0 failed — includes packed-stdio-projection.test.ts, which now runs the real packed-deleted-source matrix without an app:harness/panel fixture and asserts coverage: passed (auto-covered), surface-completeness: passed, sweep: passed for the app.
  • pnpm test:unit 2727/2734 with 2 five-second timeouts, pnpm test:route-unit 36/37 with 1 five-second timeout — machine load average 40–68. lifecycle-replay.test.ts and rsc-runtime/tests/dispatcher.test.ts pass in isolation. native-claude-contract.test.ts :: fails closed when … still hit the 5 s timeout alone under load; it imports only core/errors, core/strict-json, and Node builtins — nothing in this diff — so CI is the arbiter.

Test plan

  • packed matrix over a server with an app route and no app fixture passes; app reported coverage passed (auto-covered reason) + surface-completeness + sweep passed (contract-matrix.test.ts, and the real packed journey in packed-stdio-projection.test.ts)
  • explicit { kind: 'resource' } accepted for app and resource routes (apps: 'explicit')
  • apps: 'explicit' with no app fixture → app:harness/panel / coverage violation naming apps: "explicit"
  • mcp-in-memory still reports apps not-applicable even with apps: 'explicit' and an app fixture present
  • { kind: 'resource' } on a tool route → coverage violation
  • cancellation: call settles before abort (abortAfterMs: 1500, holdMs: 1) → not-applicable "invocation completed before abort; use an input that stays in flight"
  • cancellation: abort delivered in flight but call settles without rejecting (client wrapper drops the signal for wait, holdMs: 400, abortAfterMs: 50) → still failed('aborted callTool settled without throwing or rejecting.')
  • CI green

@changeset-bot

changeset-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 49cd737

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-bundle Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T09:51:43.764943Z 49cd737 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41cb4aaaa6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .changeset/401-contract-matrix-app-coverage.md Outdated
Comment thread .changeset/401-contract-matrix-app-coverage.md Outdated
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

@codex review

@pkg-pr-new

pkg-pr-new Bot commented Sep 3, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@417
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@417
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@417

commit: 49cd737

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bffb19c4c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/agent-bundle/src/test/contract.ts
ScriptedAlchemy added a commit that referenced this pull request Sep 3, 2026
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: e183d26619

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

… hand-enumerated fixtures (#401)

App routes are covered at every boundary that registers app resources
(packed-stdio, packed-deleted-source, host-install, dev-epoch) and
auto-covered with the new default `apps: 'auto'`; `apps: 'explicit'`
restores the fixture requirement. `{ kind: 'resource' }` names a
resource/app fixture explicitly (legacy `{}` still accepted) and is a
coverage failure on tool/prompt routes. mcp-in-memory keeps apps
not-applicable. The cancellation check now tracks whether the abort fired
before settlement and reports not-applicable ("invocation completed before
abort; use an input that stays in flight") instead of failed.
@ScriptedAlchemy
ScriptedAlchemy force-pushed the fix/401-contract-matrix-app-coverage branch from e183d26 to 49cd737 Compare September 3, 2026 09:48
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 49cd737bd6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ScriptedAlchemy
ScriptedAlchemy merged commit c8504ba into main Sep 3, 2026
11 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the fix/401-contract-matrix-app-coverage branch September 3, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runPackedContractMatrix: coverage check requires a fixture for app routes, contradicting the docs

1 participant