Skip to content

test(desktop): story-cover the change panel's failure and edge states - #4169

Open
liuxiaocs7 wants to merge 1 commit into
apache:mainfrom
liuxiaocs7:liuxiaocs7/diff-viewer-failure-states
Open

test(desktop): story-cover the change panel's failure and edge states#4169
liuxiaocs7 wants to merge 1 commit into
apache:mainfrom
liuxiaocs7:liuxiaocs7/diff-viewer-failure-states

Conversation

@liuxiaocs7

Copy link
Copy Markdown
Member

Summary

Fourth surface under #3944 (one surface per PR): extend the 变更 (Changes) panelSessionReviewPanel, reached through Product/Session Workbar — with the failure and edge states that never show up in normal use, so the Storybook gate and the #3893 a11y audit have real targets. All five drive the real panel through the fake review service; no fabricated UI.

  • ChangesEmpty — branch matches base: the panel's own EmptyState, not a spinner and not an error.
  • ChangesLoadFailedreview.read rejects: an error Banner with 重试, the same shape as TasksLoadFailed.
  • ChangesSourceNotGit — a source that cannot be read (not a git repo) is a failure Banner, not an absence; the other read reasons (workspace unavailable, unborn repo, invalid base branch, git failed) share this branch.
  • ChangesTruncated — a >500-line file: the snapshot-level 变化过多 banner plus the per-file "另有 N 行未显示" note once expanded — the very-many-rows state, bounded before it reaches the DOM.
  • ChangesEdgeContent — the diff shapes a routine review never shows: binary, rename, deletion, no-newline-at-EOF, and a very long minified line, each rendered by the shared DiffCodePreview.

DiffCodePreview is a pure unified-diff string renderer with no edge-state props; the failure states live in this wrapper, which is where they are exercised here. bridge() gains review / reviewFail options in the same idiom as the existing tasksFail / traceFail.

Refs #3944, #3893

Verification

  • apps/desktop typecheck:stories passes; Biome lint and git diff --check clean.
  • Storybook build + render smoke: 201 stories, all green, no runtime/console/page errors, per-story AX-tree audit clean. The five new ids: product-session-workbar--changes-empty, --changes-load-failed, --changes-source-not-git, --changes-truncated, --changes-edge-content.
  • play runs under the smoke: each failure banner / empty state renders; expanding the truncated file surfaces the hidden-lines note; expanding the binary file renders its meta row through the diff body.

Fourth surface under apache#3944 (one surface per PR): extend the 变更 panel
(SessionReviewPanel, via Product/Session Workbar) with the failure and edge
states that never show up in normal use, so the Storybook gate and the apache#3893
a11y audit have real targets. All five drive the real panel through the fake
review service — no fabricated UI.

- ChangesEmpty — branch matches base: the panel's own EmptyState, not a
  spinner and not an error.
- ChangesLoadFailed — `review.read` rejects: an error Banner with 重试, the
  same shape as TasksLoadFailed.
- ChangesSourceNotGit — a source that cannot be read (not a git repo) is a
  failure Banner, not an absence; the other read reasons (workspace
  unavailable, unborn repo, invalid base branch, git failed) share this branch.
- ChangesTruncated — a >500-line file: the snapshot 变化过多 banner plus the
  per-file "另有 N 行未显示" note once expanded, the very-many-rows state
  bounded before it reaches the DOM.
- ChangesEdgeContent — the diff shapes a routine review never shows: binary,
  rename, deletion, no-newline-at-EOF, and a very long minified line, each
  rendered by the shared DiffCodePreview.

DiffCodePreview is a pure unified-diff string renderer with no edge-state props;
the failure states live in this wrapper, which is where they are exercised here.

Refs apache#3944, apache#3893
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant