This runbook covers local setup, deterministic validation, package inspection, common failure diagnosis, release preparation, and rollback for @quantum-l9/llm-router.
- Node.js 20.19.0 or newer
- npm 10.9.2 or a compatible npm 10 release
- Access to the package registry when installing dependencies
- No provider credentials are required for tests
The 1.x package retains Node 20 compatibility, but release and supply-chain workflows use Node 24 LTS.
rm -rf node_modules dist
npm ci --ignore-scriptsUse npm ci, not npm install, when validating a proposed commit. npm ci proves the committed lockfile is reproducible and refuses manifest drift.
npm run verify:allExpected stages:
- TypeScript build
- Strict no-emit typecheck
- Declaration-consumer compilation
- ESLint
- Provider-boundary probe
- Complete Vitest suite
- Production dependency audit
- Package allowlist and isolated-consumer smoke test
A failure in any stage blocks merge or release.
npm run build
npm run verify:types
npm run verify:declarations
npm run lint
npm run lint:boundary
npm test
npm run test:inventory
npm audit --audit-level=high --omit=dev
npm run verify:packagenpm pack --json --ignore-scriptsThe tarball may contain only:
package.jsonREADME.mdARCHITECTURE.mdRUNBOOK.md- compiled
dist/files
npm run verify:package enforces this allowlist, installs the tarball into an isolated temporary consumer, and checks the root plus supported subpath exports.
Symptom: npm run lint:boundary or tests/eslint-boundary.test.ts fails.
Recovery:
- Find the production file importing
src/providers/*. - Route execution through
L9LLMRouteror move provider I/O into the approved provider boundary. - Do not disable the lint rule or add a broad ignore.
- Rerun
npm run lint:boundaryand the full suite.
Symptom: an unknown, duplicate, or already-settled reservation error.
Recovery:
- Confirm every successful request reconciles exactly once.
- Confirm every unbilled failure releases exactly once.
- Confirm the reservation ID factory cannot return duplicates.
- Inspect
getClientBudgetReport()for active reservations. - Do not mutate internal maps or compensate by recording spend manually.
The tracker is process-local. Cross-process consistency requires an external persistence design and is not implemented in this package.
Symptom: provider calls remain blocked after the cooldown or too many recovery calls escape.
Recovery:
- Inspect
getCircuitState(provider). - Confirm every acquired permit is completed with
recordSuccess,recordFailure, orrelease. - Confirm only retryable network, timeout, rate-limit, and server failures are counted.
- Confirm only one half-open probe is active.
- Do not close an open circuit based on a stale pre-open success.
Fallbacks advance only after retryable provider failures. A 4xx client error, local validation failure, or cancellation must stop immediately.
Check:
- provider error
kind retryable- provider request ID
- retry-after metadata
- abort signal state
The SDK retry count must remain zero so attempts stay explicit in router behavior.
Control Plane builders reject unknown fields, invalid combinations, non-finite values, cycles, accessors, sparse arrays, unsupported objects, and hash mismatches.
Recovery:
- Validate against the exported Zod schema.
- Pass plain JSON-compatible values.
- Normalize unordered sets through the builder rather than precomputing hashes.
- Rebuild the artifact instead of editing identity fields manually.
- Run
tests/control-plane/*.
- Rebase onto the intended release base.
- Run a clean
npm ci --ignore-scripts. - Run
npm run verify:all. - Inspect
npm pack --json --ignore-scripts. - Confirm the version is publishable and has not already been released.
- Confirm the tag matches the package version.
- Push the tag only after all release evidence is captured.
The GitHub publish workflow validates again before npm publish.
Stop the merge or release train on the first regression.
For an unmerged branch, revert or amend only the failing change and rerun all gates. For a merged regression, revert the most recent merge, validate main, and reopen the affected work. Do not stack compensating changes on a red baseline.
For an already published package, npm packages are immutable. Publish a corrected patch version and deprecate the defective version with a clear migration note.