3.5 KiB
3.5 KiB
Capability Spec Delta: mime (spec-conformance)
Package: @suaveplan/mime
Status: PROPOSED
This delta annotates each existing requirement in openspec/specs/mime/spec.md with a **Verified by:** line and rectifies two pieces of implementation drift (MIME-07 and MIME-12 / MIME-16 schema invocation). No requirement semantics change.
MODIFIED Requirements
(See openspec/specs/mime/spec.md for the full requirement bodies.)
| Requirement | Verified by |
|---|---|
| MIME-01 Magic-byte detection via compiled trie | src/detection/detection.magic.test.ts |
| MIME-02 All-matches magic-byte detection | src/detection/detection.magic.test.ts |
| MIME-03 RFC 7231 Content-Type parsing | src/content-type/content-type.test.ts |
| MIME-04 Content-Type round-trip serialisation | src/content-type/content-type.test.ts (incl. property-based) |
| MIME-05 Content-Type equality and matching | src/content-type/content-type.test.ts |
| MIME-06 Curated IANA-sourced registry | src/db/db.test.ts |
| MIME-07 Runtime registry extension | src/db/db.test.ts AND src/db/db.spec-conformance.test.ts |
| MIME-08 Reverse lookups | src/reverse/reverse.test.ts |
| MIME-09 BOM charset sniffing | src/charset/charset.test.ts |
| MIME-10 HTML meta charset sniffing | src/charset/charset.test.ts |
| MIME-11 XML declaration charset sniffing | src/charset/charset.test.ts |
| MIME-12 Unified detect() | src/detection/detection.extension-contenttype.test.ts AND src/db/db.spec-conformance.test.ts |
| MIME-13 detectFromStream() interim shim | src/detection/stream.test.ts |
| MIME-14 Signature registry extension | src/detection/from-magic-bytes/registry.test.ts AND signature-pack tests |
| MIME-15 Structured errors | src/error-codes.test.ts AND src/errors/errors.test.ts |
| MIME-16 Zod schemas | src/schemas/mime.schemas.test.ts AND src/db/db.spec-conformance.test.ts |
| MIME-17 OTel instrumentation | src/telemetry/meters.test.ts |
| MIME-18 Legacy shim | src/legacy/legacy.test.ts |
| MIME-19 Property-based tests | src/content-type/content-type.test.ts (round-trip property) AND src/detection/detection.magic.test.ts::"always returns MagicBytesResult or undefined — never throws" AND src/db/db.test.ts::"every registered entry is retrievable by mime" |
| MIME-20 Benchmarks | src/db/db.spec-conformance.test.ts::"src/__benchmarks__/ exists with the documented bench suites" |
| MIME-21 sideEffects: false + 100% coverage | tests/tree-shake.test.ts AND tests/no-disallowed.test.ts AND coverage gate |
Newly added tests in this change
src/db/db.spec-conformance.test.ts— pinsregisterMimeEntryParseError on invalid shape (MIME-07),detectParseError on invalid input field types (MIME-12 / MIME-16), and__benchmarks__/mime.bench.tsexistence (MIME-20).
Drift fixed inline
src/db/registry.ts::registerMimeEntrynow invokesMimeEntrySchema.safeParseand throwsParseErroron failure.src/detection/detect.ts::detectnow invokesDetectInputSchema.safeParseand throwsParseErroron field-type mismatches; the at-least-one-source refinement is treated as non-fatal so the documenteddetect({})→application/octet-streamdefault is preserved.SignatureSchema,MagicBytesResultSchema,ExtensionDetectionResultSchema,ContentTypeDetectionResultSchema,StreamDetectionResultSchema, andDetectResultSchemacarry// schema: boundary-onlymarkers — they describe cross-process serialisation shapes, not runtime arguments.