5.7 KiB
5.7 KiB
Tasks — Enterprise hardening (extensibility cluster) for @suaveplan/packer
1. Spec authoring
- 1.1 Read
../suaveplan/enterprise/packer.mdend-to-end - 1.2 Read
openspec/specs/packer/spec.md - 1.3 Read
openspec/AGENTS.mdSections 13 and 14 - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Fill in
## Source mappingtable — every requirement cites a line range - 1.6 Draft
specs/packer/spec.mdfromopenspec/templates/spec-delta.md - 1.7 Every requirement in the spec delta carries a
**Verified by:**line naming concreteit(...)titles
2. Implementation — error codes (E-1 / E-2 / E-3)
- 2.1 Add
FORMAT_VERSION_UNSUPPORTEDandPLUGIN_FAILEDcodes tosrc/error-codes.tswith metadata. - 2.2 Add catalog keys
packer.error.FORMAT_VERSION_UNSUPPORTED.v2-not-implemented,packer.error.PLUGIN_FAILED.<hook>tosrc/i18n/messages.ts.
3. Implementation — schema registry (E-1)
- 3.1 Add
@suaveplan/schema-registrytopacker/package.jsondeps (workspace:^). - 3.2 New
src/schemas/registration.ts—registerPackerSchemas(registry)+getPackerSchemaRegistry(), registering every Zod schema inpacker.schemas.tsplus apacker-chunk-formatsubject with V1 evolution metadata. - 3.3 Sibling
registration.md+registration.types.ts+index.tsbarrel. - 3.4 Subpath export
./schemasinpackage.json.
4. Implementation — feature flags (E-2)
- 4.1 Add
@suaveplan/feature-flagstopacker/package.jsondeps (workspace:^). - 4.2 New
src/flags/flags.ts—PackerFeatureFlagsinterface,defaultPackerFlags()no-op,resolvePackerFlags(opts)factory,PACKER_FLAG_KEYSconstants. - 4.3 Sibling
flags.md+flags.types.ts+index.tsbarrel. - 4.4
Packer.packreadspacker.format.v2from the resolved provider; when truthy, throwsPackerError(PACKER.FORMAT_VERSION_UNSUPPORTED). - 4.5
PackerOptions.flags?: PackerFlagsOptionsthreaded throughAbstractPacker.resolvedOptions. - 4.6 Subpath export
./flagsinpackage.json.
5. Implementation — plugin interface (E-3)
- 5.1 New
src/plugins/plugins.ts—PackerPlugincontract,PluginPipeline.runHook(name, ctx), error mapping toPACKER.PLUGIN_FAILED. - 5.2 Sibling
plugins.md+plugins.types.ts+index.tsbarrel. - 5.3
PackerOptions.plugins?: ReadonlyArray<PackerPlugin>threaded throughAbstractPacker. - 5.4
Packer.packinvokesonPackStart→ per-entryonEntry→onPackEndin declaration order around the pipeline. - 5.5
Unpacker.unpackinvokesonUnpackStart→onEntryDecoded→onUnpackEnd. - 5.6 Subpath export
./pluginsinpackage.json.
6. Tests — schema registry, flags, plugins
- 6.1
src/schemas/registration.test.ts+.spec-conformance.test.ts— every schema registered, V1 evolution metadata, BACKWARD compatibility, singleton invariant. - 6.2
src/flags/flags.test.ts+.spec-conformance.test.ts— default provider returns V1 for every key, V2 throwsPACKER.FORMAT_VERSION_UNSUPPORTED, custom evaluator wiring, integration withPacker.packwrite path. - 6.3
src/plugins/plugins.test.ts+.spec-conformance.test.ts— declaration-order hook fire, error →PACKER.PLUGIN_FAILED, noop-logger + double-integrity example plugins exercised against realPacker+Unpacker.
7. Tests — fast-check property (E-4)
- 7.1
src/__property__/round-trip.property.test.ts— pack→unpack identity over arbitraryUint8Arrayinputs; streaming↔batch equivalence via chunked pack. - 7.2
src/__property__/determinism.property.test.ts— same inputs + seeded Rng + fixed Clock ⇒ byte-identical bundles.
8. Benchmarks (E-5)
- 8.1
src/__benchmarks__/packer.bench.ts— mitata suite (whole-file pack/unpack, chunked single + 1000 chunks, integrity verify, plugin overhead). - 8.2
bun run benchmarkscript inpackage.json. - 8.3
README.mdBenchmarks section with baseline numbers and hardware/runtime context line.
9. Documentation
- 9.1 Sibling
.mdfor every new.ts(≥200 words, basic + advanced examples). - 9.2 Update
README.mdModules list withflags/,plugins/,schemas/registration.
10. Pre-archive verification (the 5-gate triple)
- 10.1
bun run check— Biome 0/0/0. - 10.2
bunx turbo lint typecheck test --filter=@suaveplan/packer— green. - 10.3
bunx turbo test:coverage --filter=@suaveplan/packer— 100/100/100/100. - 10.4
bun scripts/openspec-conformance.ts @suaveplan/packer— exit 0. - 10.5
bunx turbo build --filter=@suaveplan/packer— green.
11. Consumer sweep
- 11.1
bunx turbo lint typecheck test --filter=@suaveplan/drive-plugin-chunks --filter=@suaveplan/drive-webrtc— green.
12. Pre-archive 9-row checklist
- 12.1 Generics threaded;
expectTypeOfassertions on every literal-type claim. - 12.2 Zod schemas wired at every declared boundary.
- 12.3 Every error code in
error-codes.tsthrown by at least one production path. - 12.4 OTel instruments emitted from production paths.
- 12.5 No
export *in feature barrels. - 12.6 No direct
vitest/bun:testimports. - 12.7 No retroactive tick — every box above reflects work done in this change.
- 12.8 Sibling
.mdfor every new.ts. - 12.9 Items E-1, E-2, E-3, E-4, E-5 each have ≥1 production code path and ≥1 test pinning every named scenario.
13. Archive
- 13.1 Fold
specs/packer/spec.mdintoopenspec/specs/packer/spec.md. - 13.2 Move
openspec/changes/enterprise-packer-extensibility/→openspec/archive/<yyyy-mm-dd>-enterprise-packer-extensibility/. - 13.3 Refresh
MANIFEST.md.