Repository navigation
feat(vis): answer the expiredDomains marshall natively; default vis inspect --json runs without Node - #266
feat(vis): answer the expiredDomains marshall natively; default vis inspect --json runs without Node#266prisis wants to merge 2 commits into
Conversation
…fault `vis inspect --json` without Node The marshall takes the maintainer addresses of the inspected version (`_npmUser`, then `maintainers`), lower-cases the domain of each, and asks a resolver for its NS records. Records mean the domain is registered; "no such domain" and "no data" mean it lapsed, which is an error finding per address. The answer per domain is cached for 24 hours in the bytes Node writes. The query is the one Node's resolver sends to the first of its two servers (1.1.1.1): one NS question, recursion desired, no EDNS, over UDP. Node asks the second server only when the first does not answer in time; a clean answer of the first is final, and so is a SERVFAIL (a failed lookup). The answers read are the three Node's resolver classifies as registered or lapsed (NS records in the answer section, NXDOMAIN, NOERROR without an answer record); `__tests__/native/inspect-dns.test.ts` and `tests/fixtures/dns-scenarios.json` run every case against Node's own resolver (one and two stub servers) and against this reader. Anything else goes to Node before any output or write: no answer within two seconds, a truncated answer, SERVFAIL, REFUSED or another code, a CNAME or other record in the answer, a domain that is not a plain ASCII host name of two or more labels, a maintainer that is null, and a machine whose resolver settings rotate the servers (`RES_OPTIONS` set, or `rotate` in `/etc/resolv.conf`), where Node does not ask the first server first. With every marshall native, the launcher gate no longer looks at which ones a run executes: the default `vis inspect <package> --json`, `--only` lists and `MARSHALL_DISABLE_*` all pass it when the context is plain (CI, off a terminal, no proxy, CA or Node option), and the binary hands over what it cannot reproduce. 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
|
|
Thank you for following the naming conventions! 🙏 |
PR Summary by QodoRun default vis inspect JSON reports with native expiredDomains checks
AI Description
Merge Risk
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Code Review by Qodo
1. Blocked DNS slows every default inspect run
|
Merging this PR will not alter performance
Comparing Footnotes
|
What
expiredDomainsruns natively, and with it the defaultvis inspect <package> --json(no--only) runs without Node in a plain CI context. Stacked on #265 (signatures) → #264 (archivedRepo) → #262 (downloads); the default set does not needsignatures, but the branch builds on it because they edit the same gate and test setup. Merge in order; retarget each PR tonextas its base lands (GitHub does this only when merged branches are deleted).How the marshall works, and why it departs from the brief's route
The brief suggested
ToSocketAddrsor an existing resolver crate. Neither fits: Node does not use the system resolver for this marshall.new Resolver()withsetServers(["1.1.1.1", "8.8.8.8"])(c-ares) sends the NS query of the domain, as written, to 1.1.1.1 over UDP;/etc/hosts, search domains and the system's servers play no part, andgetaddrinfocannot ask for NS records at all. So the port sends the same query itself (a small hand-written DNS message reader/writer,std::net::UdpSocket, no new dependency).Behaviour (checked against Node's own resolver, not assumed):
Node asks the first server only; the second only when the first gives no answer in time (two-stub test in
inspect-dns.test.ts: lapsed/registered/SERVFAIL/silent combinations, 5 rounds each, the second server asked 0 times). Search domains do not apply: withLOCALDOMAIN=search.test RES_OPTIONS=ndots:5, Node still asks onlyexample.test(recorded in the test).RES_OPTIONS=rotatedoes make Node ask either server first, so native hands over whenRES_OPTIONSis set or/etc/resolv.confhas arotateoption.Extraction as Node does: the part after the last
@, JStrim, lower-cased;_npmUserthenmaintainers; one finding per (domain, address); one lookup per domain; cacheexpired-domains/<sha256(domain)[..12]>.json{createdAt,outcome,ttlMs}(anything that is notoutcome: "ok"reads as lapsed, as Node reads it). Hand-over: a non-ASCII domain, a domain that is not a plain host name of two or more labels (when a query would be needed), a null maintainer, amaintainersthat is not an array.Gate
With every marshall native,
bin/route.mjsno longer inspects which marshalls a run executes (INSPECT_NATIVE_MARSHALLS,inspectMarshallIsOffandisTruthyEnvare gone): the default set,--onlylists andMARSHALL_DISABLE_*pass when the context is plain (CI, off a terminal, no proxy/CA/Node option,network_environment_is_plain), and the binary hands over what it cannot reproduce.route.rsstill needs no change; the routing fixture rows are flipped tolauncher: nativeand the route snapshot gets the two new--onlyrows.Cost to know about
On a machine where UDP 53 or 1.1.1.1 is blocked, a run with an uncached domain now spends up to 2 seconds in the native wait before Node repeats everything (Node then waits its own 4 s per domain). Domains are cached for 24 hours when answered.
Proof
cargo test -p vis-cli,cargo fmt --all --check,cargo clippy -p vis-cli --all-targets -- -D warnings,cargo deny check: clean. Rust tests run every scenario oftests/fixtures/dns-scenarios.jsonagainst a UDP stub on 127.0.0.1 (including a stray answer with another id) and assert the wire bytes of the query.__tests__/native/inspect-dns.test.tsserves the same fixture to Node'sResolverand asserts the classification the fixture names (21 tests, including the two-server and search-domain cases).__tests__/native/inspect-parity.test.ts: native vs Node on the default set,--strict,expiredDomainsalone and the eight-marshall list, answered from the seeded caches of all services (no network), plus a version with seven maintainer shapes (same address twice, other address of the same domain, domain in capitals, name without address, string and number in place of an address,gus@), cached outcomesexpired/ok/missing/non-string, and the non-ASCII hand-over; identical stdout, exit status and cache files.--only:@visulima/path,lodash@4.17.21(its maintainer's domaindev.ofcr.seis lapsed: same error finding, exit 1) andtiny-invariant: identical stdout and exit status on both sides; native answered without a Node fallback.--only expiredDomainsonleft-pad,lodash,@types/node: identical stdout and identical domain cache files.stdUDP; a Linux runner whose resolver settings differ is covered by theRES_OPTIONS/rotatehand-over only).~/.t3/shared-targetis one path for every worktree; an integration test (tests/routing.rs) failed once when another build replaceddebug/vismid-run and passed on every rerun. The vitest suites use a private copy.🤖 Generated with Claude Code