Skip to content

Mask non-deterministic chart data in visual (Argos) tests - #126

Draft
jon-bell wants to merge 2 commits into
mainfrom
cursor-visual-test-mask-charts-92e4
Draft

Mask non-deterministic chart data in visual (Argos) tests#126
jon-bell wants to merge 2 commits into
mainfrom
cursor-visual-test-mask-charts-92e4

Conversation

@jon-bell

@jon-bell jon-bell commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Problem

The visual regression suite (Argos) runs against the real NDIF service and is flaky. Real model runs are only approximately reproducible: floating-point results drift run-to-run across NDIF hardware, so even for a fixed prompt the heatmap cell colors and plotted line curves shift by a few pixels. Argos flags this noise as a diff even though the UI is correct.

We want to keep exercising the real NDIF request/response path, but stop comparing the noisy pixels.

Approach

Add a NEXT_PUBLIC_VISUAL_TEST flag. When set, we neutralize just the non-deterministic values right before they reach the nnsightful widgets — the network path, polling, and widget wiring are all still exercised:

  • Logit-lens heatmap (Lens2Display): blank every cell's top-k except the final prediction — the last token of the last layer (which the widget already treats as the final-prediction cell). The predicted token text there stays real; tracked/entropy are flattened so that cell's color and the per-layer skyline are stable. Fresh workspaces show no trajectory line-plot by default, so only the (masked) heatmap is captured.
  • Activation-patching line plot (ActivationPatchingDisplay): flatten the plotted series (lines/ranks/prob_diffs) so the drawn curves are constant and ignored. The chart chrome (axes, mode bar, token selector, layer count, labels) still renders.

The masking is centralized in src/lib/visualTest.ts and gated by isVisualTestMode(), memoized so the widgets don't rebuild every render. Outside visual-test mode there is zero behavior change.

Enabling it

NEXT_PUBLIC_VISUAL_TEST is a build-time-inlined public env var, so it's added to .env in the e2e workflow before next build.

Files

  • workbench/_web/src/lib/visualTest.ts — flag + maskLogitLensDataForVisualTest / maskActivationPatchingDataForVisualTest.
  • workbench/_web/.../lens2/[chartId]/components/Lens2Display.tsx — apply mask to widget data.
  • workbench/_web/.../activation-patching/[chartId]/components/ActivationPatchingDisplay.tsx — apply mask to widget data.
  • .github/workflows/e2e.yml — set NEXT_PUBLIC_VISUAL_TEST=true.

Verification

  • bunx tsc --noEmit: no new errors from these changes (the one remaining error on the AP widget data prop is pre-existing — verified against the base commit — and silenced by ignoreBuildErrors).
  • bun run lint: no new lint errors in the changed files.

Note: baselines will need to be re-approved once in Argos, since the rendered snapshots change (that's the intended, now-deterministic output).

Open in Web Open in Cursor 

Visual regression snapshots run against real NDIF, whose float outputs
drift run-to-run and cause pixel noise in heatmap cell colors and plotted
line curves. Add a NEXT_PUBLIC_VISUAL_TEST flag that, when set, neutralizes
just the noisy values before they reach the nnsightful widgets:

- Logit-lens heatmap: blank every cell except the final prediction (last
  token of the last layer) and flatten tracked/entropy so the remaining
  cell color and layer skyline are stable.
- Activation-patching line plot: flatten the plotted series so the drawn
  lines are constant; axes, mode bar and token selector still render.

The real NDIF request/response path is unchanged; only rendering is
masked. The flag is enabled in the e2e workflow before the build.

Co-authored-by: Jonathan Bell <jon@jonbell.net>
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workbench Ready Ready Preview, Comment Jul 3, 2026 12:15am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

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

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 27e9a46f-3bb1-4e1b-8e8c-8f35e9791fa5

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor-visual-test-mask-charts-92e4

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

Comment @coderabbitai help to get the list of available commands.

@argos-ci

argos-ci Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 5 changed Jul 3, 2026, 12:21 AM

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview deployed

Co-authored-by: Jonathan Bell <jon@jonbell.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants