3.8 KiB
3.8 KiB
Tasks — @suaveplan/api-lifecycle
Every checkbox MUST reflect work actually done in this change.
0. Pre-flight (non-negotiable)
- 0.1 Confirm clean working tree (
git statusreports nothing) and no in-flight worktrees with uncommitted work (git worktree listthengit statusin each) - 0.2 If any worktrees exist under
.claude/worktrees/, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (git worktree remove) before opening a new one — code that has been lost twice on main is the failure mode this guards against. - 0.3 Confirm the package set in
MANIFEST.mdmatchesfind packages -maxdepth 3 -name package.jsoncount. Drift here means a prior change archived without regenerating the manifest.
1. Spec authoring
- 1.1 Read design doc §4 (full section)
- 1.2 Read
openspec/specs/api-lifecycle/spec.md(does not exist yet) - 1.3 Read
openspec/AGENTS.mdSections 13, 14 - 1.4 Draft
proposal.md - 1.5 Source-mapping table
- 1.6 Draft
specs/api-lifecycle/spec.md - 1.7
**Verified by:**line on every requirement
2. Implementation
- 2.1 Scaffold
packages/api/api-lifecycle/("version": "0.1.0","sideEffects": false, deps:@suaveplan/api-types,@suaveplan/fsm,@suaveplan/retry,@suaveplan/error,@suaveplan/types) - 2.2
src/states/—PluginStateconstants + runtime introspection helpers - 2.3
src/transitions/—PluginTransitionsfrozen table - 2.4
src/fsm-factory/—createPluginFsmbinding to@suaveplan/fsm - 2.5
src/side-effects/— descriptors per transition - 2.6
src/retry-policies/—start_failed+crashedretry policies - 2.7
src/mutex-contract/—PluginMutexinterface (impl inapi-host) - 2.8
src/reinstall-criteria/—requiresReinstall(prev, next)pure function - 2.9
src/error-codes/—LIFECYCLE_CODES - 2.10
src/testing/—runLifecycleConformance(factory) - 2.11
src/index.ts— explicit named re-exports - 2.12
package.jsonexportsper subpath
3. Tests
- 3.1 Unit tests per feature
- 3.2 Spec-conformance type tests (states union matches design §4 exactly)
- 3.3 Property test on
requiresReinstall(identical manifests → false; any reinstall-triggering diff → true) - 3.4 Every
it(...)carries{ timeout: 5000 }
4. Documentation
- 4.1 Sibling
.mdfor every implementation.ts - 4.2
README.mdlinking every.md - 4.3 No CLAUDE.md update
5. Pre-archive verification
- 5.1
bun run check— 0/0/0 - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/api-lifecycle— green - 5.3
bunx turbo test:coverage --filter=@suaveplan/api-lifecycle— 100/100/100/100 (mutex-contract types-only file — N/A) - 5.4
bun scripts/openspec-conformance.ts @suaveplan/api-lifecycle— exit 0 - 5.5
bunx turbo build --filter=@suaveplan/api-lifecycle— green
6. Pre-archive 7-row checklist
- 6.1 Generics — none required at lifecycle level;
expectTypeOfpins state union exactness - 6.2 Zod — N/A (no inputs to validate at this layer; manifest is validated by
api-manifest) - 6.3 Every
LIFECYCLE_CODESentry thrown - 6.4 Retry on/off behaviors tested;
crashRestartCooldownMsbudget reset tested - 6.5 OTel — N/A (host driver emits)
- 6.6 Lifecycle dedup — mutex contract pins at-most-one-in-flight; concurrent-trigger queue test
- 6.7 No retroactive tick
7. Archive
- 7.1 Fold spec delta
- 7.2 Move to
openspec/archive/<yyyy-mm-dd>-api-lifecycle/ - 7.3 Tick umbrella
1.12 - 7.4 Refresh
MANIFEST.md
Status
STATUS ✅ SHIPPED 2026-05-25 — @suaveplan/api-lifecycle 0.1.0 (lint+typecheck+test green, 103 tests, 100/100/100/100 coverage)