5.7 KiB
5.7 KiB
Tasks: enterprise-drive-sharing
Change ID: enterprise-drive-sharing
Package: @suaveplan/drive-sharing
Target path: packages/drive/drive-sharing
Prerequisite packages on Verdaccio: @suaveplan/drive, @suaveplan/error, @suaveplan/types, @suaveplan/crypto, @suaveplan/crypto-cipher, @suaveplan/crypto-hash, @suaveplan/crypto-utils, @suaveplan/events
Every checkbox MUST reflect work actually done in this change. Do not retroactively tick boxes for work that was already in main when this change opened. Do not tick a box for a test that doesn't exist or doesn't pin the requirement it claims to verify.
1. Spec authoring
- 1.1 Read
../suaveplan/enterprise/drive-sharing.mdend-to-end - 1.2 Read
openspec/specs/drive-sharing/spec.md(if it exists) - 1.3 Read
openspec/AGENTS.mdSections 13 and 14 - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Fill in
## Source mappingtable inproposal.md— every requirement cites a line range OR appears in the "no source line" table with justification - 1.6 Draft
specs/drive-sharing/spec.mdfromopenspec/templates/spec-delta.md - 1.7 Every requirement in the spec delta carries a
**Verified by:**line naming concreteit(...)titles
2. Implementation
- 2.1 Scaffold
packages/drive/drive-sharing/withsrc/,tests/,src/__benchmarks__/, and all feature subdirectories perproposal.mdlayout - 2.2 Write
package.jsonat0.1.0with"type": "module","sideEffects": false, fullexportsmap, catalog deps, and dev deps - 2.3 Write
tsconfig.lib.jsonextending../../../tsconfig.base.json - 2.4 Write
vitest.config.tsusingcreateTestConfig()from@suaveplan/testing/config - 2.5 Implement
src/types/common.ts— branded types,Result, ID factories, common interfaces - 2.6 Implement
src/types/schemas.ts— Zod schemas for all public option types - 2.7 Implement
src/error-codes.ts—DriveShareErrorCode,DRIVE_SHARE_CODES,DriveShareError,registerDriveShareErrorCodes() - 2.8 Implement
src/constants/index.ts—DEFAULT_TOKEN_TTL_MS,DEFAULT_GRANT_TTL_MS,ENCRYPTION_ALGORITHM,KEYRING_FORMAT_VERSION, capacity caps - 2.9 Implement
src/encryption/envelope/envelope.ts—CryptoProvider,WebCryptoProvider,envelopeEncrypt,envelopeDecrypt,wrapKey,unwrapKey,rewrapKey,computeIntegrity,verifyIntegrity - 2.9a Wire
randomBytesfrom@suaveplan/crypto-utilsthroughWebCryptoProvidernonce generation - 2.10 Implement
src/encryption/key-ring/key-ring.ts—KeyRingwith add/get/remove/rotate/export/import and events - 2.11 Implement
src/partitions/partition-policy/partition-policy.ts—createPolicy,getDefaultPolicy,mergePolicies,validateAction,requiresEncryption,requiresReauth,DEFAULT_PRESETS - 2.12 Implement
src/partitions/partition-store/partition-store.ts—PartitionStoreinterface,InMemoryPartitionStore - 2.13 Implement
src/partitions/partition-manager/partition-manager.ts— CRUD, membership, policy validation, events, OTel - 2.14 Implement
src/sharing/grants/grants.ts—GrantManagerwith create/check/revoke/list, OTel - 2.15 Implement
src/sharing/tokens/tokens.ts—TokenManagerwith create/validate/revoke/list, injectable clock, OTel, HMAC integrity - 2.16 Implement
src/transfer/transfer/transfer.ts—TransferManagerwith KEK resolution, DEK rewrap, policy validation,AbortSignal, OTel
3. Tests
- 3.1 Unit tests at
src/<feature>/<feature>.test.tscovering every scenario inspecs/drive-sharing/spec.md - 3.2 Spec-conformance tests at
src/<feature>/<feature>.spec-conformance.test.tspinning type-level / observability / strict-mode / lifecycle scenarios - 3.3 Integration test at
tests/integration.test.ts— end-to-end: create partition, add member, grant, transfer - 3.4 Property tests at
tests/property.test.ts— grant expiry, token revocation finality, policy merge commutativity, partition member invariant - 3.5 Every
it(...)carries{ timeout: 5000 }(or30000for genuinely async / crypto)
4. Documentation
- 4.1 Sibling
.mdfor every implementation.ts(≥200 words, basic + advanced examples, full API reference) - 4.2 Root
packages/drive/drive-sharing/README.mdwith install, quick-start, modules list, benchmark table - 4.3 Update
CLAUDE.mdpackage listing to include@suaveplan/drive-sharing
5. Pre-archive verification (the 5-gate triple)
- 5.1
bunx biome check src/ tests/— 0 errors / 0 warnings - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/drive-sharing— green - 5.3
bunx turbo test:coverage --filter=@suaveplan/drive-sharing— 100/100/100/100 - 5.4
bunx turbo build --filter=@suaveplan/drive-sharing— green
6. Pre-archive 7-row checklist (AGENTS.md Section 13)
- 6.1 Generics threaded;
expectTypeOfassertions on every literal-type claim - 6.2 Zod schemas wired at every declared boundary
- 6.3 Every error code in
error-codes.tsthrown by at least one production path - 6.4 Strict-mode behaviors tested both on and off (read-only mode, abort signal)
- 6.5 OTel instruments emitted from production paths and asserted with capture-MeterProvider
- 6.6 Lifecycle dedup tested where claimed (idempotent revoke, idempotent removeMember)
- 6.7 No retroactive tick — every box above reflects work done in this change
7. Archive
- 7.1 Fold spec delta into
openspec/specs/drive-sharing/spec.md - 7.2 Move
openspec/changes/enterprise-drive-sharing/→openspec/archive/2026-05-04-enterprise-drive-sharing/ - 7.3 Refresh
MANIFEST.mdif package set or deps changed (orchestrator §13b)