feat(coding): generate detectSupportedImageMimeType via fluessig (bytes path)#338
feat(coding): generate detectSupportedImageMimeType via fluessig (bytes path)#338zmaril wants to merge 1 commit into
Conversation
…es path) Swap the hand-written `detectSupportedImageMimeType` napi export (utils/mime.ts) for a fluessig-generated op, proving the #74 bytes path: the image buffer arg is authored as the `bytes` scalar and lowers to `Uint8Array` in the node `.d.ts` (a read-only view over the JS bytes), byte-matching the deleted hand-written `Uint8Array` param. The sniffed MIME type crosses back as `string | null`. - schema/api.json: add the op to the Pidgin interface (bytes param, nullable string return, infallible/readonly). - core_impl: delegate into `pidgin_coding::utils::mime`, the same logic the hand-written export called. - regen src/generated.rs (fluessig e056bb9); delete the hand-written `#[napi]` export from lib.rs; keep `pub mod generated;`. The generated `.d.ts` block, `.js` export, and nativeBinding entry are byte-identical to the pre-swap build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xL2W7dkhPsTSRuXQNCDeY
Conformance smoke: agent + ai + tui
Headline is rust-backed: passing cases in files whose module-under-test is a native (Rust addon) module. Raw all-pass is shown secondary — it is inflated by unflipped TypeScript that passes without touching any Rust.
agent: 55/180 (30.6%) · ai: 74/1295 (5.7%) · tui: 375/678 (55.3%) rust-backed = passing / total tests run, per the manifest's per-native-row AttributionA pi test file is rust-backed iff the module it primarily exercises — its module-under-test — is Per-file decisions (from each native manifest row's
CLI conformance (black-box, against the pidgin binary)
The four repointed coding-agent CLI test files spawn the compiled pidgin binary via |
What
Swaps the hand-written
detectSupportedImageMimeTypenapi export (utils/mime.ts) for a fluessig-generated op, proving the fluessig #74 bytes path at the bumped pin (e056bb9): abytesparam lowers toUint8Arrayin the node.d.ts(position-aware; abytesreturn would lower toBuffer).Stacked on
napi-fluessig/float-fuzzy(the f64/uint32 fuzzy swap).The bytes question (the point of this PR)
bytesbyte-matched the hand-written.d.tsexactly. The image buffer arg — hand-written asnapi::bindgen_prelude::Uint8Array— is authored inschema/api.jsonas thebytesscalar, and the node backend spells itUint8Arrayfor a PARAM. The generated.d.tsblock,.jsexport, and nativeBinding entry are byte-identical to a pre-swap build of the base; the symbol only changes position (moving into the generated block), exactly as the prior fuzzy swap did.Changes
schema/api.json: add the op to thePidgininterface (bytes param,nullablestring return, infallible/readonly).src/core_impl.rs: delegate intopidgin_coding::utils::mime— the same logic the hand-written export called.src/generated.rs: regenerated (fluessige056bb9).src/lib.rs: delete the hand-written#[napi]export; keeppub mod generated;.Verification
.d.tsblock +.jsexport + nativeBinding entry byte-identical (only position moves).cargo build -p pidgin-napi,cargo fmt --all --check,cargo clippy -p pidgin-napi --all-targets -- -D warnings: clean.codespell: 0.straitjacketv0.2.3 ongit archive HEAD: 0 errors (1 unrelated pre-existing warning inconformance/STEWARD.md).mime.tsnative withtests: [](pi's upstream tests aren't vendored in-repo, and the roadmap'simage-process.test.tsis mixed / not separable here), so the separabledetectSupportedImageMimeTypecase is checked directly against the locally-built addon — all 6 magic-byte cases (PNG / JPEG / JPEG-fractional-null / GIF / non-image-null / empty-null) pass.🤖 Generated with Claude Code
https://claude.ai/code/session_017xL2W7dkhPsTSRuXQNCDeY
Generated by Claude Code