Skip to content

feat(playground): Add Risk review view to compare mode#118

Merged
mhiro2 merged 1 commit into
mainfrom
feat/playground-review-view
Apr 30, 2026
Merged

feat(playground): Add Risk review view to compare mode#118
mhiro2 merged 1 commit into
mainfrom
feat/playground-review-view

Conversation

@mhiro2

@mhiro2 mhiro2 commented Apr 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a fifth Risk review option to the compare-format select that runs the wasm review_from_sql binding alongside the existing Visual diff / Text / Markdown / Structured JSON views, without splitting compare into a new workbench mode.
  • Renders severity badges, sorted finding cards (breaking → info) with rule_id / target / message / mitigation, and a collapsible suppressed-findings panel sourced directly from ReviewResult so the playground consumes the same payload shape as relune review --format json.
  • Wires URL state, output reset, and Copy / Download JSON actions through to the CLI-equivalent flattened JSON payload so ?compare=review links and exported reports stay in lockstep with the CLI.

Changes

  • 6739e19 : feat(playground): add risk review view to compare mode
    • Extends CompareView to visual | text | markdown | json | review, exposes review_from_sql / review_from_schema_json from the wasm type stub, and short-circuits runCompareMode into a dedicated runReviewView so the diff pipeline never fires when the review view is active.
    • Adds a review-panel surface with severity badges, sorted finding cards ((schema) fallback target included), and a <details> panel for --except-table suppressed findings, plus matching CSS for severity-coded borders / badges in light and dark themes.
    • Updates isCompareView to accept "review" and broadens resetOutputPanels to clear the review panel root and child lists so re-entering the view never shows stale badges or finding cards.

Adds a fifth `Risk review` option to the compare-format select that
runs the wasm `review_from_sql` binding instead of `diff_from_sql`,
keeping `WorkbenchMode = "compare"` unchanged. `runCompareMode` now
short-circuits to a dedicated `runReviewView` early-return path so the
existing diff pipeline never fires when the review view is active.

The new `review-panel` surface renders severity badges
(`breaking / caution / warning / info`) sourced from
`ReviewResult.summary`, finding cards sorted by severity descending
with rule_id, target (table.column / table.fk_name / `(schema)`),
message and mitigation, plus a `<details>` panel for findings excluded
by `--except-table`. `resetOutputPanels` clears the review panel root
and child lists so re-entering the view does not show stale state.

`isCompareView` now accepts `"review"` so the URL state guard does not
fall back to `"visual"` for shared `?compare=review` links, the
PersistedState round-trip stays intact, and the wasm import surface in
`relune_wasm.d.ts` is widened with `review_from_sql` /
`review_from_schema_json`. Copy JSON / Download JSON wire to the CLI
equivalent flattened JSON in `WasmReviewResponse.content`, matching
`relune review --format json -o`.
@github-actions

Copy link
Copy Markdown

Code Metrics Report

main (0ca4bbe) #118 (4396cb1) +/-
Coverage 94.6% 94.6% 0.0%
Test Execution Time 1m34s 1m36s +2s
Details
  |                     | main (0ca4bbe) | #118 (4396cb1) | +/-  |
  |---------------------|----------------|----------------|------|
  | Coverage            |          94.6% |          94.6% | 0.0% |
  |   Files             |             81 |             81 |    0 |
  |   Lines             |          37324 |          37324 |    0 |
  |   Covered           |          35344 |          35344 |    0 |
- | Test Execution Time |          1m34s |          1m36s |  +2s |

Reported by octocov

@mhiro2 mhiro2 self-assigned this Apr 30, 2026
@mhiro2 mhiro2 added enhancement New feature or request labels Apr 30, 2026
@mhiro2
mhiro2 merged commit f66f8b2 into main Apr 30, 2026
4 checks passed
@mhiro2
mhiro2 deleted the feat/playground-review-view branch April 30, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant