feat(coding-agent): generate the session-cwd surface via fluessig#323
feat(coding-agent): generate the session-cwd surface via fluessig#323zmaril wants to merge 1 commit into
Conversation
Swap the hand-written `#[napi]` session-cwd exports (coding-agent core/session-cwd.ts: `getMissingSessionCwdIssue`, `formatMissingSessionCwdError`, `formatMissingSessionCwdPrompt`, plus the `SessionCwdIssueJs` DTO) to the fluessig-generated path: author the ops + DTO in schema/api.json, add the three `core_impl` delegations (with the DTO conversions and the `SessionCwdSource` adapter) to core_impl.rs, regenerate src/generated.rs, and delete the hand-written src/session_cwd.rs module (dropping `pub mod session_cwd;`). This is the first swap to exercise a DTO across the boundary in BOTH directions: `SessionCwdIssueJs` is a fluessig `model` used as a nullable RETURN (`getMissingSessionCwdIssue -> SessionCwdIssueJs | null`) and as a by-value PARAM (the two formatters take `issue: SessionCwdIssueJs`), and it carries an optional field (`sessionFile?: string`). fluessig lowers all three — `Option<Model>` return, `Model` param, and the nullable model field (`Option<String>`) — with no gap. The `core_impl` methods reach the SAME `pidgin_coding::core::session_cwd` port the hand-written exports called (the empty-cwd guard + `existsSync` -> `Path::exists` probe + both format strings), so JS-visible behavior is unchanged; pi's `MissingSessionCwdError` class identity stays in the TS shim. Verified: each swapped symbol's generated `.d.ts` block (the `SessionCwdIssueJs` interface with `sessionFile?: string`, and all three function JSDoc+signature blocks), its `.js` `module.exports` line, and its nativeBinding destructure entry are byte-identical to a pre-swap build of the base (only file position moves into the generated cluster). cargo build/fmt/clippy clean; codespell 0; straitjacket 0 errors; the session-cwd oracle slice (coding-agent/test/session-cwd.test.ts, 3 tests) passes 3/3 against the locally-built generated addon. 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/1293 (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 |
Swap the hand-written
#[napi]session-cwd exports (coding-agentcore/session-cwd.ts) to the fluessig-generated path.Module 12 of the pidgin-napi → fluessig campaign (module 2 of this stacked batch of 3). Stacked on
napi-fluessig/strip-ansi(#322).What changed
SessionCwdIssueJsDTO inschema/api.json.core_impldelegations (DTO conversions +SessionCwdSourceadapter) reaching the samepidgin_coding::core::session_cwdport the hand-written exports called.src/generated.rs; deletesrc/session_cwd.rsand droppub mod session_cwd;.First DTO-both-directions swap
SessionCwdIssueJsis a fluessigmodelused as a nullable return (getMissingSessionCwdIssue -> SessionCwdIssueJs | null), a by-value param (both formatters takeissue: SessionCwdIssueJs), and carries an optional field (sessionFile?: string). fluessig lowersOption<Model>return,Modelparam, and the nullable model field (Option<String>) with no gap.Gates
SessionCwdIssueJsinterface (sessionFile?: string) and all three function JSDoc+signature blocks, their.jsmodule.exportslines, and nativeBinding destructure entries are byte-identical (only file position moves into the generated cluster).cargo build -p pidgin-napi,cargo fmt --all --check,cargo clippy -p pidgin-napi --all-targets -- -D warningsclean; codespell 0.coding-agent/test/session-cwd.test.ts: 3/3 pass against the locally-built generated addon.🤖 Generated with Claude Code
https://claude.ai/code/session_017xL2W7dkhPsTSRuXQNCDeY
Generated by Claude Code