Skip to content

Teardown safety & ctx.state authoring channel (0.10.0)#25

Merged
jbrecht merged 1 commit into
mainfrom
fix/dogfood-0.9.1
Jun 13, 2026
Merged

Teardown safety & ctx.state authoring channel (0.10.0)#25
jbrecht merged 1 commit into
mainfrom
fix/dogfood-0.9.1

Conversation

@jbrecht

@jbrecht jbrecht commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Addresses the second umami dogfooding pass (issues filed against 0.9.0). Six of seven issues cluster around the setup/teardown lifecycle #8 introduced — a correctness hole (leaked seed data) and an ergonomic hole (no adapter→tutorial state channel). Released as 0.10.0 (minor: includes additive API).

Bug fixes (teardown coverage)

Additive API

Docs

Design note

#15/#16/#19 all needed "run the teardown chain safely," so runTeardownChain() was extracted into pipeline/step-hooks.ts as the single entry point for record, preview, and the doctor probe.

Tests (#22)

  • New packages/core/test/step-hooks.test.ts: teardown-chain ordering (LIFO), keeps-going-on-failure, value-returning thunks, typed-state compile check.
  • New e2e assertions: setup-failure teardown, preview teardown, ctx.state handoff, probeAdapterSetup (success + failure-still-tears-down), partial failure contact sheet.

Verification

pnpm build + pnpm typecheck (core, cli, example-app) clean · pnpm test (97 unit tests) green · pnpm e2e green. Code-reviewed: no must-fix findings; double-close / error-swallow / browser-cleanup / sheet-masking-StepError all verified correct.

Closes #15, #16, #17, #19, #20, #21, #22, #23. Addresses #18 (docs); code half tracked in #24.

🤖 Generated with Claude Code

Second umami dogfooding pass (on 0.9.0) surfaced a setup/teardown lifecycle
cluster plus the ergonomic gap per-tutorial setup opened. Shipped as 0.10.0.

Bug fixes (teardown coverage):
- #15 setup-phase failures (adapter.setup / tutorial.setup) now run the full
  teardown chain before rethrowing, instead of leaking seeded data
- #16 preview runs the full teardown chain on every exit path, not just step
  thunks — no more orphaned adapter seed on the run-repeatedly iterate tool
- #20 a failed render with contactSheet on emits a partial sheet (completed
  steps + the failure frame), the at-a-glance view you most want on failure
- #21 widen onTeardown return type to () => unknown | Promise<unknown>

Additive API:
- #17 typed ctx.state: adapter.setup's return lands on ctx.state, read by
  tutorial.setup and steps — replaces the module-global + `!` handoff; typed
  end-to-end via TutorialAdapter<S> / tutorial<S> / step<S>
- #19 doctor --setup / probeAdapterSetup: actually run adapter.setup and tear
  it down, catching the reachable-but-wrong-database class of failure

Docs (#18, #23): networkidle/startTransition caveat + waitFor guidance;
ctx.state section and a teardown-coverage matrix in adapters.md.

Tests (#22): runTeardownChain extracted as the single teardown entry point for
record/preview/doctor; new unit suite (step-hooks.test.ts) and e2e assertions
for setup-failure teardown, preview teardown, ctx.state handoff,
probeAdapterSetup, and the partial failure contact sheet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Setup-phase failures (adapter.setup / tutorial.setup) skip teardown → seeded data leaks

1 participant