Skip to content

feat(test): stateful lifecycle replay for the contract matrix (#218 stage 2) - #309

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
wave/218-s2
Sep 2, 2026
Merged

feat(test): stateful lifecycle replay for the contract matrix (#218 stage 2)#309
ScriptedAlchemy merged 1 commit into
mainfrom
wave/218-s2

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Stage 2 of the #218 contract matrix: stateful lifecycle replay across both existing boundaries, riding the single packed journey.

  • ContractRouteFixture.lifecycle: a project-supplied deterministic transition driver walks one tool through unknown → queued → running → first-progress → repeated-progress → terminal over the matrix's one open client connection; the framework owns transport, phase order, per-phase structured-content/rendered-output validation, per-phase additive/closed compat probing, and module-backed serialized round-trips where the boundary can load route modules (honest not-applicable at packed, stage-1 reasoning).
  • Live-progress-before-terminal is proven at the wire: per-call progress tokens count notifications/progress received before settlement; a fixture that stops emitting progress fails the live-progress-before-terminal check (negative test included).
  • Stateful checks on the Track remaining #98 state-kernel scope: warm-runtime process state, generated-runtime state mounting, budgets, lifetime visibility #233/feat(state): kernel budgets and lifetime visibility (#233 items 3-4) #268 state kernel via the new lifecycle route-harness tool (mounted defineState, workspace-durable): state-journal (sequential events accumulate), state-notice (declared notice observable at terminal), state-idempotency (same idempotency key replays without double-apply, same revision), state-budget (a commit past maxEventBytes fails typed budget-exceeded at the commit boundary with revision unchanged).
  • restart-durability: a caller-owned same-store restart callback (in-memory reopens the same sqlite store; packed reuses the existing packed journey's process restart — no second pack/build). Without a callback the check is honestly not-applicable.

Deferred (recorded on #218): state-lifetime catalog / WarmRuntimeIdentity identity assertions depend on #269; restart proves same-artifact same-store durability, not artifact-rebuild replay (stage 4 / #179 territory).

Gates (local, rebased on 0560c75)

pnpm build · pnpm typecheck · pnpm lint (0/0) · pnpm test:unit (2568 passed; one unrelated native-claude-contract 5s timeout under full-suite load, passes in isolation) · pnpm test:route-unit (24) · pnpm test:projection (58) · pnpm test:packed (26 passed / 1 skipped) — packed journey unchanged in count, extended in assertions.

@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 54557e6

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 Minor

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

@ScriptedAlchemy
ScriptedAlchemy merged commit 78b3b6d into main Sep 2, 2026
4 checks passed

@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: 54557e6d28

ℹ️ 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 on lines +907 to +909
client.setNotificationHandler('notifications/progress', (notification) => {
if (notification.params.progressToken === progressToken && !settled) liveProgress += 1;
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the caller's progress notification handler

When a lifecycle fixture runs against the caller-owned packed session, each transition replaces the client's existing notifications/progress handler, and the final replacement remains installed after runPackedContractMatrix returns. A caller that registered a progress listener and then reuses the still-open session will silently stop receiving progress because the retained closure only counts the last lifecycle token while unsettled. Collect lifecycle progress without permanently overwriting the caller's handler, or restore/compose the handler when replay finishes.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 54e4c4c09: lifecycle replay now composes its progress observer with the session’s existing handler and restores that exact handler in finally. The shared-session regression proves both notification delivery and handler identity after replay. Merged via #318.

@chatgpt-codex-connector

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-02T17:58:06.621761Z 54557e6 PR opened
ℹ️ 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.

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.

1 participant