Skip to content

docs-examples.test-d.ts for the four starters — the deferral's own trigger fired twice in PR #49 #53

Description

@btravers

The root CLAUDE.md lists this under Deferred, deliberately, with the stated trigger: "Add it the next time one of those samples is found to have drifted, the same way this gap itself was found."

That happened twice in PR #49.

1. docs/reference/temporal.md carried TemporalActivities(orderContract)([orderFulfillment]). Once the example contract gained a second workflow, chargeOrder was uncovered and the sample was refused by the very gate the page documents three paragraphs above:

error TS2769: No overload matches this call.
    Type 'Provider<PortInstance<"TemporalWorkflowActivities:fulfillOrder", …>>'
      is not assignable to type '"UNCOVERED ACTIVITIES"'.

2. docs/how-to/run-a-temporal-worker.md had the same defect, in a different shape — its monolithic-record sample listed only fulfillOrder for a contract that now declares two workflows. Its composition-root sample below it also needed BillingModule, so fixing the first alone would have moved the error down the page.

Three further pages (docs/reference/amqp.md, docs/how-to/consume-amqp-messages.md, docs/how-to/read-the-ambient-unit.md) used a consumer key that a rename had removed — not stale prose, invalid TypeScript.

All five were caught only because each sample was compiled by hand in a scratch file and deleted, per the repo's stated practice. One of them survived a commit literally titled "compile the last broken worker sample". That is the argument for a gate: the practice works exactly as well as the person applying it that day.

packages/core/src/docs-examples.test-d.ts is the shape to copy. The four packages without one are @btravstack/http, @btravstack/temporal, @btravstack/amqp and @btravstack/observability.

Note the constraint that makes this non-trivial: these samples import real example workspaces, so the test file cannot live in the package (that would invert the dependency direction — packages/* must not depend on examples/*). packages/core's version works because its samples are kernel-only. The likely home is a test file inside each matching example workspace, or a workspace of its own that depends on the examples.

Acceptance

  • Every TypeScript sample in docs/reference/{http,temporal,amqp,observability}.md and the matching how-to pages is compiled by a checked-in type test, not by hand.
  • The test runs under pnpm typecheck so a contract change that breaks a sample fails the gate.
  • The Deferred, deliberately entry in the root CLAUDE.md is removed once it lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Should land before 1.0 — real DX cost, or a decision blocking other workdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions