Skip to content

feat(vis): answer dlx natively when its first-run gate has nothing to show - #259

Open
prisis wants to merge 1 commit into
nextfrom
t3/native-dlx-panel
Open

prisis wants to merge 1 commit into
nextfrom
t3/native-dlx-panel

Conversation

@prisis

@prisis prisis commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Problem

vis dlx <package> started Node unless the first-run gate was switched off with --no-info. The gate skips itself in CI, off a terminal and with --yes (no network work), so most real runs paid a Node start for nothing.

Change

The native dlx now decides the gate like src/dlx/first-run.ts:

Run Result
--yes, truthy VIS_DLX_YES, CI, stdin or stdout not a terminal native (gate does nothing)
terminal, no CI, no --yes, version already in ~/.vis/state/dlx-seen.json, no VIS_SOCKET_TOKEN native: the packument is resolved with the shared HTTP client and Node's packument cache (inspect::Packuments, new, wraps the existing inspect fetch/cache/view code)
version not approved yet (panel + prompt), Socket token, --offline, range spec, --info, non-ASCII VIS_DLX_* value Node, before any output

All reasons to delegate are decided before the manager starts, and the registry cache is written only after every package is known to be approved, so a hand-off writes nothing. bin/route.mjs, routing.json, the route snapshot and route.test.ts are updated together.

What stays in Node (honest slice)

The panel itself (size, Socket score, changelog fetched from other services, colours, y/N prompt) is not ported: it needs the changelog sources and Node's colour/width libraries to match byte for byte. --info and every first-run (unapproved) terminal run stay in Node. The approved-version lookup skips Node's concurrent changelog fetch, so Node's changelog cache is not filled by native runs (no output difference).

Verification

  • cargo fmt --all --check, cargo clippy --all-targets -- -D warnings, cargo test -p vis-cli: green (new unit tests: gate decision table, seen-state shapes, approved-version lookup against a loopback registry stub).
  • __tests__/native/info-dlx-parity.test.ts (714 cases, new fast-path cases incl. --yes, VIS_DLX_YES, outside CI), route.test.ts, routing-fixture.test.ts: green with FORCE_COLOR=3 CI=1 GITHUB_ACTIONS=true TERM=xterm-256color.
  • Terminal path checked by hand under a real pty with a stub registry: approved version runs natively, an unapproved one hands off, the second run is served from the packument cache.
  • Unverified locally: Linux (non-UTF-8 HOME and argv decline to Node by construction; case-sensitive FS not exercised), and a terminal run in CI needs no pty (the CI branch never reads the terminal).

Cost note: a terminal run of a version that is not approved yet fetches the packument, hands over, and Node fetches it again (nothing is written by the native attempt). That happens once per package version.

Checked against the real registry: under a pty, an unapproved zod is handed over with its reason and Node then shows its panel; with the version recorded in dlx-seen.json, native and Node print the same (pnpm dlx zod hi) and leave the same cache files.

🤖 Generated with Claude Code

… show

The native dlx only ran when the first-run gate was switched off, so a plain
`vis dlx <package>` started Node even in CI, where the gate skips itself
without any network work.

The binary now decides the gate the way the Node handler does:

- `--yes`, a truthy `VIS_DLX_YES`, CI, or a stdin or stdout that is not a
  terminal: the gate does nothing, the package manager runs natively.
- a terminal outside CI without `--yes`: the gate resolves each package
  against the registry and looks the version up in
  `~/.vis/state/dlx-seen.json`. An approved version with no Socket token
  makes the gate silent, so it runs natively. The packument is read
  through the shared registry client and cache (`inspect::Packuments`).
- a version that is not approved yet (the panel and the prompt), a Socket
  token, `--offline`, a range spec, `--info`, or a value of a gate variable
  that is not ASCII are handed to Node before any output.

The registry cache is written only after every package is known to be
approved, so a hand-off writes nothing.

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: 02e6a37a-58df-4bde-bfb3-12762518bc54

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 github-actions Bot added size:L Size of the change, tests and generated files excluded. and removed size:L Size of the change, tests and generated files excluded. labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@github-actions github-actions Bot added package: vis vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list. labels Nov 25, 2026
@prisis
prisis deployed to benchmarks November 25, 2026 23:45 — 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/native-dlx-panel (404901f) 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 (c8c3ce2) 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. ↩

This branch was successfully deployed

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

Labels

package: vis 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