feat(coding): generate version-check bindings via fluessig#328
Conversation
Swap the two pure hand-written `#[napi]` comparators from coding-agent utils/version-check.ts to the fluessig-generated path: author the ops in schema/api.json, add the `core_impl` delegations, regenerate src/generated.rs, and delete the hand-written exports from src/lib.rs. `comparePackageVersions(leftVersion: string, rightVersion: string) -> number | null` is a nullable-int32 op: `core_impl` maps the engine's `Ordering` to `-1`/`0`/`1` and passes `None` through as JS `null`, exactly as the hand-written wrapper did. `isNewerPackageVersion(candidateVersion: string, currentVersion: string) -> boolean` delegates straight through. Both reach the SAME `pidgin_coding::utils::version_check` functions, so JS-visible behavior is byte-for-byte unchanged. The HTTP-backed exports (checkForNewPiVersion, getLatestPiRelease, ...) are not part of this crate's surface; the shim re-exports them from pi's original module. Verified: each swapped symbol's generated `.d.ts` JSDoc+signature block, its `.js` `module.exports` line, and its nativeBinding destructure entry are byte-identical to a pre-swap build of the base (module 2). cargo build/fmt/clippy clean; codespell 0; straitjacket 0 errors. Oracle: version-check.test.ts is mixed (its fetch cases mock the original HTTP path), so only the pure `compares package versions` case is run against the generated addon — it passes (1 passed, 5 fetch-mocked cases skipped); the byte-diff gate covers the full swapped surface.
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 |
Before
Two exports of the
version-checkmodule were hand-written#[napi]wrappers insrc/lib.rs:comparePackageVersions(left, right) → number | null(nullable int32)isNewerPackageVersion(candidate, current) → boolAfter
Both exports are now generated by fluessig instead of being hand-written, byte-identical to the previous build (2/2 identical:
.d.tsblocks,.jsmodule.exportslines,nativeBindingmembership).comparePackageVersionsis the first nullable-int32 op — fluessig composed it cleanly;core_implmapsOrdering→-1/0/1and passesNone→ JSnull, as the hand-written wrapper did.How
schema/api.json(catalog.json unchanged).core_impldelegations to the same core comparators the hand-written exports called.src/generated.rs, then deleted the hand-written#[napi]exports fromsrc/lib.rs.Stacked on
napi-fluessig/changelog.Generated by Claude Code