Repository navigation
feat(vis): answer inspect --json natively for the packument marshalls - #256
Conversation
`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 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. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Thank you for following the naming conventions! 🙏 |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes
|
# Conflicts: # packages/tooling/vis/bin/route.mjs # packages/tooling/vis/native/cli/src/keys_refresh.rs
What
vis inspect <package> --jsonis answered by the native binary when every marshall the run has to execute reads the registry's packument alone:author,provenance,s1ngularity,newBin,metadata.--onlypicks them;MARSHALL_DISABLE_*switches the others off.A plain
vis inspect <package> --jsonstays on Node, because the default set includesexpiredDomains(DNS),archivedRepoanddownloads(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
~/.npmrc/ workspace.npmrc), cuts it down and caches it in~/.vis/cache/packumentsbyte for byte as the Node handler does (fresh entries are read, expired ones refetched).latest, a dist-tag or an exact version; runs the five marshalls with the handler's messages (includingtoFixedrounding andObject.keysorder 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.native/cli/src/inspect/;keys_refresh.rsonly widens visibility of itsJsvalue, 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,nullwhere a lookup follows, names that collide withObject.prototype, URLs only the URL parser could judge).Routing
bin/route.mjsgate,native/cli/src/route.rsrow and the sharedrouting.jsonfixture (plus the route snapshot) agree.Also
The first commit is the two-line import fix that
nextneeds 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 withFORCE_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.@babel/core— stdout, stderr, exit status and cache bytes identical; two declines as designed (a range-like exact version that is not published).ringneeds a C toolchain here). The native path is unix-only by design and the hand-offs are exercised by the parity suite.Follow-up
downloadsandarchivedRepoare portable (HTTP + 24h caches) but left out;expiredDomainsneeds a DNS client andsignaturesan ECDSA verifier, so defaultvis inspect --jsonneeds those first.🤖 Generated with Claude Code