5.4 KiB
5.4 KiB
Tasks: drive-template-drive-surface
Change ID: drive-template-drive-surface
Capability: extends drive capability + cross-cutting consumption of drive-template
Target paths: packages/drive/drive/
Every checkbox MUST reflect work actually done in this change.
1. Spec
- 1.1
proposal.mddrafted with §Why / §What changes / §Out of scope / §Migration impact / §Verification approach - 1.2 No spec delta file — the additions extend the existing
drivecapability spec; the canonicalopenspec/specs/drive/spec.mdwill fold the additions on archive
2. Implementation — @suaveplan/drive surface additions
- 2.1
src/drive/file-location-index.ts—FileLocationIndexclass +FileLocationEntryinterface +emptyPresence()helper - 2.2
src/drive/hydrate-from.ts—Drive.hydrateFromorchestrator with 8-step validation pipeline, AbortSignal support, mid-iteration rollback viaawait Promise.resolve()yields - 2.3
src/drive/get-key-status.ts—Drive.getKeyStatus(path)synchronous three-state lookup - 2.4
src/drive/get-presence.ts—Drive.getPresence(path)chunk-level progress lookup - 2.5 Update
src/types/drive.types.ts— addKeyStatus/ChunkPresence/HydrateOptions/HydrateResult/HydrateProgressEventtypes; extendDriveEntrywith optionalkeyStatus/presence; extendDriveOptionswithourPubkey - 2.6 Update
src/drive/drive.ts— wirehydrateFrom/getKeyStatus/getPresencemethods, exposefileLocationIndexgetter, acceptourPubkeyconstructor option - 2.7 Update
src/error-codes.ts— addNOT_FOUND/UNAVAILABLE/ALREADY_HYDRATED/HYDRATE_ABORTEDcodes - 2.8 Bus listener registration in
hydrateFromforkind: 'retroactive'files, withvalidateKeyGrantfrom@suaveplan/drive-template - 2.9 Sibling
.mdfor every new implementation file (hydrate-from.md,get-key-status.md,get-presence.md,file-location-index.md) - 2.10 Update
src/index.tsbarrel — export new types and surface - 2.11 Update
package.json— add@suaveplan/drive-templateruntime dep +@suaveplan/crypto-curve/@suaveplan/crypto-utilsdev deps for tests - 2.12 Update
vite.config.tsexternals - 2.13
Cache-eviction loop honoring RetentionPolicy per file— DEFERRED. Needs tighter integration with@suaveplan/drive-plugin-chunksto know per-file chunk inventory; ships indrive-template-retention-loopfollow-up.
3. Tests
- 3.1
tests/hydrate-from.test.ts— successful hydration, abort cancellation (pre + mid-iteration with rollback), encrypted-vs-plain counting, preFetch modes, already-hydrated rejection, progress events, NOT_INITIALIZED guard - 3.2
tests/get-key-status.test.ts— three-state contract + NOT_FOUND - 3.3
tests/get-presence.test.ts— progress shape contract + NOT_FOUND - 3.4
tests/retroactive-key-grant.test.ts— valid grant flips lock, defensive branches (unknown fileId / unencrypted / already-unlocked / no-ourPubkey), bad-issuer rejection - 3.5
tests/file-location-index.test.ts— direct unit tests for the index methods (set / getByPath / getByFileId / deleteByPath / clear / iterate / emptyPresence) - 3.6
— DEFERRED with the cache-eviction work; no current code path emitstests/policy-meshallowed-false.test.tscd:requestdirectly from drive proper - 3.7
— DEFERRED; needstests/policy-cdnallowed-false.test.tsdrive-transport-httpsintegration - 3.8
— covered by hydrate-from'stests/policy-autodownload.test.tspreFetch:'auto-download-files'test - 3.9
— DEFERRED with cache-eviction worktests/retention-lru.test.ts - 3.10
— DEFERRED with cache-eviction worktests/retention-max-age.test.ts - 3.11
— covered by retroactive-key-grant; inline (sealed-box) key unwrap lives ontests/inline-key-unlock.test.ts@suaveplan/cryptonot drive - 3.12
tests/list-with-presence.test.ts— covered by getKeyStatus / getPresence direct tests;Drive.listenrichment ships with the chunks-plugin integration
4. Pre-archive verification
- 4.1
bunx turbo lint typecheck test --filter=@suaveplan/drive— green (88 tests across 13 files) - 4.2
bunx turbo test:coverage --filter=@suaveplan/drive— 100/100/100/100 - 4.3
bunx turbo build --filter=@suaveplan/drive— green - 4.4
bunx turbo lint typecheck test:coverage --filter=@suaveplan/drive-template— green (drive-template's verify catch arms restored with injectableverifyFnper AGENTS.md §7a; verify-catch-arms.test.ts exercises the catch path) - 4.5
bun run docs:check --filter=@suaveplan/drive— every implementation.tshas a sibling ≥200-word.md(pre-existing stub docs were filled in as part of this change)
5. AGENTS.md additions (cross-cutting)
- 5.1 §2b "NEVER ship stubs, placeholders, or work-in-progress code" added to
openspec/AGENTS.md - 5.2 §7a "Never delete code that serves a purpose to make tests / coverage pass" added to
openspec/AGENTS.md - 5.3 §7's "Tautological tests" bullet strengthened with explicit
expect(true).toBe(true)ban + reviewer guidance
6. Archive
- 6.1 Move
openspec/changes/drive-template-drive-surface/→openspec/archive/2026-05-04-drive-template-drive-surface/ - 6.2 Update
CLAUDE.md@suaveplan/drivepackage bullet with new surface - 6.3 Refresh
MANIFEST.md