# The doctor's rules

> Generated from the SDK's own source (`packages/durable-testing/src/guards/rules.ts`) at build; edit there.

The core guard pack: the rules `npx durable-sdk doctor --host` runs over any Durable app's tree, one bullet each with the law the tree must hold true, the hazard when it does not, what the law costs an author, the fix a finding carries and the decision that made it. `npx durable-sdk doctor --host --explain <rule id>` prints a row offline.

## authoring

- `authoring/primitives-reexport-stubs`: the primitives barrel (the descriptor's modules.primitives, @durable-sdk/core here) imports nothing, re-exports named lists alone, at least ten, and draws from the app's stubs (modules.stubs), never from @durable-sdk/_. Hazard: lost fence. Drawback: a new primitive is first a stub's export, then the barrel's. Fix: export the name from its stub (app/workflows/_, app/lib/log.server.ts, src/listeners.ts) and re-export it by name from the barrel. (ADR-0051)
- `authoring/primitives-names`: the barrel hands log out of the log stub (modules.log, app/lib/log.server.ts here) and on out of the listener module (modules.listeners, src/listeners.ts here), and carries every name ADR-0051 lists. Hazard: lost fence. Drawback: the ten-line surface is a fixed list. Fix: add the missing name to the barrel's named lists from its stub. (ADR-0051)
- `authoring/execute-or-throw-routes-only`: under the application root a call of executeOrThrow stands in the routes directory alone (app/routes/ here), so no module a listener imports can reach it, and neither the listener module nor the package's registry and dispatcher spell one: a listener's outcome is a value, a throw is transport that backs off. Hazard: lost intent. Drawback: a helper a listener could import answers execute()'s value and never throws. Fix: call execute() and read the outcome as a value (describeResult); keep executeOrThrow in the route. (ADR-0041)
- `authoring/no-catch-around-step`: inside a run body under app/ a ctx.step call stands in no try whose catch swallows the failure (a catch with no throw) and chains no .catch: a step's failure is thrown and compensated, or taken as a value under onFail: "return" (ADR-0063 Appendix M U6). Hazard: lost intent. Drawback: a body that must go on past a failed step says so on the step, where the row lands TOLERATED and the console counts it, never in a catch the engine cannot see; a catch that rethrows what it does not handle stands. Fix: declare onFail: "return" on the step and read stepFailed(answer); keep a catch that narrows by name and rethrows the rest. (ADR-0063)
- `authoring/promise-all-over-steps`: inside a run body, a listener body or a helper handed their context, no bare Promise.all( or Promise.allSettled( runs the context's steps (ctx.step, ctx.batch, ctx.poll, directly or through a same-file helper handed the context): the fan-out is ctx.all (ADR-0063 Appendix M U2). Hazard: doubled write. Drawback: a fan-out is written as thunks under ctx.all, which bounds it, assigns the seqs at the call and holds the first failure while the rest settle. Fix: use ctx.all({ name: () => ctx.step(…), … }) (or the array form); a Promise.all over plain reads stays. (ADR-0063)
- `authoring/emit-inside-step`: no ctx.emit( or i.emit( literal, and since ADR-0076 FP-032 no ctx.continueAsNew( literal, under the application root or in the recipes page (the descriptor's docs.recipes, docs/durable/recipes.md here, its fenced blocks) stands lexically inside the arguments of a ctx.step(, ctx.batch( or ctx.poll( call, whichever closure holds it (the body, an inline undo, a chunk, a probe, a member of ctx.all): a step served from its row never runs its closure, so a fact queued there is queued on the attempt that ran the body alone and lost on every resume that finishes the run from its rows, and a continuation asked for there would close the run on that attempt alone; the doors emit.inside_step (ADR-0064 P01) and continue.inside_step (ADR-0076 FP-032) refuse them at runtime, this rule names the line before any run. Hazard: lost intent. Drawback: a fact is spelled after its step, from the step's output, and a continuation after the step that decided it; a step that must say something hands the fields back and the body emits them or continues. Fix: move the emit or the continueAsNew after the step returns: const out = await ctx.step(…); ctx.emit(name, { …out }) or await ctx.continueAsNew({ …ctx.input, …out }). (ADR-0064)
- `authoring/emit-beside-a-write`: under app/ no bare emit( call (the outbox's insert outside a run, the identifier alone, never <ctx>.emit), nor a call of a same-file teller (a named function whose body spells one, or calls a teller: the closure over the file's names, so a write handed in as a callback two hops from the emit is still beside it), sits inside a function whose text (its nested closures included, its comments blanked first) also writes one of the host's database clients (the descriptor's clients, db and warehouseDb here: <client>.<model>.create|update|upsert|delete…, $transaction, $executeRaw) or the settings store (settings.set|setIf|increment): the fact and the write commit apart, so a death between the two leaves one without the other; the sites that stood when the rule landed are EMIT_BESIDE_WRITE_HOLDOUTS, each with the reason it stands, exact both ways and only shrinking (ADR-0046 §C: the tx option the design sketched cannot ride the first host's transactions, so a host write that must commit with its fact belongs inside a workflow, whose fact is written with the run's final status). Hazard: lost intent. Drawback: a write that must commit with its fact is a step of a keyed workflow (the fact queued with ctx.emit, written with the run's landing); a bare emit stays for a fact with no row beside it, or for a row the fact is ordered against by key so a death re-says it. Fix: move the write and the fact into a workflow (a step with its undo, ctx.emit after it), or take the write out of the function that emits; a site kept by decision is listed in EMIT_BESIDE_WRITE_HOLDOUTS with its reason. (ADR-0046)

## definitions

- `definitions/strict-boot`: the host's configuration loads its whole manifest under definitions: strict, the policy a deployment and pnpm start boot with (definitionsPolicy() off NODE_ENV=test): every definer the load evaluates registers under the strict instance, so a definition without its example or sentence is refused at defineWorkflow with DefinitionIncomplete and never registers. Hazard: lost fence. Drawback: the guard rebinds the host's instance strict before its load and lenient again after, under reconfigure: rebind. Fix: add the example or the sentence the DefinitionIncomplete names; a load that fails here is the deployment's first load() answering 503. (ADR-0060)
- `definitions/declarations-complete`: describeDefinitions() names every registered workflow once with what it declares, and the report the doctor reads (DURABLE_DEFINITIONS_REPORT) is what this guard writes. Hazard: lost fence. Drawback: the guard loads the whole manifest, seconds per run. Fix: repair the module the load error names; a definition the registry cannot describe is one the doctor cannot list. (ADR-0060)
- `definitions/describe-missing`: every definition and every listener registration carries describe: one sentence, the intent in words, served on the catalog's row and printed by the doctor (a listener's rides on the listener.<name> run on() defines, ADR-0063 B23). Hazard: lost intent. Drawback: a definition is refused at the boot without its sentence under definitions: strict, a listener registration at on(). Fix: add describe: one sentence, the intent in words (a listener's in its on() options). (ADR-0060)
- `definitions/fact-describe-missing`: every fact of the bound catalog carries describe: one sentence, what the fact means, served on the catalog's row and on the reaction graph's node (ADR-0063 B23). Hazard: lost intent. Drawback: a descriptor without its sentence refuses the boot under definitions: strict (InvalidCatalog naming the fact) and is a finding here under lenient. Fix: add describe: one sentence, what the fact means, to the descriptor in the event catalog (modules.catalog, src/events/catalog.ts here). (ADR-0063)
- `definitions/fact-schema-missing`: every fact of the bound catalog carries schema: a zod schema of the payload, the door's judge at emit(), ctx.emit, the webhook binding and the relay receiver (ADR-0076 SOC-18, D08: input schemas at every door), every key part required by it and the fixture parsing under it. Hazard: lost intent. Drawback: a descriptor without its schema refuses the boot under definitions: strict (InvalidCatalog naming the fact, catalog.schema.missing, after every fact's sentence) and is a finding here under lenient; a schema is additive (z.object, an unknown field admitted), so a peer on newer code is never refused for a field this release does not know. Fix: add schema: z.object({ … }) over the payload's fields to the descriptor in the event catalog (modules.catalog, src/events/catalog.ts here), a nullable field .nullable(), an optional one .optional(), and make the fixture of tests/fixtures/event-payloads.ts parse under it. (ADR-0076)
- `definitions/example-missing`: every definition carries example: an input it accepts (or a thunk returning one), what the engine keys, stores and re-keys as a run's input would. Hazard: lost intent. Drawback: a new workflow writes its example before its first test; a thunk that throws or answers undefined counts as none. Fix: add example: an input the workflow accepts (a thunk, () => input, where the value must be fresh or holds a secret by design). (ADR-0060)
- `definitions/example-unstorable`: the door of decision 7 accepts every example (no client, function, Secret, Date, Map, Set, bigint, bytes or promise at any depth) and the stored form fits the run store's input cap. Hazard: lost intent. Drawback: an example is plain data, under 64 000 characters once stored. Fix: make the example plain data: a client on execute options, a secret read inside the step, a moment as its ISO string, a computed value as data. (ADR-0060)
- `definitions/example-names-context-key`: no example names a context field of the engine's own (attempt, actor, deadlineAt, priorAttempt, client, admin) that its key does not read: the recorder injects them and drops them from every stored input; scope, shop, origin, runId and signal an input names by design, and a field the key reads is the intent's own. Hazard: lost intent. Drawback: an input spells the engine's fields under other names (a target run as targetRunId, the caller as by). Fix: take the context field off the example; read it from the step context. (ADR-0041)
- `definitions/example-does-not-key`: key(example) answers one non-empty string, the same on two calls, carrying no redacted part. Hazard: doubled write. Drawback: a key is a pure function of the input's plain fields and never spells a secret. Fix: make the key a pure function of the input's plain fields (a field list, or a function reading no clock, no randomness and no secret) that answers one non-empty string. (ADR-0041)
- `definitions/example-does-not-rekey`: the example's stored form (serializeStored, what beginRun stores as resumeInput) keys to the same string as the live value, so a resume or redrive re-keys to the same run. Hazard: doubled write. Drawback: a key reads stored forms: strings, numbers, nested plain data, never a field the serializer rewrites or drops. Fix: key on stored forms (strings, numbers, nested plain data), never on a Date, a Map, a Set, a bigint or a field the serializer rewrites. (ADR-0041)
- `definitions/example-resolver-invalid`: scope(example) and scopeId(example) answer a string or null, the same live and from the stored form, and summary(example) answers a value: the resumer, the redrive and the operator actions read each off the stored input. Hazard: lost intent. Drawback: a resolver reads the input's stored fields alone. Fix: make scope and scopeId answer a string or null from the input's stored fields, and summary a value; never read the client or the clock in a resolver. (ADR-0051)
- `definitions/example-cap-key-invalid`: concurrency.key(example) answers one non-empty string, the same from the stored form: a match that differed per attempt would cap nothing. Hazard: race. Drawback: a cap's key reads the input's stored fields alone. Fix: make concurrency.key answer one non-empty string from the input's stored fields. (ADR-0052)
- `definitions/schedule-slots-key-one-run`: a scheduled definition keys the slot at the probe moment and the slot after it to two runs, live and from the stored input (the host's retention schedule the same for retention.apply). Hazard: doubled write. Drawback: a schedule's input names the slot (slot.id or slot.at) in a field the key reads as stored. Fix: put slot.id or slot.at in a field the key names; never key a schedule on a constant input. (ADR-0060)
- `definitions/cancel-on-invalid`: every cancelOn entry of a definition (ADR-0076 FP-033) names a fact the bound catalog declares, its match answers an object of the payload's plain fields over the example (nothing the policy redacts: the spelling both sides hash) and its since answers a Date, an ISO string or null; judged by verifyDefinitions over the catalog and the example, never by a run. Hazard: lost intent. Drawback: a definition whose entry names a fact the catalog lacks, or whose match the example cannot read, is refused at the definition door under an instance and filed here under lenient. Fix: name a fact the catalog declares (durable-sdk doctor --definitions lists them), make match answer the payload's plain fields over the example and since a moment or null. (ADR-0076)
- `definitions/world-shape`: a definition's world (the rows its example needs, FW-022: world on the definition beside example, a value or a thunk) is an object of host, engine, channel and (since FW-042) providers alone, host naming tables the bound seeder accepts (the names the host hands the pack as hostTables; the first host's WORLD_HOST_TABLES of tests/helpers/world-tables.ts since FW-040 and FW-042: the bundle composer's five warehouse tables, the floor's PickEvent, ToteActivity, FloorUser and DeviceSession, and the app database's Warehouse, Shop, ShopLocation and SyncState, their names handed to verifyDefinitions as hostTables) each an array of row objects, engine naming the engine's seed tables alone (runs, keys, steps, entries, events, waits) each an array of row objects, the whole plain data under the stored input cap with nothing the policy redacts; the verifier judges the shape by name and runs nothing. Hazard: lost intent. Drawback: a world is fixture rows on the definition, read by the guard alone; it holds no credential and no dataset. Fix: make world { host?: { <Table>: [rows] }, engine?: { runs | keys | steps | entries | events | waits: [rows] }, channel?: { fulfillmentOrders, stock, transfers, shipments, fulfillmentStates } } of plain data, each table a name the seeder accepts and each row an object; leave a credential out. (ADR-0060)
- `definitions/handlers-shape`: every registered definition's query and update handlers (ADR-0076 FP-031: queries, an object of functions by name of the step name's grammar; updates, an object of { validate?, apply } by name with apply a function and validate one when given) pass the definition door's own judgement over the registered shape, and the declarations list each definition's handler names. Hazard: lost intent. Drawback: the door refuses the same shapes by name at defineWorkflow, so a finding here is a registration made past it (a cast, a plugin's copy); a definition without handlers has nothing to judge. Fix: declare queries as { <name>: (state, args) => value } and updates as { <name>: { validate?: (state, args) => void, apply: (state, args, i) => value } }, each name a letter or digit first then letters, digits, dots, underscores and hyphens. (ADR-0076)
- `definitions/lightweight-shape`: a lightweight definition (ADR-0076 FP-038: `defineWorkflow({ lightweight: true })`, `on(…, { lightweight: true })`, one run row and no step row per run, every step a read kept in memory and landed on the run row, re-run whole after a crash) declares no hook whose handlers are registered (each a step with an undo or a reason, which the run refuses at the call, `lightweight.hook.handlers`); the verifier judges what is static of the shape by name and runs nothing, the doors inside the run refuse a step with an undo or a reason, a wait of any kind, a child, a batch, a poll, a recorded write and `cancelScheduled` by name, and the double-run guard (`prove()`) runs the example on the fakes and holds its landing to no step row, crashing it at the finish boundary alone. Hazard: doubled write. Drawback: a lightweight run replays nothing: a crash re-runs every step, so a step that writes would double with no row to reconcile it from. Fix: keep a lightweight definition's hooks handler-free, or take lightweight: true off a definition whose hooks carry handlers; make every step of a lightweight run a read whose re-run costs nothing and nothing else. (ADR-0076)

## workflow-identity

- `workflow-identity/example-on-definition`: every registered workflow carries an example on its definition (a value, or a thunk read at each use), the one input source the guards and the engine key. Hazard: lost intent. Drawback: a new workflow writes its example before its first test. Fix: add example to the definition: an input the workflow accepts (a thunk where the value must be fresh or holds a secret by design). (ADR-0060)
- `workflow-identity/listener-fixtures`: every on() registration is a listener workflow with a payload fixture for its event, a batch listener's slice shape included. Hazard: lost intent. Drawback: a new event writes its payload fixture first (the host's payload fixtures, modules.eventPayloads: tests/fixtures/event-payloads.ts here). Fix: add the event's payload to the host's payload fixtures (modules.eventPayloads, tests/fixtures/event-payloads.ts here). (ADR-0041)
- `workflow-identity/key-survives-storage`: an input keys to the same string live and after serializeStored, is stored whole, holds no [redacted] unless listed, and the engine judges it replayable on both stores; the partition resolvers never read the client. Hazard: lost intent. Drawback: an input is plain data: no Date, bigint, Map or Set in a key part, nothing above 64 000 characters. Fix: key on stored forms (strings, numbers) and keep the client on execute options, never in the input. (ADR-0041)
- `workflow-identity/key-reuse-refused`: a second start under a registered definition's field-list key whose stored input differs in a field the list does not name (requestId aside) is refused KeyReused before any resume; a function key, the author's own identity, refuses nothing; the same input again answers the stored run (ADR-0063 B20). Hazard: lost intent. Drawback: under a field-list key two inputs that differ off-key are two intents the list cannot tell apart: the second caller is refused, never handed the first's result. Fix: put the field that differs in the key list, or start under a new requestId; a field two starts must share belongs in the list. (ADR-0063)
- `workflow-identity/legacy-scope-names-rekey`: a run.redrive or run.dismiss row stored under shop/shopId re-keys and resolves its store exactly as one stored under scope/scopeId. Hazard: lost intent. Drawback: the two spellings stay one value in defineWorkflow for every stored row. Fix: keep the shop/shopId aliases normalised in defineWorkflow; never read the deprecated names in a key body. (ADR-0046)
- `workflow-identity/schedule-slot-in-key`: a scheduled definition keys the slot at the probe moment and the slot after it to two runs, live and from the stored input (ADR-0060 decision 5). Hazard: doubled write. Drawback: a schedule's input names the slot (slot.id or slot.at) in a field the key reads. Fix: put slot.id or slot.at in a field the key names; never key a schedule on a constant input. (ADR-0060)
- `workflow-identity/retention-schedule-slot-in-key`: the host's retention schedule (the configuration's retention.schedule) puts the slot's day in the core's retention.apply key, which createDurable cannot judge itself since the retention module imports it. Hazard: doubled write. Drawback: the retention schedule's input is the one slot the engine's probe does not see. Fix: keep day: slot.at.slice(0, 10) (or the slot's id) in the retention schedule's input. (ADR-0060)
- `workflow-identity/key-reads-no-clock`: a key is a pure function of its input: the same input keys the same string across an hour and a day boundary. Hazard: doubled write. Drawback: the moment goes in the input (requestId, a schedule's slot), never in the key. Fix: put the moment in the input as requestId and key on the field list. (ADR-0041)
- `workflow-identity/cap-key-pure`: a concurrency match is a non-empty string of the input alone: the same live, from the stored input and across an hour boundary. Hazard: race. Drawback: a cap's key reads fields and nothing else. Fix: derive the match from input fields; a match that read the clock would give every run its own and cap nothing. (ADR-0052)

## refusals

- `refusals/sites-read-rows`: no sentence is spelled at a throw site of a door module: every new TypeError, Error, StepError, InvalidCatalog, PeerMisconfigured, RunNotStarted, UnstorableInput or InvalidPayload with a literal reads a row of REFUSALS, and the engine's own invariants are the ones INTERNAL lists, each still found. Hazard: lost intent. Drawback: a new refusal is a row first, then a site; an engine invariant is listed with its reason. Fix: add the row to packages/durable-core/src/refusals.ts and throw refuse(id, parts) or new <Class>(…, refusal(id, parts)) at the site. (ADR-0060)
- `refusals/refuse-names-the-registry`: in a door module that imports the registry, refuse and refusal name the registry alone: no closure, variable, function or parameter is called refuse or refusal. Hazard: lost intent. Drawback: a local that answers a value is named for what it does. Fix: rename the local (refuseInvalidate, fail, …) so refuse(<id>) in a door module always reads a row. (ADR-0060)
- `refusals/rows-are-thrown`: every row of REFUSALS is read by a site under packages/durable-core/src, packages/durable-vercel/src (the adapter's own door, vercelPlatform) or packages/durable-cli/src (the CLI's doors, ADR-0060 decision 19), as refusal(<id>, …) or refuse(<id>, …). Hazard: lost intent. Drawback: a row no site reads is dead and refused. Fix: delete the row, or make the site that throws its sentence read it. (ADR-0060)
- `refusals/site-class-matches-row`: the class a site constructs around a row's sentence is the row's throws, under the core's source and the CLI's: refuse() under a plain TypeError or Error row, new <Class>( or a class's super( under that class's row, and every id read is a row. Hazard: lost intent. Drawback: a row says the class it is thrown as, and the site keeps to it. Fix: set the row's throws to the class the site constructs, or construct that class at the site. (ADR-0060)
- `refusals/registry-is-sentences`: REFUSALS passes assertRefusalRegistry: ids of the grammar, a class per row with its envelope, every sentence rendering over placeholders, every trap and remedy a sentence, every ADR named, one drawback per primitive. Hazard: lost intent. Drawback: a row is six fields, each a sentence or a name. Fix: fix the field the message names in packages/durable-core/src/refusals.ts. (ADR-0060)
- `refusals/reader-proof`: the guard's readers are red on a fixture with one unlisted throw and one unthrown row, and read the registry's own forms (refuse, new <Class>(refusal(…)), a class's super(refusal(…)), a closure's read). Hazard: lost fence. Drawback: none. Fix: fix the reader in the refusals guard; the fixture is the rule's own proof. (ADR-0060)

## platform

- `platform/route-config-literal`: every framework route exports the framework's literal pin as the platform's build can read it (literals only, never a reference): `export const config = { maxDuration: <n> }` under react-router and vercel-functions (@vercel/static-config), `export const maxDuration = <n>` under next (the segment config); and the number equals the descriptor's maxDurationS (app/lib/platform.ts's MAX_DURATION_S here), compared in milliseconds. Hazard: lost fence. Drawback: the limit is repeated as a literal in every framework route, since the adapter's evaluator reads no reference. Fix: export the framework's literal from the route the message names (`export const config = { maxDuration: <MAX_DURATION_S> };`, or `export const maxDuration = <MAX_DURATION_S>;` under next), the number the descriptor's maxDurationS spells (app/lib/platform.ts here). (ADR-0041)
- `platform/config-export-once-top-level`: each framework route declares `export const config` exactly once, at the top level, where the adapter reads it. Hazard: lost fence. Drawback: none. Fix: keep one top-level `export const config` per route; remove the doubled or indented export the message names. (ADR-0041)
- `platform/no-larger-limit`: no route under the routes directory (app/routes here) declares a maxDuration above the descriptor's maxDurationS. Hazard: lost fence. Drawback: none. Fix: lower the route's maxDuration to the descriptor's maxDurationS, or raise the host's constant (app/lib/platform.ts here) with the lease arithmetic. (ADR-0041)
- `platform/pin-never-through-constant`: no route's `export const config` spells the pin through a constant (MAX_DURATION_S, PLATFORM or LEASE_MS), a reference Vercel's static evaluator cannot read, so the export would pin nothing. Hazard: lost fence. Drawback: the literal is repeated by hand and held equal to the constant by this guard. Fix: write the number itself in the route's config export; the guard holds it equal to the descriptor's maxDurationS. (ADR-0041)
- `platform/lease-is-limit-plus-two-heartbeats`: the lease (the descriptor's leaseMs, LEASE_MS here) is the function limit plus two heartbeats, (maxDurationS + 2 * heartbeatS) * 1000, in milliseconds like every other limit the framework compares. Hazard: race. Drawback: none. Fix: keep LEASE_MS = (MAX_DURATION_S + 2 * HEARTBEAT_S) * 1000 in the host's platform module (app/lib/platform.ts here). (ADR-0041)
- `platform/lease-covers-zombie`: the lease is longer than a zombie's last heartbeat plus its remaining life: an attempt heartbeats at most HEARTBEAT_S before the platform stops it and may live MAX_DURATION_S after that touch, and both fit inside LEASE_MS. Hazard: race. Drawback: none. Fix: raise the lease (LEASE_MS in app/lib/platform.ts here) above (MAX_DURATION_S + HEARTBEAT_S) * 1000. (ADR-0041)
- `platform/lease-outlives-route-pin`: the lease (the descriptor's leaseMs, LEASE_MS here) is longer than every framework route's pinned limit, in milliseconds. Hazard: race. Drawback: none. Fix: lower the pin of the route the message names to the descriptor's maxDurationS, or raise the lease with it. (ADR-0041)
- `platform/vercel-json-no-larger-limit`: vercel.json declares no functions.maxDuration above the descriptor's maxDurationS, and none set to the word max. Hazard: lost fence. Drawback: none. Fix: remove or lower the functions entry the message names in vercel.json. (ADR-0041)
- `platform/cron-targets-pinned-route`: every cron in vercel.json points at a jobs path whose route file is a framework route under the pin, by the descriptor's framework: react-router /jobs/<name> and <routesDir>/jobs.<name>.tsx (app/routes/jobs.<name>.tsx here), vercel-functions /jobs/<name> (through a rewrite) or /<routesDir>/jobs/<name> and <routesDir>/jobs/<name>.ts, next /jobs/<name> (through a rewrite) or /<prefix>/jobs/<name> and <routesDir>/jobs/<name>/route.ts. Hazard: lost fence. Drawback: none. Fix: point the cron at /jobs/<name> with the framework's route file (<routesDir>/jobs.<name>.tsx under react-router, app/routes/jobs.<name>.tsx here; <routesDir>/jobs/<name>.ts under vercel-functions; <routesDir>/jobs/<name>/route.ts under next) that frameworkRoute matches. (ADR-0041)
- `platform/resumed-run-past-window`: the external call window (the descriptor's externalCallTimeoutMs, EXTERNAL_CALL_TIMEOUT_MS here) is below the lease (leaseMs), so a resumed run is always past the in-flight window: a claim needs the lease after the last heartbeat, and a non-idempotent write is then no longer in flight at the provider. Hazard: doubled write. Drawback: none. Fix: keep EXTERNAL_CALL_TIMEOUT_MS under LEASE_MS in the host's platform module (app/lib/platform.ts here). (ADR-0041)
- `platform/window-wait-fits-function`: twice the external call window (the descriptor's externalCallTimeoutMs) is under the function limit (maxDurationS) in milliseconds, so a redrive that waits the window out still makes its call inside one function's life. Hazard: lost fence. Drawback: none. Fix: keep 2 * EXTERNAL_CALL_TIMEOUT_MS under MAX_DURATION_S * 1000 in the host's platform module (app/lib/platform.ts here). (ADR-0041)
- `platform/redrive-waits-at-most-a-minute`: a redrive seconds after a failure waits out at most the spec's own timeoutMs, a minute without one: EXTERNAL_CALL_TIMEOUT_MS is at most 60 000 and the in-flight window (inFlightWindowMs, FW-020) is the longer of the spec's timeoutMs and that constant, so a spec declaring none or less waits the minute and one declaring more waits its own number, never past userStepMaxMs. Hazard: lost intent. Drawback: a provider slower than a minute is a failure to redrive under the default window, never a longer wait; a spec that declares the longer call pays its own window on every redrive inside it. Fix: keep EXTERNAL_CALL_TIMEOUT_MS at or under 60_000 in the host's platform module (app/lib/platform.ts here), and keep inFlightWindowMs the max of the spec's timeoutMs and the constant in packages/durable-core/src/saga.ts. (ADR-0041)

## graph

- `graph/index-current`: the app root's graph-index.json and workflow-index.json are what durable-sdk index walks off the descriptor (the kit's graph-walk: the names of every definer under roots.app and, where roots.packages stands, the core's own, then the body literals of those definers with every module under roots.app in hand, the schemas, doors, refusals and connectors index.* names and the catalog modules.catalog names; a host's gen:graph-index and gen:workflow-index are wrappers over the same walk), the data equal (a host formats the files through the Prettier its root resolves), and the index lists no unresolved literal: an identifier the walk cannot follow, an emit or wait whose name is no literal, a helper two modules export and no import binds, a definer the entry list names with no body, a column no model carries, a key no branch names, a row or a fact the walk cannot read, each at its site, never left out and never guessed (ADR-0060 decisions 13 and 14 as amended 2026-10-30, GR-018). Hazard: lost intent. Drawback: a body edge changed runs durable-sdk index; a definer's name is a literal, a module constant or a template over constants, never computed. Fix: run durable-sdk index at the app root and commit graph-index.json and workflow-index.json; resolve an unresolved literal at its site (a literal name, an import that binds the helper, a column the model carries) or teach the walk the shape on the pack's fixture (graph/walk-proof). (ADR-0060)
- `graph/steps-declared`: every step a body of graph-index.json walks names its door (ctx.step, defineStep or defineExternalStep), its effect, its undo or its irreversible reason, its id and its onFail as the walk read them off its literal, or says declared: false with every field of its declaration null and no undo, never a guess; and every recorded write inside it carries its key's base, its door, its undo, its phase (invoke, or compensate for a compensation's own write), its table or table: null, its columns, its compared columns, its ledger resource and its site, every field present (ADR-0060 decision 14 as amended 2026-10-30; decision 12's declared, FW-064). Hazard: lost intent. Drawback: a declaration spelled past what the walk reads (a spread of a value, an options object built by a call) is declared: false until spelled as a literal or a module constant. Fix: spell the step's declaration as a literal or a module constant (undo | irreversible, effect, id, onFail) and the write's model and data as literals or parameters bound to one at the call site, then run durable-sdk index. (ADR-0060)
- `graph/nodes-complete`: every body of graph-index.json is a workflow or a listener named once, under a module of the descriptor's roots.app at a line of the tree, a listener with its event; every door carries its kind and path, its site, its body, its judge and what it runs, hands past the answer, emits and refuses; every refusal row its registry, slug, sentence and doors; every fact, table and provider its name (the datasource and model, the kind and export) and site; so the core draws every node with its site and never two under one id (ADR-0060 decision 14 as amended 2026-10-30). Hazard: lost intent. Drawback: none. Fix: run durable-sdk index; a body spelled under another root is one the descriptor's roots.app does not reach, so name the root or move the module. (ADR-0060)
- `graph/walk-proof`: the kit's walk is proved on the pack's own fixture (packages/durable-testing/src/guards/graph-fixture.ts, a tree in memory): a definer named by a literal, a module constant and a template over constants, a computed name listed as an unresolved workflow at its line and an entry-list name with no body at line 0, the definition's words (the key as text, describe, version, schedule) and a listener's describe and policy, an inline step's declaration with its onFail, a defined step by identifier with its recorded writes in both phases (the table off the descriptor's schema, the columns, the compared columns, the ledger, the key's base), a raw delegate mutation on its step, a helper two hops away under through, a workflow started through a helper, a child, a wait, an emit, the ADRs cited, a ladder's doors with their body, judge, run, hand past the answer, refusal literal and the catalogue's row, a defineRoute action entry, a webhook route with its name literals, a starter route with its code refusal, a connector interface's capabilities and a step's call through the resolver, the catalog's facts, and the coverage line over it, on every host the pack runs on (ADR-0060 decision 14 as amended 2026-10-30, GR-018). Hazard: lost fence. Drawback: none. Fix: fix the reader in packages/durable-testing/src/graph-walk.ts; the fixture is the rule's own proof. (ADR-0060)
- `graph/coverage-floor`: the coverage line durable-sdk index prints (coverageOf over the walk's index) meets the floors every host holds: every definer the entry list names has a body (bodiless 0), unresolved 0, every door the descriptor's rows name read (doors n/n), and the line in the generator's grammar; a host's own floors for its keys, writes, tables, columns, refusals, facts and calls ride on its own row and only rise (ADR-0060 decision 14 as amended 2026-10-30, GR-003 and GR-018). Hazard: lost intent. Drawback: a new house pattern the walk cannot read is red here until the walk learns it on the pack's fixture. Fix: spell the key, the name, the step, the model or the data as a literal, a module constant or a parameter bound to a literal at the call site, add the branch a bodies key lacks or name the reader of a door's shape in durable.guards.ts, or teach the walk the shape on the pack's fixture; never lower a floor. (ADR-0060)
- `graph/tables-named`: every write of graph-index.json names its table ({ client, datasource, model } under the Prisma schema durable.guards.ts names for the client in index.prismaSchemas, read as text) or carries table: null, never an absent field, and so its columns, its compared columns, its ledger resource and its site; every column a write or a raw mutation names is a column of its model in that schema (the walk's own word <expression> excluded); every raw entry (a <client>.<delegate>.<verb>( outside a recorded write) names its verb, its table or null, its columns or null and its site; and the index's tables list every model of the schemas named with their columns, type, default and line (ADR-0060 decision 14 as amended 2026-10-30, GR-004 and GR-018). Hazard: lost intent. Drawback: a write built by a function (its key, its model or its data computed past what the walk reads) stays a count on the coverage line until it is spelled as a literal or a parameter bound to one at the call site. Fix: spell model: as <client>.<delegate> and data: as an object literal at the step or at the helper's call site, name the client's schema under index.prismaSchemas in durable.guards.ts, correct a column the model lacks, then run durable-sdk index. (ADR-0060)
- `graph/doors-complete`: every door of graph-index.json says what it does (runs, then, emits, or the reads mark, never an absent field); every branch of every ladder row of durable.guards.ts (index.doors.ladders: the pattern's door literal in the ladder's text) is a door of the row's prefix and every key of a ladder's bodies table a door with a body; every row of the catalogue index.refusals.catalogue names is a refuses entry of each door it names with the row's judgement, the slugs unique; a key no branch names, a ladder file or a table the tree lacks, a webhook glob no file matches and a row the walk cannot read are listed under unresolved as door or refusal, which graph/index-current holds empty (ADR-0060 decision 14 as amended 2026-10-30, GR-006 and GR-018). Hazard: lost intent. Drawback: a door written outside the shapes the descriptor's rows name is red here until the descriptor names its reader or the walk learns the shape on the pack's fixture. Fix: add the branch the bodies table's key lacks (or the key the branch lacks), name the ladder, the binding, the handlers, the table or the catalogue in durable.guards.ts's index.doors and index.refusals, or teach the ladder reader the shape on the pack's fixture; then run durable-sdk index. (ADR-0060)
- `graph/providers-named`: the capability vocabulary of graph-index.json's providers equals the method names of the connector interfaces durable.guards.ts names under index.connectors.interfaces, read as text (every method of the interface's own body, a readonly property none), one row per kind with the interface's module, export and line; and every call a body's services carry with a via names a capability of a provider of its kind at a site of the tree; a capability called that the interface does not name, and an interface the tree lacks, are listed under unresolved as kind provider, which graph/index-current holds empty (ADR-0060 decision 14 as amended 2026-10-30, GR-008 and GR-018; ADR-0030: business code branches on a capability, never a provider's name). Hazard: lost intent. Drawback: a capability reached through a function value, a connector stored on an object or a resolver the descriptor does not name stays unread and is never guessed. Fix: add the resolver to index.connectors.resolvers in durable.guards.ts with its kind and module, name the interface under index.connectors.interfaces, or spell the call on the bound connector; then run durable-sdk index. (ADR-0060)

---

Prompt for an agent:

```text
Read https://durablesdk.com/docs/reference/rules.md, then apply what it says to this app; run durable-sdk doctor --host before and after; a refused line is a refusal id: durable-sdk explain <id>
```
