Files
suaveplan/openspec/archive/2026-05-25-api-loader/tasks.md
2026-05-27 23:29:53 +01:00

72 lines
3.7 KiB
Markdown

# Tasks — `@suaveplan/api-loader`
> Every checkbox MUST reflect work actually done in this change.
## 0. Pre-flight (non-negotiable)
- [x] 0.1 Confirm clean working tree and accounted-for worktrees (verified in worktree-isolated dispatch)
- [x] 0.2 Worktree discipline — agent ran in isolated `.claude/worktrees/agent-*/`
- [x] 0.3 Package set tracked via `MANIFEST.md` regen (post-merge)
## 1. Spec authoring
- [x] 1.1 Read design doc §8.1, §8.1a, §8.2
- [x] 1.2 Confirmed `openspec/specs/api-loader/spec.md` is net-new
- [x] 1.3 Read `openspec/AGENTS.md`
- [x] 1.4 `proposal.md`
- [x] 1.5 Source-mapping table
- [x] 1.6 `specs/api-loader/spec.md`
- [x] 1.7 `**Verified by:**` line on every requirement
## 2. Implementation
- [x] 2.1 Package scaffolded at `packages/api-stack/api/api-loader/` (`0.1.0`, `sideEffects: false`; deps `@suaveplan/api-types`, `@suaveplan/error`, `tslib`, `zod`)
- [x] 2.2 `src/resolver/` — `ModuleResolver`, `ModuleHandle`, `ResolveOptions`, `ModuleResolverFactory` types
- [x] 2.3 `src/cache-bust/` — `bustSpecifier(url, version)` pure helper using WHATWG URL
- [x] 2.4 `src/rollback-journal/` — `RollbackJournal` interface + reference `createRollbackJournal(depth)` ring-buffer
- [x] 2.5 `src/journal-entry/` — `rollbackJournalEntryPersistedSchema` (strict Zod, sha256 regex)
- [x] 2.6 `src/native-binding-detector/` — `NativeBindingDetector` type, `assertNoNativeBindings`, `LoaderError` subclass
- [x] 2.7 `src/error-codes/` — `LOADER_CODES` registry (4 entries)
- [x] 2.8 `src/testing/` — `runLoaderConformance` + `runRollbackJournalConformance` harnesses
- [x] 2.9 `src/index.ts` — explicit named re-exports
- [x] 2.10 `package.json` `exports` with 8 subpaths
## 3. Tests
- [x] 3.1 Unit tests for `cache-bust`, `journal-entry`, `native-binding-detector`, `error-codes`, `rollback-journal`
- [x] 3.2 Spec-conformance type tests for `resolver` (interface-only `expectTypeOf`)
- [x] 3.3 Property-style sweep on `bustSpecifier` (monotonic series, replace-not-concat)
- [x] 3.4 Every `it(...)` carries `{ timeout: 5000 }`
## 4. Documentation
- [x] 4.1 Sibling `.md` for every implementation `.ts` (7 docs)
- [x] 4.2 `README.md` linking every `.md`
- [x] 4.3 No CLAUDE.md update
## 5. Pre-archive verification
- [x] 5.1 `bunx turbo lint --filter=@suaveplan/api-loader` — green
- [x] 5.2 `bunx turbo typecheck --filter=@suaveplan/api-loader` — green
- [x] 5.3 `bunx turbo test:coverage --filter=@suaveplan/api-loader` — 100/100/100/100
- [x] 5.4 `bun scripts/lint/check-feature-layout.ts` + `check-test-runner-imports.ts` — green
- [x] 5.5 `bunx turbo build --filter=@suaveplan/api-loader` — green
- [x] 5.6 `bun run docs:check` — 7/7 (100%)
## 6. Pre-archive 7-row checklist
- [x] 6.1 Generics on `ModuleResolver<M>` and `ModuleHandle<M>`; `expectTypeOf` proves resolve/dispose/walkNativeBindings shapes
- [x] 6.2 Zod wired at `journal-entry` boundary (`.strict()` + sha256 regex)
- [x] 6.3 Every `LOADER_CODES` entry referenced — `NATIVE_BINDING_HELD` thrown by `assertNoNativeBindings`; `MODULE_IMPORT_FAILED` documented in resolver contract + harness; `JOURNAL_FULL` / `JOURNAL_ENTRY_INVALID` reserved for host-side impls (documented in `error-codes.md`)
- [x] 6.4 Ring-buffer overflow + boundary behaviors tested (capacity eviction, depth=5 custom, peek(0), peek > length, clear-then-push)
- [x] 6.5 OTel — N/A at contract level (concrete loader emits)
- [x] 6.6 Lifecycle dedup — N/A at contract level
- [x] 6.7 No retroactive tick
## 7. Archive
- [x] 7.1 Spec delta folded into `openspec/specs/api-loader/spec.md`
- [x] 7.2 Moved to `openspec/archive/2026-05-25-api-loader/`
- [ ] 7.3 Umbrella tick (1.11) — left for parent orchestrator
- [ ] 7.4 `MANIFEST.md` regen — left for parent orchestrator (post-merge)