Skip to content

FE-2425: Show the severity of code diagnostics in the Diagnostics tab - #10707

Open
kube wants to merge 2 commits into
mainfrom
cf/fe-2425-diagnostics-tab-severity
Open

kube wants to merge 2 commits into
mainfrom
cf/fe-2425-diagnostics-tab-severity

Conversation

@kube

@kube kube commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Before this PR, the Diagnostics tab listed every code diagnostic as an error. A note or a warning from the code checker got a red row, and its entity's heading counted it as an error. The bottom bar counted notes as issues. A net with only notes read as broken, although it runs.

Each row now takes the colour of its severity, and a heading counts errors, warnings and notes apart. A heading's count is red only when its entity has an error. The bottom bar counts errors and warnings, so a net with only notes shows the green check.

Before

Diagnostics tab with a warning and a note listed in red under a count of 2 errors

After

Diagnostics tab with the warning in amber and the note in grey under a count of 1 warning, 1 note

Links

Changes

  • Rows take the colour of their severity

    An error is red, a warning amber, a note grey. A hint is listed as a note.

  • Headings count errors, warnings and notes apart

    1 error, 2 notes replaces 3 errors.
    The count is red only when it holds an error.

  • Bottom bar indicator counts errors and warnings

    A note on the code is left out of the count, as a note on the composition is.
    Red needs an error that stops a run, so a visualizer's error counts in amber.

  • Code diagnostics and composition problems share one count helper

    describeSeverityCounts words both headings.

  • Error rows take the design-system red

    Colour comes from data-severity through problemTextStyle, which the Composition group already uses.

  • severityOfDiagnostic sits in the editor's shared folder

    Bottom bar and Diagnostics tab are separate layers, and both read it.

Test coverage

  • diagnostic-severity.test.ts:

    Severity of a diagnostic, with a hint read as a note and a missing severity as an error.

  • group-diagnostics.test.ts:

    Counts per severity for an entity.

  • diagnostics-indicator.test.tsx:

    Notes alone leave the indicator valid with no count, and a warning among notes counts once.
    An error that stops no run counts in amber.

  • severity-counts.test.ts:

    Counting a list of severities, and the wording of a heading.

  • Manual run on the demo site:

    A net with ten notes and three errors lists ten grey rows and three red rows, under headings that count them apart.

  • Local build with seeded nets:

    Bottom bar shows the green check for a net with one note, an amber count once a warning joins it, and a red count once an error does.

How to test

  • Open Petrinaut preview on Vercel
  • Menu > Load example > Probabilistic Satellite Launcher
  • Select transition LaunchSatellite
  • Add const spare = 1; as first line of Transition Results code
  • Open Diagnostics tab

    Expect heading LaunchSatellite (1 note) and one grey row
    Expect green check in bottom bar, no count

  • Change the line to const spare = Math.random();

    Expect 1 warning, 1 note, one amber row and one grey row
    Expect amber 1 in bottom bar

  • Change the line to const spare = missing;

    Expect 1 error in red and one red row
    Expect red 1 in bottom bar

The tab listed every code diagnostic as a red error, so a note such as a
distribution shared between output attributes read as a problem that blocks
a run. Each row now takes the colour of its severity, and an entity's
heading counts its errors, warnings and notes apart. A hint is listed as a
note.

Code and Composition groups share one helper for the count text, which
replaces `count-of.ts`.
@kube kube self-assigned this Dec 3, 2026
@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
hash Ready Ready Preview Dec 3, 2026 10:15pm UTC
petrinaut Ready Ready Preview Dec 3, 2026 10:15pm UTC
petrinaut-docs Ready Ready Preview Dec 3, 2026 10:15pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Dec 3, 2026 10:15pm UTC

Request Review

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team labels Dec 3, 2026
@kube
kube added this pull request to stack #10709 December 3, 2026 18:55
The diagnostics indicator counted every code diagnostic, so a net whose
only diagnostics were notes showed the warning state. It now counts the
errors and warnings of code and composition, and keeps the red state for
errors that stop a run.

The severity of a code diagnostic moves to the editor's shared folder,
where the bottom bar and the Diagnostics tab both read it.
@cursor

cursor Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
UI and counting logic for diagnostics only; no simulation or auth changes, with solid unit test coverage.

Overview
Code diagnostics in the Diagnostics tab no longer appear as errors by default. Each row is colored by real severity (red / amber / grey) via severityOfDiagnostic and problemTextStyle, and entity headings use describeSeverityCounts (e.g. 1 error, 2 notes) instead of a single error total.

The bottom bar issue count includes errors and warnings only—notes are omitted so nets with only informational diagnostics show the green check. Red status still reflects blocking errors; non-blocking code errors (such as visualizer errors) count toward the number but keep an amber indicator.

Shared severity-counts helpers unify grouping (groupDiagnosticsByEntity now tracks per-severity counts) and composition diagnostics. User-facing docs describe three severities and the updated toolbar behavior.

Reviewed by Cursor Bugbot for commit 966d5c0. Bugbot is set up for automated code reviews on this repo. Configure here.

@veria-ai

veria-ai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No actionable issues were found in the reviewed changes.

No open issues 🎉

What changed in this PR

Updates Petrinaut’s diagnostics display to distinguish errors, warnings, and notes without presenting note-only nets as broken.

Changes:

  • Applies severity-specific row colours and separate heading counts.
  • Excludes notes from the bottom-bar count while preserving blocking-error status.
  • Adds shared helpers, regression tests, documentation, and a patch changeset.
File Description
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​shared/​diagnostic-severity.ts Normalizes diagnostic severity.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​shared/​diagnostic-severity.test.ts Tests severity mapping and defaults.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​panels/​BottomPanel/​subviews/​diagnostics/​styles.ts Removes fixed red row styling.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​panels/​BottomPanel/​subviews/​diagnostics/​severity-counts.ts Shares severity counting and labels.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​panels/​BottomPanel/​subviews/​diagnostics/​severity-counts.test.ts Tests counts and heading wording.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​panels/​BottomPanel/​subviews/​diagnostics/​group-diagnostics.ts Counts each entity’s diagnostics by severity.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​panels/​BottomPanel/​subviews/​diagnostics/​group-diagnostics.test.ts Tests mixed-severity entity counts.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​panels/​BottomPanel/​subviews/​diagnostics/​count-of.ts Removes the standalone pluralization helper.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​panels/​BottomPanel/​subviews/​diagnostics/​composition-diagnostics.tsx Uses shared severity-count helpers.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​panels/​BottomPanel/​subviews/​diagnostics.tsx Renders severity-aware rows and headings.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​components/​BottomBar/​diagnostics-indicator.tsx Excludes notes from issue counts.
libs/​@hashintel/​petrinaut/​src/​ui/​views/​Editor/​components/​BottomBar/​diagnostics-indicator.test.tsx Tests counts, status, and animation continuity.
libs/​@hashintel/​petrinaut/​docs/​petri-net-extensions.md Documents severity and indicator behavior.
.changeset/​diagnostics-tab-severity.md Records the patch release change.

Review effort: Balanced

This branch was successfully deployed

3 active deployments
Preview – hash — 966d5c0a Deployed Dec 3, 2026 by vercel[bot]
Preview – petrinaut-docs — 966d5c0a Deployed Dec 3, 2026 by vercel[bot]
Preview – petrinaut — 966d5c0a Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants