Skip to content

feat(vis): answer inspect --json natively for the packument marshalls - #256

Merged
prisis merged 4 commits into
nextfrom
t3/port-inspect-native
Nov 25, 2026
Merged

prisis merged 4 commits into
nextfrom
t3/port-inspect-native

Conversation

@prisis

@prisis prisis commented Nov 25, 2026

Copy link
Copy Markdown
Member

What

vis inspect <package> --json is answered by the native binary when every marshall the run has to execute reads the registry's packument alone: author, provenance, s1ngularity, newBin, metadata. --only picks them; MARSHALL_DISABLE_* switches the others off.

A plain vis inspect <package> --json stays on Node, because the default set includes expiredDomains (DNS), archivedRepo and downloads (other services). The text report also stays on Node (a pail line with ✓/— and embedded colour). Native covers the JSON report of the packument marshalls only.

Native

  • Fetches the packument through the native HTTP client (registry from ~/.npmrc / workspace .npmrc), cuts it down and caches it in ~/.vis/cache/packuments byte for byte as the Node handler does (fresh entries are read, expired ones refetched).
  • Resolves no spec, latest, a dist-tag or an exact version; runs the five marshalls with the handler's messages (including toFixed rounding and Object.keys order quirks); prints the same JSON; exit 1 for an error (or any finding with --strict), exit 2 with a pail error line for a missing package or a spec without a version.
  • Module directory native/cli/src/inspect/; keys_refresh.rs only widens visibility of its Js value, URL and network-environment helpers (no move).

Handed to Node before anything is printed or written

text report, other flags / argument shapes, marshalls that ask services, ranges and unknown exact versions, registries with a credential or ${…} in .npmrc, proxy/CA/Node options, redirects, non-200/404 answers, non-JSON bodies, and packuments or field types JavaScript would read differently (non-strict semver, odd time forms, null where a lookup follows, names that collide with Object.prototype, URLs only the URL parser could judge).

Routing

bin/route.mjs gate, native/cli/src/route.rs row and the shared routing.json fixture (plus the route snapshot) agree.

Also

The first commit is the two-line import fix that next needs to compile at its tip (also in #252); drop it on merge order if that lands first.

Verification

  • cargo fmt --check, cargo clippy --all-targets, cargo test -p vis-cli (also with FORCE_COLOR=3 CI=1 GITHUB_ACTIONS=true TERM=xterm-256color): green. Rust unit tests use a local stub registry.
  • __tests__/native/inspect-parity.test.ts (98 cases, native vs Node, stdout/stderr/exit/cache bytes, declines print nothing and touch nothing; includes CI colour env), routing fixture/route/manifest/keys-refresh parity suites: green.
  • Manual run against the real registry (not committed): 20 packages incl. express, react, typescript, @babel/core — stdout, stderr, exit status and cache bytes identical; two declines as designed (a range-like exact version that is not published).
  • Not verified: Windows and Linux (macOS only; cross-compiling ring needs a C toolchain here). The native path is unix-only by design and the hand-offs are exercised by the parity suite.

Follow-up

downloads and archivedRepo are portable (HTTP + 24h caches) but left out; expiredDomains needs a DNS client and signatures an ECDSA verifier, so default vis inspect --json needs those first.

🤖 Generated with Claude Code

prisis and others added 2 commits November 25, 2026 13:03
`run/summary_json.rs` and `security_list/scan.rs` reached the JSON type through
`crate::sort_package_json::json`, a private re-import, so `vis-cli` did not
compile after the module split. Import `crate::json` directly.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`vis inspect <package> --json` now runs in the native binary when every
marshall it has to execute reads the registry's packument alone: author,
provenance, s1ngularity, newBin and metadata (`--only` picks them, and
`MARSHALL_DISABLE_*` switches the others off). The binary fetches the packument
through the native HTTP client, cuts it down and caches it in
`~/.vis/cache/packuments` byte for byte as the Node handler does, resolves a
tag or exact version, prints the same JSON report and ends with the same exit
status (1 for an error or, with `--strict`, any finding; 2 for a missing
package or a spec without a version).

Everything it cannot reproduce goes to Node before anything is printed or
written: the text report, every other flag, marshalls that ask other services
(expiredDomains, archivedRepo, downloads, signatures), a range spec, a
registry that needs a credential, a proxy or CA setting, a redirect or a
non-JSON answer, and packuments or field types that JavaScript would read
differently.

The launcher gate (`bin/route.mjs`), the binary's route table and the shared
routing fixture agree on the shapes, and a parity suite runs both sides
against a local registry stub.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo did not review this PR because this workspace reached its daily trial limit of 100 reviews. Reviews start again at 00:00 UTC. Choose a plan to continue now.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: acc36174-6776-46c4-8cfc-4a58a988b674

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@github-actions github-actions Bot added size:XXL Size of the change, tests and generated files excluded. vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list. labels Nov 25, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@prisis
prisis deployed to benchmarks November 25, 2026 12:32 — with GitHub Actions Active
@codspeed

codspeed Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

🆕 3 new benchmarks
⏩ 113 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 transform/transform_ts[470] N/A 355.3 µs N/A
🆕 transform/transform_ts[47000] N/A 16 ms N/A
🆕 transform/transform_ts[9400] N/A 3.3 ms N/A

Comparing t3/port-inspect-native (c7c3b78) with next (1078fa9)2

Open in CodSpeed

Footnotes

  1. 113 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on next (91e8f92) during the generation of this report, so 65c051d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

# Conflicts:
#	packages/tooling/vis/bin/route.mjs
#	packages/tooling/vis/native/cli/src/keys_refresh.rs
@prisis
prisis deployed to benchmarks November 25, 2026 13:28 — with GitHub Actions Active
@prisis
prisis merged commit b49d9f8 into next Nov 25, 2026
33 checks passed

This branch was successfully deployed

1 active deployment
benchmarks — c7c3b781 Deployed Nov 25, 2026 by prisis via Bench native (vis) #435
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vis size:XXL Size of the change, tests and generated files excluded. vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant