The plan asked Task 2.3 to decide between two answers; the decision and what the runtimes actually allow now sit in it, so the next reader is not re-deriving either. The Deno constraint in particular was found by measurement and is not in any issue. Adds Task 2.5 for the plugin/provider teardown idea, kept out of the #15 work on purpose: it needs a new await-aware surface on PluginApi, because the existing Bus is a synchronous observer by design and cannot be made to hold up a shutdown without losing the guarantee that makes it safe. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
18 KiB
Trust Release Plan
For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Close the gaps that four independent evaluations agree on, in the order that makes each one cheap. Prove portability in CI, make derived execution explainable, ship an observability contract, and move the documentation site out of the core repository so it gets its own lifecycle.
Architecture: Nothing here adds a runtime dependency. The observability work is a contract plus emission points, with exporters living outside core. The explain work is a resolver over data explainRoute already returns. The runtime matrix runs suites that already exist. The docs split moves a directory that is already self-contained.
Tech Stack: TypeScript, legacy decorators, Vitest, Deno/Bun/Workers runtimes, JSR, Astro/Starlight, GitHub/Gitea Actions.
Why this order
The four reports in .specs/reports/ were written independently and converge on one gap. Observability is the only dimension the CTO due diligence marks as risk Alto on its own (§5.3, risk register), it is P0 twice in the Trust Release report (§4, §5), and it is a listed con in the lead-dev report (§4). That is GH #10, and it is the largest item here — which is exactly why it is not first. The three phases before it are cheap, unblock evidence, and produce the material that #10's design needs.
Two things the reports demand that had no issue filed, both verified against the code rather than taken on the report's word:
- Runtime matrix in CI.
package.json:91-93definestest:deno,test:bunandtest:edge..github/workflows/ci.ymlruns none of them.AGENTS.md:23already warns thatnpm testdoes not cover the other runtimes — and CI does not close that. The framework's headline claim has no CI evidence. Trust Release §7 (P0), CTO §8.2 and P0-6. explain()does not explain causality.src/app/introspect.ts:62returns a flatchainwithneeds/providesper node, but never the edge from a need to the node that produced it. Trust Release §2 (P0).
One thing that has an issue but appears in no report: #13 circuit breaker. Neither the CTO report nor the Trust Release report raises it; the nearest item is "rate limiter" under the CTO's security pack (P0-3), which is a different mechanism. The issue itself already says a worked example in the docs might close it outright. It is scheduled last, as documentation.
API freeze is deliberately not a phase. README.md:276 already declares it under **next**. It needs the RC boundary, and freezing a public surface before #10 lands would freeze an API that is still missing its observability contract. What this plan adds instead is a stability contract — a statement of which areas are volatile today, which promises nothing and commits to no date (Task 6.1).
Out of scope: #21 and #17. Both are claimed by hgshreyas with the design already settled in the issue threads. Do not touch them.
Phase 0: Unblock releases
Task 0.1: Scope the audit gate in stage and release
Files:
- Modify:
.github/workflows/stage.yml - Modify:
.github/workflows/release.yml
AGENTS.md:71 states the policy: npm audit --omit=dev blocks, everything else is continue-on-error. ci.yml:56-59 implements it. stage.yml:21 and release.yml:26 run bare npm audit, so a dev-only advisory blocks a publish. This is drift, not a second policy.
That drift is what stopped work twice. The nanoid advisory reached the tree through tsup → postcss → nanoid — a build-tooling path that ships to nobody.
Step 1: In both files, change npm audit to npm audit --omit=dev, and add a non-blocking full npm audit with continue-on-error: true after it so the advisory is still visible in the log.
Step 2: Carry a comment on the blocking step pointing at the rule, in the voice ci.yml already uses — the next person to read it should see a decision, not an omission.
Verify: grep -n "npm audit" .github/workflows/*.yml — every blocking occurrence carries --omit=dev.
Phase 1: Prove portability, and publish to JSR
These are one phase because they are one subject. The type error JSR found is on the app.fetch path, which is the path Deno, Bun and edge all use; a runtime matrix would have caught it first. Fixing them together means the matrix has a green baseline to protect.
Task 1.1: Fix the BodyInit hole on the Fetch path
Skills: @superpowers:test-driven-development
Files:
- Modify:
src/http/web.ts - Test:
test/(the Fetch adapter suite)
Gitea #19 reports, from a real deno publish --dry-run:
TS2345: Argument of type 'string | Buffer<ArrayBufferLike> | null' is not
assignable to parameter of type 'BodyInit | null | undefined'.
--> src/http/web.ts:112:23
Buffer is not a valid BodyInit under Deno's lib. It works at runtime because implementations are forgiving, which is what makes it worth fixing before a user reports it as a bug: it is a genuine typing hole on the runtime-agnostic path, not a JSR formality.
Step 1: Write a failing test that drives a Buffer body through the Fetch adapter and asserts the response body round-trips byte-for-byte.
Step 2: Narrow the body to a real BodyInit at the boundary — convert the Buffer to a view its type declares, rather than casting the error away. A cast would keep the hole and hide it.
Step 3: Confirm the test passes and npm run typecheck is clean.
Task 1.2: Give the slow-type sites explicit return types
Files:
- Modify:
src/metadata.ts(11 sites) - Modify:
src/params.ts(6 sites)
Two shapes, both mechanical: missing-explicit-return-type on factory functions (routeDecorator at src/metadata.ts:103, envelope at src/params.ts:35) and missing-explicit-type on the exported constants built from them (export const Get = routeDecorator('GET', 'buffer') at src/metadata.ts:126).
Do not pass --allow-slow-types. That flag degrades generated declarations and makes type checking 1.5–2× slower for consumers, in the framework whose central claim is type safety. Shipping it would contradict the pitch on its own install page.
Step 1: Annotate the factories first — several of the constant errors resolve on their own once the factory's return type is written down.
Step 2: Annotate whatever constants remain.
Step 3: deno publish --dry-run reports zero slow types, with no flags.
Verify: npm run typecheck and npm test still clean; the public types in dist/ are unchanged or strictly more precise.
Task 1.3: Runtime matrix in CI
Files:
- Modify:
.github/workflows/ci.yml
The suites exist and CI ignores them. Add a matrix job that runs test:deno, test:bun and test:edge alongside the Node build.
Step 1: Add a job with the three runtimes, each installing its own toolchain. Keep it a separate job from build so a Bun failure reports as a Bun failure and does not bury the Node lint output — the same reasoning ci.yml:53 already applies to the audit step.
Step 2: Confirm the forge difference documented at AGENTS.md:73 does not bite: GitHub reads pull_request workflows from the base branch, so this workflow change cannot validate itself and must reach the base before it gates anything.
Step 3: Publish the resulting capability matrix. README.md:273 already claims all four runtimes; the matrix is what turns that claim into evidence.
Verify: A deliberate break in shared code fails the Deno job and not only the Node one.
Task 1.4: Claim the JSR scope and publish
Files:
- Modify:
deno.json - Modify:
.github/workflows/release.yml
Blocked on Diego and not delegable: @green-tea on jsr.io must be claimed with a GitHub account.
Step 1: Add name, version and exports to deno.json. Decide whether all four entry points (., ./deno, ./bun, ./edge) are exported or only the Deno one.
Step 2: Publish from the same v* tag that publishes to npm, using GitHub Actions OIDC. release.yml already holds id-token: write for npm Trusted Publishing, so JSR needs no new secret.
Step 3: Nothing here justifies cutting a release on its own — it rides along with the next version cut that has a reason.
Phase 2: The shutdown cluster
Four open issues, all consequences of the close({ timeoutMs }) contribution that just merged (3dcf784). Treated as one deliverable because they are one subject: Trust Release §14 (P1, lifecycle guarantees) and CTO P0-4 (production checklist, shutdown).
Order matters — the bug first, then the API, then the docs that describe the finished API.
Task 2.1: #20 — finish() reads its timer before declaration
A use-before-declare bug. Smallest item in this plan and it is already shipped. Fix it, and leave a test that fails if the ordering regresses.
Task 2.2: #19 — shutdown deadline settable at createApp level
The 10s deadline is hardcoded. Make it configurable at app level, with close({ timeoutMs }) still overriding per call.
Per AGENTS.md:81, a new option on a public interface must also change src/app/types.ts. An implementation that grows a parameter alone is unreachable for anyone consuming the package.
Task 2.3: #15 — graceful shutdown is Node-only — DECIDED, DONE
Decision: app.close() stays Node-only; each adapter that owns a server offers the same close({ timeoutMs }). The framework's line is it handles architecture, you handle business, and draining is owned by whoever holds the handle.
What the runtimes turned out to allow, measured rather than assumed:
| Runtime | Drain | After the deadline |
|---|---|---|
| Node | server.close() |
closeAllConnections() — remainder cut |
| Bun | stop(false) |
stop(true) — remainder cut |
| Deno | shutdown() |
returns anyway — remainder ends with the process |
Deno cannot escalate. Aborting the serve signal while shutdown() is pending throws BadResource: Bad resource ID from Deno's own listener — uncaught, and fatal under deno test. Measured on Deno 2.9: abort alone is clean, abort after shutdown is not. So on Deno the deadline bounds how long close() waits, not when connections die, and runtimes.md says so in a table rather than averaging the three.
closeWithDeadline (src/http/shutdown.ts) is shared so the two adapters cannot drift into different meanings of the same timeoutMs, and it resolves on its own timer rather than awaiting the force call — Bun's stop(true) was measured waiting out a handler with a pending timer, which is the unbounded wait the deadline exists to prevent.
Task 2.5: Shutdown as an extension point — OPEN, needs its own design
Raised while deciding #15: shutdown should emit signals so plugins and providers register their own teardown, instead of every consumer writing process.on('SIGTERM', …) by hand. Same principle as the decision above — the framework owns the plumbing.
It does not fit the existing Bus, and that is the finding worth carrying forward. Bus.on takes a synchronous listener (src/bus.ts:29) and emit neither awaits nor surfaces failures (src/bus.ts:38, catch {}). That is deliberate — observers must never break the pipeline — but a plugin closing a database connection needs shutdown to wait for it. Registering a teardown is not observing an event, and bending Bus to do both would cost the guarantee that makes it safe.
So it needs: an await-aware teardown registry, a new surface on PluginApi (public API — src/plugin.ts:19), and a decision about provider cleanup. That is Trust Release §14 "Graceful lifecycle guarantees" and CTO P0-4, and it belongs in a design document rather than inside a bug-fix cluster. Sequence it with Phase 3, whose observability contract shares the same lifecycle vocabulary.
Task 2.4: #18 — docs still describe close() without the timeout
Last, so it documents the finished API rather than being rewritten twice. If Phase 4 has already run, this lands in the docs repository instead.
Phase 3: Observability (#10)
The one every report puts first, and the only one that needs a design document before code.
Task 3.1: Design document
Files:
- Create:
.specs/2026-XX-XX-green-tea-observability-design.md
Write the design before any implementation, following the design/plan pairing already in .specs/.
The issue is explicit that this is one design, not six: an injectable logger, structured output and tracing hooks are the same API decision, and solving them separately leaves three mechanisms that do not fit together.
Inputs to reconcile:
- The scope in GH #10 — injectable logger contract, JSON default with human-readable dev output, request/response logging as a composable step rather than global middleware, hooks an exporter can attach to, metrics export.
- The Trust Release event vocabulary (§4) —
request.*,route.*,step.*,provider.*,graph.*,websocket.*,stream.*— and its context fields (requestId,traceId,route,transport,step,duration,status,scope,runtime). - Trust Release §6, graph timing. Per-step timings are close to free because the graph already knows every node, but the instrumentation stays opt-in if overhead is measurable. Measure before deciding.
Hard constraint, restated from AGENTS.md:11: no new runtime dependency. Core stays on reflect-metadata alone. An OpenTelemetry exporter is a separate package (@green-tea/opentelemetry), never a core dependency.
Decisions the design must settle rather than leave open:
- Is the logger a provider like any other, or a distinct registration?
- Do events go through one emitter or through per-category hooks?
- Does a step failure emit
step.failedandrequest.failed, or only the outer one? - Do long-lived streams and WebSockets emit per-message events, or only lifecycle ones? (The same reasoning that keeps upgrades out of the #21 gate applies.)
Task 3.2: Implement to the approved design
Do not start before the design is reviewed. Write the implementation plan from the approved design, as .specs/ already does for every other subsystem.
Task 3.3: Rewrite the observability paragraph in README.md
README.md:246 currently reads "No observability layer, either." and points at issue #10. When #10 lands, that paragraph is wrong and it is the single most load-bearing sentence in the CTO's assessment. Rewriting it is part of the work, not follow-up.
AGENTS.md:83: new public API needs a note in README.md.
Phase 4: Split the documentation site
Verified before scheduling: website/ is self-contained. 26 source files, no path escaping the directory, and the @green-tea/core mentions inside the .md files are example code, not build-time imports.
The coupling to core is five lines:
| Location | What |
|---|---|
.github/workflows/ci.yml:62-65 |
npm ci --prefix website, npm audit --prefix website, npm run docs:build |
package.json:100-101 |
docs:dev, docs:build |
Plus two README references to update: README.md:254 (the docs link) and README.md:263 (npm run docs:dev).
The real work is not the move. No workflow anywhere in .github/workflows/ deploys the site. website/astro.config.mjs:6 points at green-tea.expressive-tea.io and the deploy happens by hand today. The new repository is where that pipeline gets built for the first time.
Task 4.1: Create the repository and move website/ with its history
Preserve commit history for the moved directory rather than landing it as one squashed import.
Task 4.2: Build the deploy pipeline
The thing the docs never had. Build on push to the default branch, deploy to green-tea.expressive-tea.io.
Task 4.3: Remove the website from core
Delete the three ci.yml steps, the two package.json scripts, and website/. Update README.md:254 and README.md:263.
Task 4.4: Guard the seam the split opens
The split trades CI coupling for drift risk: docs and code can now disagree without anything failing. #18 exists precisely because docs fell behind an API change. Decide what catches that — a link check against the published package, a docs job triggered from core releases, or an explicit accepted risk written down. Do not leave it unstated.
Phase 5: Close #13 as documentation
Task 5.1: Write the circuit-breaker recipe
Files:
- Create: a guide page in the docs repository
The issue was opened to decide placement, not to commit to a core implementation, and it answers itself: core adding resilience policy would contradict the one-runtime-dependency rule. A circuit breaker fits a step — it needs whatever provides the client, it produces a guarded caller, and the graph already sequences it correctly.
Write it as a worked example, then close #13 pointing at the page. First real content in the new repository, which is also a live test of the deploy pipeline from Task 4.2.
Phase 6: The stability contract
Task 6.1: A stability paragraph in Honest scope
Files:
- Modify:
README.md
Not a roadmap, and not the API freeze. A statement of which areas are volatile today — present state, no dates, no delivery commitment. This is spare-time work by one person and a roadmap it cannot keep would cost more trust than it earns.
## Honest scope (README.md:240) already carries exactly this voice: mesh is alpha, there is no observability layer, runtimes differ in what they can offer. The stability tiers belong in that section, in that register, as one paragraph.
Roughly the split the Trust Release report proposes in §8 — graph semantics, providers, steps and controllers as the stable candidates; decorator syntax, CLI and plugin APIs as beta; mesh and distributed capabilities as experimental. Verify each claim against the code before writing it down; a stability tier asserted and then broken is worse than none.
README.md:266-276 keeps its **next** line unchanged. API freeze stays declared there and gets planned separately, near the RC.
Verification
Per AGENTS.md:28, run before proposing any task as finished:
npm run lint && npm run format:check && npm run typecheck && npm test
And from Phase 1 onward the runtime suites are no longer optional, because CI runs them:
npm run test:deno && npm run test:bun && npm run test:edge
Conventional Commits focused on the why, every commit signed off (git commit -s), no AI co-authoring attribution.