Skip to content

feat(vis): answer vis graph natively (ascii, dot, json) - #260

Open
prisis wants to merge 3 commits into
nextfrom
t3/native-graph
Open

prisis wants to merge 3 commits into
nextfrom
t3/native-graph

Conversation

@prisis

@prisis prisis commented Nov 25, 2026

Copy link
Copy Markdown
Member

What

vis graph now runs in the native binary for the ASCII tree, DOT and JSON formats (--format/-f, --depth/-d), in a CI run off a terminal. Output is byte for byte what the Node handler writes, including colour codes where the colour detection turns them on.

Why it was thought to be blocked, and is not

graph needs the project dependency graph, not the task graph. native/cli/src/graph.rs already builds that for list, affected and sbom, so no foundation change was needed. The only addition to it is ProjectGraph::order, the project names in discovery order, which is the order Node emits nodes and edges in (the BTreeMap alone loses it).

What stays Node

Each of these is decided before anything is printed (a declined run exits 70 in the parity tests):

  • --format html (browser viewer bundle) and --output (file write plus a log line)
  • the interactive viewer: stdout is never a terminal on the native path, so tui and the default are the ASCII tree, as in Node's non-terminal fallback; a terminal run is Node's
  • an unknown format name, any other flag, extra positionals, a repeated flag, a non-integer or negative --depth
  • every workspace the native graph declines (a vis.config.*, project.json, per-package overlays, non-JS projects, non-pnpm roots)
  • project names that are not ASCII or that JavaScript would reorder (all-digit names, __proto__), a project at the workspace root
  • a document larger than 64 KiB on a pipe (Node cuts those short)
  • colour flags, a FORCE_COLOR + NO_COLOR conflict, Windows

Routing

bin/route.mjs (NATIVE_SHAPE_GATES), route.rs, routing.json and the route snapshot are updated together.

Tests

  • __tests__/native/graph-parity.test.ts: 258 cases over 9 fixtures against the Node CLI (formats, depth, delegated shapes, outside CI, colour environments, multi-pattern discovery order, a run from a project directory with a stale inherited root).
  • Unit tests in graph_view.rs; cargo fmt --all --check, cargo clippy --all-targets -- -D warnings, cargo test -p vis-cli clean; affected, sbom, project-graph, workspace-membership, routing-fixture, route and list suites still pass.
  • Run with FORCE_COLOR=3 CI=1 GITHUB_ACTIONS=true TERM=xterm-256color.
  • The new fixtures are excluded from the root pnpm workspace (pnpm-workspace.yaml), as the other native fixtures are.

Unverified locally: Linux (non-UTF-8 paths are declined by the root check; discovery order is an explicit sort by name, not directory-read order).

Base: next.

🤖 Generated with Claude Code

prisis and others added 2 commits November 26, 2026 00:36
…rmats

`vis graph` only needs the project dependency graph, which the native
binary already builds for `list`, `affected` and `sbom`; no task graph is
involved. The ASCII tree, DOT and JSON outputs are now written by the
binary in a CI run off a terminal, byte for byte as the Node handler
writes them, including the colour codes where the colour detection turns
them on.

The binary hands the invocation to Node before printing anything for:
`--format html` and `--output`, the interactive viewer, an unknown format
name, a flag it does not read, a workspace the native graph declines (a
config file, `project.json`, overlays, non-JS projects), project names
that are not ASCII or that JavaScript would reorder (array indices), and
an output Node would cut short on a pipe.

`ProjectGraph` now keeps the project names in discovery order, which is
the order Node emits nodes and edges in.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds a workspace with several patterns listed out of alphabetical order
and mixed-case directories, a workspace Node resolves with patterns the
binary declines, and a run from inside a project with an inherited root
that names another workspace.

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: 37e74b1d-fbb1-43c2-b180-ed2d844bc89b

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

@prisis
prisis deployed to benchmarks November 25, 2026 23:45 — with GitHub Actions Active
@github-actions github-actions Bot added the size:XL Size of the change, tests and generated files excluded. label 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
@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-graph (8c8b3d9) 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. ↩

Splits the option scan into small helpers and sorts the gate map.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@prisis
prisis deployed to benchmarks November 25, 2026 23:56 — with GitHub Actions Active

This branch was successfully deployed

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

Labels

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