Skip to content

StatusValue: Add 'status-value:<new|modified|affected>'#34305

Merged
valentinpalkovic merged 9 commits into
nextfrom
valentin/statusvalue-extension-change-detection
Mar 25, 2026
Merged

StatusValue: Add 'status-value:<new|modified|affected>'#34305
valentinpalkovic merged 9 commits into
nextfrom
valentin/statusvalue-extension-change-detection

Conversation

@valentinpalkovic
Copy link
Copy Markdown
Contributor

@valentinpalkovic valentinpalkovic commented Mar 24, 2026

Closes #34292

What I did

Added two new StatusValue variants: status-value:new, status-value:modified and status-value:affected. These are intended for use in agentic UI review workflows to surface which stories are new or have changed content.

Changes include:

  • Extended the StatusValue union type (status-store/index.ts) with status-value:new and status-value:modified
  • Added SVG icon symbols (AddIcon for new, EditIcon for modified) to the sidebar IconSymbols
  • Configured colors: new uses theme.color.positive (green), modified uses theme.color.secondary (purple)
  • Inserted the new values into the status priority order between success and warning
  • Updated the vitest addon's statusValueToStoryIds map to include the new values
  • Added unit tests covering new status ranking and group aggregation behavior

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Not testable yet. This needs further integration.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that do not fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • New Features

    • Added three new status types — New, Modified, Affected — with distinct icons and integrated into status ranking, sidebar, and tree views.
    • Added several sidebar stories demonstrating the new statuses and mixed/prioritized scenarios.
  • Tests

    • Added unit tests for new status precedence and group aggregation; updated e2e expectations to reflect the label change.
  • Chores

    • Updated UI label text from "Test status" to "Status".

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Mar 24, 2026

View your CI Pipeline Execution ↗ for commit 0b1442a

Command Status Duration Result
nx run-many -t compile,check,knip,test,lint,fmt... ❌ Failed 8m 24s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-25 13:23:59 UTC

@valentinpalkovic valentinpalkovic changed the title StatusValue: Add 'status-value:new' and 'status-value:modified' variants with changeDetection feature flag StatusValue: Add 'status-value:new' and 'status-value:modified' Mar 24, 2026
@valentinpalkovic valentinpalkovic self-assigned this Mar 24, 2026
@valentinpalkovic valentinpalkovic marked this pull request as ready for review March 25, 2026 08:40
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 25, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 26709491-f75b-44e5-9e29-7ef3e36ec681

📥 Commits

Reviewing files that changed from the base of the PR and between 49b23fd and 0b1442a.

📒 Files selected for processing (1)
  • code/core/src/manager/utils/status.test.ts

📝 Walkthrough

Walkthrough

Adds three status values—status-value:new, status-value:modified, status-value:affected—across core types, priority ordering, icon/color mappings, sidebar aggregation/display, vitest addon typing, stories, and tests; updates aria-label text from "Test status:" to "Status:".

Changes

Cohort / File(s) Summary
Type definitions & vitest mapping
code/core/src/shared/status-store/index.ts, code/addons/vitest/src/use-test-provider-state.ts
Expanded StatusValue union with `new
Status priority & status→UI mapping
code/core/src/manager/utils/status.tsx
Inserted the three new status-values into statusPriority (between success and warning) and added icon mappings via UseSymbol (colors left null for these).
Sidebar aggregation & context
code/core/src/manager/components/sidebar/StatusContext.tsx, code/core/src/manager/components/sidebar/StatusButton.tsx
Initialized counts/containers for new statuses in useStatusSummary, expanded aggregation gate to include them, and mapped them to theme.fgColor.accent in status-color logic.
Icons & symbol component
code/core/src/manager/components/sidebar/IconSymbols.tsx
Added three SVG symbol definitions and extended UseSymbol prop union to accept `'new'
Tree display & aria-label changes
code/core/src/manager/components/sidebar/Tree.tsx
Added entries to StatusIconMap for new statuses, changed branch-status visibility to include them, switched icon rendering for those statuses to getStatus(...), and updated aria-label text from "Test status:" to "Status:".
Stories & unit tests
code/core/src/manager/components/sidebar/Sidebar.stories.tsx, code/core/src/manager/utils/status.test.ts
Added five sidebar stories demonstrating new statuses/priority and expanded unit tests to assert new status precedence and group aggregation propagation.
E2E tests (playwright) updates
test-storybooks/.../e2e-tests/component-testing.spec.ts (react & react-vitest variants)
Updated assertions and selectors to expect "Status: ..." aria-label text instead of "Test status: ...".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
code/core/src/manager/components/sidebar/StatusContext.tsx (1)

53-55: ⚠️ Potential issue | 🟠 Major

Include change-detection statuses in summary gating.

useStatusSummary now defines new/modified/affected buckets, but this gate still excludes those group statuses, so their summaries won’t populate.

🧩 Proposed fix
-    ['status-value:pending', 'status-value:warning', 'status-value:error'].includes(
+    [
+      'status-value:pending',
+      'status-value:new',
+      'status-value:modified',
+      'status-value:affected',
+      'status-value:warning',
+      'status-value:error',
+    ].includes(
       groupStatus[item.id]
     )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@code/core/src/manager/components/sidebar/StatusContext.tsx` around lines 53 -
55, The gating check in StatusContext.tsx excludes change-detection statuses so
summaries from useStatusSummary's new/modified/affected buckets never populate;
update the conditional that checks groupStatus[item.id] (currently testing
['status-value:pending','status-value:warning','status-value:error']) to also
include the change-detection statuses (e.g. 'status-value:new',
'status-value:modified', 'status-value:affected') or replace the literal list
with a helper that derives allowed summary statuses from useStatusSummary so
those buckets are considered when deciding whether to render population.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@code/addons/vitest/src/use-test-provider-state.ts`:
- Around line 23-29: The current narrowing to TestStatusValue and casting (e.g.,
using status.value as TestStatusValue to index StatusValueToStoryIds) can crash
if new StatusValue variants appear; update the code to avoid unsafe casts by
making the mapping creation and access exhaustive or guarded: initialize
StatusValueToStoryIds with all possible StatusValue keys (or use a Map keyed by
StatusValue) and replace direct casts like status.value as TestStatusValue with
a safe check/lookup (e.g., verify the key exists or use a default bucket) before
calling .push; adjust functions that reference TestStatusValue and
StatusValueToStoryIds so they either compute keys from StatusValue without
casting or handle unknown values explicitly.

In `@code/core/src/manager/components/sidebar/StatusButton.tsx`:
- Around line 21-23: The three status color entries in the StatusButton
component are all set to theme.fgColor.accent, losing semantic distinction;
update the mapping in StatusButton (the 'status-value:new',
'status-value:modified', 'status-value:affected' entries) to use distinct
semantic theme colors (e.g. map 'status-value:new' to theme.fgColor.success,
'status-value:modified' to theme.fgColor.warning, and 'status-value:affected' to
theme.fgColor.danger or the equivalent names used in your theme) so each status
retains its unique color in the status rendering.

In `@code/core/src/manager/utils/status.tsx`:
- Around line 32-34: The statusPriority array currently places
'status-value:new' after 'status-value:affected'; update the ordering in the
statusPriority constant so it follows the intended precedence success < new <
modified < affected < warning by placing 'status-value:new' immediately after
'status-value:success', then 'status-value:modified', then
'status-value:affected', and keeping 'status-value:warning' last; modify the
statusPriority definition (and any references to it) accordingly to ensure
change-detection statuses rank as: 'status-value:success', 'status-value:new',
'status-value:modified', 'status-value:affected', 'status-value:warning'.

In `@code/core/src/types/modules/core-common.ts`:
- Around line 539-544: The JSDoc for the optional flag changeDetection claims
"@default true" but the features preset does not set it, causing an effective
default of false; to fix, update the features PresetProperty<'features'> export
(the features variable in the common preset) to include changeDetection: true so
runtime matches the documented default, and verify the changeDetection?: boolean
JSDoc remains accurate.

---

Outside diff comments:
In `@code/core/src/manager/components/sidebar/StatusContext.tsx`:
- Around line 53-55: The gating check in StatusContext.tsx excludes
change-detection statuses so summaries from useStatusSummary's
new/modified/affected buckets never populate; update the conditional that checks
groupStatus[item.id] (currently testing
['status-value:pending','status-value:warning','status-value:error']) to also
include the change-detection statuses (e.g. 'status-value:new',
'status-value:modified', 'status-value:affected') or replace the literal list
with a helper that derives allowed summary statuses from useStatusSummary so
those buckets are considered when deciding whether to render population.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 57b7d38b-0b5e-4e77-9705-f52018a2f0aa

📥 Commits

Reviewing files that changed from the base of the PR and between 09a3460 and 40a470e.

📒 Files selected for processing (8)
  • code/addons/vitest/src/use-test-provider-state.ts
  • code/core/src/manager/components/sidebar/IconSymbols.tsx
  • code/core/src/manager/components/sidebar/StatusButton.tsx
  • code/core/src/manager/components/sidebar/StatusContext.tsx
  • code/core/src/manager/utils/status.test.ts
  • code/core/src/manager/utils/status.tsx
  • code/core/src/shared/status-store/index.ts
  • code/core/src/types/modules/core-common.ts

Comment thread code/addons/vitest/src/use-test-provider-state.ts
Comment thread code/core/src/manager/components/sidebar/StatusButton.tsx
Comment thread code/core/src/manager/utils/status.tsx Outdated
Comment thread code/core/src/types/modules/core-common.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
code/core/src/manager/utils/status.tsx (1)

28-37: ⚠️ Potential issue | 🟠 Major

Fix statusPriority order for change-detection statuses.

The current order places affected before modified before new, but since getMostCriticalStatusValue returns the last matching value in the array, the current order makes new outrank affected. Per the linked issue #34292, the intended priority is success < new < modified < affected < warning.

🔁 Proposed fix
 export const statusPriority: StatusValue[] = [
   'status-value:unknown',
   'status-value:pending',
   'status-value:success',
-  'status-value:affected',
-  'status-value:modified',
   'status-value:new',
+  'status-value:modified',
+  'status-value:affected',
   'status-value:warning',
   'status-value:error',
 ];
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@code/core/src/manager/utils/status.tsx` around lines 28 - 37, The
statusPriority array currently orders change-detection statuses so that
getMostCriticalStatusValue (which returns the last matching value) incorrectly
gives 'new' higher priority than 'affected'; update the statusPriority constant
so the sequence reflects the intended priority (success < new < modified <
affected < warning) by reordering the entries for 'status-value:new',
'status-value:modified', and 'status-value:affected' accordingly in the exported
statusPriority array.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@code/core/src/manager/utils/status.tsx`:
- Around line 28-37: The statusPriority array currently orders change-detection
statuses so that getMostCriticalStatusValue (which returns the last matching
value) incorrectly gives 'new' higher priority than 'affected'; update the
statusPriority constant so the sequence reflects the intended priority (success
< new < modified < affected < warning) by reordering the entries for
'status-value:new', 'status-value:modified', and 'status-value:affected'
accordingly in the exported statusPriority array.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 702064f6-301c-431a-806b-5c49925cb785

📥 Commits

Reviewing files that changed from the base of the PR and between 40a470e and 5f25956.

📒 Files selected for processing (7)
  • code/core/src/manager/components/sidebar/IconSymbols.tsx
  • code/core/src/manager/components/sidebar/Sidebar.stories.tsx
  • code/core/src/manager/components/sidebar/StatusContext.tsx
  • code/core/src/manager/components/sidebar/Tree.tsx
  • code/core/src/manager/utils/status.tsx
  • test-storybooks/portable-stories-kitchen-sink/react-vitest-3/e2e-tests/component-testing.spec.ts
  • test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts

Comment thread code/core/src/manager/components/sidebar/IconSymbols.tsx
);
});

it('should rank affected above modified and below warning', () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't seem right.

@valentinpalkovic valentinpalkovic merged commit 3f91f48 into next Mar 25, 2026
10 of 13 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/statusvalue-extension-change-detection branch March 25, 2026 13:14
@valentinpalkovic valentinpalkovic changed the title StatusValue: Add 'status-value:new' and 'status-value:modified' StatusValue: Add 'status-value:<new|modified|affected>' Mar 25, 2026
@github-actions github-actions Bot mentioned this pull request Mar 25, 2026
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Review Changes]: T3a - StatusValue extension + shared type infrastructure

2 participants