Skip to content

feat(coding): generate trust-manager bindings via fluessig#329

Draft
zmaril wants to merge 1 commit into
napi-fluessig/version-checkfrom
napi-fluessig/trust-manager
Draft

feat(coding): generate trust-manager bindings via fluessig#329
zmaril wants to merge 1 commit into
napi-fluessig/version-checkfrom
napi-fluessig/trust-manager

Conversation

@zmaril

@zmaril zmaril commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Before

Two pure exports of the trust-manager module were hand-written #[napi] wrappers in src/lib.rs:

  • getProjectTrustParentPath(cwd) → string | null (nullable string)
  • hasTrustRequiringProjectResources(cwd, homeDir) → bool

After

Both exports are now generated by fluessig instead of being hand-written, byte-identical to the previous build (2/2 identical: .d.ts blocks, .js module.exports lines, nativeBinding membership). They delegate straight through (the _with_home seam for the second). The stateful / JSON-envelope exports (getProjectTrustOptions, trustStoreGetEntry, trustStoreSetMany) stay hand-written and remain in the addon — generated and hand-written coexist.

How

  • Added the two ops to the Pidgin interface in schema/api.json (catalog.json unchanged).
  • Added core_impl delegations to the same core fns the hand-written exports called.
  • Ran the regen chain (fluessig, pinned) to produce src/generated.rs, then deleted the hand-written #[napi] exports from src/lib.rs.

Stacked on napi-fluessig/version-check.


Generated by Claude Code

Swap the two pure hand-written `#[napi]` helpers from coding-agent
core/trust-manager.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.

`getProjectTrustParentPath(cwd: string) -> string | null` (nullable string) and
`hasTrustRequiringProjectResources(cwd: string, homeDir: string) -> boolean`
(bool) both delegate straight into `pidgin_coding::core::trust_manager` — the
same functions the hand-written exports called (the latter via the
`_with_home` seam), so JS-visible behavior is byte-for-byte unchanged. The
module's stateful / JSON-envelope exports (getProjectTrustOptions,
trustStoreGetEntry, trustStoreSetMany) stay hand-written for now and remain in
the addon surface alongside the two generated ops.

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 3). cargo build/fmt/clippy
clean; codespell 0; straitjacket 0 errors; the trust-manager oracle slice
(coding-agent/test/trust-manager.test.ts, 2 tests) passes 2/2 against the
locally-built generated addon (exercising both the two generated ops and the
still-hand-written trust exports).
@zmaril zmaril changed the title napi/fluessig: generate trust-manager path exports feat(coding): generate trust-manager bindings via fluessig Jul 21, 2026
@github-actions

Copy link
Copy Markdown

Conformance smoke: agent + ai + tui

  • pi_sha: 3da591ab74ab9ab407e72ed882600b2c851fae21
  • manifest_native_modules: 45

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.

Package rust-backed Native modules raw pass (secondary) Failing Skipped
agent 55/180 (30.6%) 5 180/180 0 0
ai 74/1295 (5.7%) 8 553/1295 3 739
tui 375/678 (55.3%) 14 678/678 0 0
smoke total 504/2153 (23.4%) 27 1411/2153 3 739

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 tests lists. The Native modules column counts modules served by the Rust addon. This is the agent+ai+tui smoke subset; the full baseline lives in committed conformance.json.

Attribution

A pi test file is rust-backed iff the module it primarily exercises — its module-under-test — is status=native in conformance/manifest.json. A package's rust-backed count is the passing cases in its rust-backed files. Transitive or infrastructure use does not count (e.g. ~30 ai files construct the native faux provider but test other things — only faux-provider.test.ts, whose subject is faux, counts). A file that substantially tests both a native and an original module is excluded rather than counted, so the number under-reports rather than over-claims.

Per-file decisions (from each native manifest row's tests list):

Native module Test file Decision
ai/api/anthropic-messages.ts test/anthropic-sse-parsing.test.ts counted
ai/providers/faux.ts test/faux-provider.test.ts counted
coding-agent/utils/ansi.ts test/ansi-utils.test.ts counted
coding-agent/utils/changelog.ts test/changelog.test.ts counted
coding-agent/utils/git.ts test/git-ssh-url.test.ts counted
coding-agent/core/tools/path-utils.ts test/path-utils.test.ts counted
tui/keys.ts test/keys.test.ts counted
tui/utils.ts test/truncate-to-width.test.ts, test/regression-regional-indicator-width.test.ts counted
coding-agent/utils/mime.ts test/image-process.test.ts mixed — excluded (2 of 3 cases test processImage/original)
coding-agent/utils/version-check.ts test/version-check.test.ts mixed — excluded (fetch cases mock the original; not separable per-file)
coding-agent/core/export-html/ansi-to-html.ts test/export-html-whitespace.test.ts mixed — excluded (asset-grep + tool-renderer/original dominate)
coding-agent/core/tools/truncate.ts no dedicated test (exercised via tools.test.ts, subject is the read/edit factory/original)
coding-agent/core/tools/edit-diff.ts no dedicated test (edit-tool tests' subject is the edit tool/original)

CLI conformance (black-box, against the pidgin binary)

  • CLI conformance: 15/15 pass against target/release/pidgin (pass delta ±0, fail delta ±0).
File Passing Failing Skipped
packages/coding-agent/test/session-file-invalid.test.ts 1 0 0
packages/coding-agent/test/session-id-readonly.test.ts 7 0 0
packages/coding-agent/test/startup-session-name.test.ts 2 0 0
packages/coding-agent/test/stdout-cleanliness.test.ts 5 0 0

The four repointed coding-agent CLI test files spawn the compiled pidgin binary via $PIDGIN_BIN instead of pi's own cli.ts. This is a separate signal from the module smoke table and is never folded into the per-package Native count.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants