Repository navigation
Conversation
…vely `vis inspect <package> --json --only downloads` now runs without Node. The marshall reads the cached monthly count (`~/.vis/cache/downloads`, 24 hours) or asks the registry's download API once, flags a count under 20 as an error and one under 10000 as a warning, and caches a fresh count in the bytes Node writes. An answer without a count (404, any other status, a body with no numeric `downloads`) is the same "no monthly download data" warning and caches nothing. Everything the binary cannot read the way Node does goes to Node before any output or write: a request that fails before an answer, a redirect, a body that is not JSON, a count that is not a whole number, an entry that is not a count. The launcher gate accepts `downloads` in `--only` and in a run that disables the other service marshalls; a run that executes `archivedRepo`, `expiredDomains` or `signatures` still stays in Node. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the hand-overs Adds routing rows for `--only downloads,author` and for the default set with the other two service marshalls switched off, regenerates the route snapshot, covers a cached count Node reads through JavaScript coercion (a string, a fraction, a negative number) that the binary hands over, and makes the "nothing listens" unit test reach the transport failure instead of the address check. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
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
|
PR Summary by QodoRun inspect downloads checks natively with Node parity safeguards
AI Description
Merge Risk
|
|
Thank you for following the naming conventions! 🙏 |
Code Review by Qodo
View low (1) 1. Download cache failures are reported as packument failures
|
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes
|
What
vis inspect <package> --jsonruns thedownloadsmarshall natively. Base:next. This is the first of four stacked PRs: #262 (this:downloads) → #264 (archivedRepo) → #265 (signatures) → #266 (expiredDomains, which makes the defaultvis inspect --jsonnative). On its own it does not make the default set native:archivedRepoandexpiredDomainsstill run in Node.Behaviour
~/.vis/cache/downloads/<encodeURIComponent(name)>.json(24 hours). Without a fresh entry it askshttps://api.npmjs.org/downloads/point/last-month/<name>once, then writes{"createdAt","downloads","observedAt","ttlMs"}in the bytesJSON.stringifywrites. An expired entry is removed first, as Node does.Only N downloads in the past month.). A 404, any other status, or a body without a numericdownloads: one "npm stats API returned no monthly download data." warning, nothing cached.bin/route.mjs,INSPECT_NATIVE_MARSHALLS) acceptsdownloads.route.rsneeds no change (it only holds the command-level entry); the routing fixture rows andnative-routes.snapare updated.Handed to Node before any output or write
A request that fails before an answer (DNS, connect, TLS, timeout), a redirect, a body that is not JSON the binary reads (including a byte-order mark), a count that is not a whole number up to 2^53, a cache entry that is not a numeric count, a cache file that is not valid JSON or has no numeric
createdAt/ttlMs. Node reports a failed request as "no data" too, but whether a request fails depends on the machine, so the run stays Node's to repeat.No environment override for the API address: the base URL is a field of the run's
Context, set to the real address in production and to a loopback stub in the unit tests.Proof
cargo test -p vis-cli: unit tests against a loopback stub (every status class, the exact cache bytes, stale and fresh entries, hand-overs) and the existing routing/snapshot tests.cargo fmt --all --check,cargo clippy -p vis-cli --all-targets -- -D warnings,cargo deny checkclean; no dependency added.__tests__/native/inspect-parity.test.ts(native vs Node, binary level): seeded fresh cache entries from 0 to 3,000,000 including a scoped name, the exit status, and hand-overs of entries Node reads through JavaScript coercion ("7",5.5,-1; exit 70 on the declined run, nothing touched).fetchreplaced and asserts the findings, exit status and cache bytes for each API answer; the Rust unit tests assert the same text, so the two sides are pinned to the same bytes.left-padand@types/node: identical stdout and identical cache bytes (apart from the clock), native run without a Node fallback.🤖 Generated with Claude Code