Skip to content

feat(ui): Analyze/Refine top-bar flow with incremental refinement - #17

Open
jakob1379 wants to merge 1 commit into
jamesaphoenix:mainfrom
jakob1379:t3code/improve-analyze-refine-ux
Open

feat(ui): Analyze/Refine top-bar flow with incremental refinement#17
jakob1379 wants to merge 1 commit into
jamesaphoenix:mainfrom
jakob1379:t3code/improve-analyze-refine-ux

Conversation

@jakob1379

Copy link
Copy Markdown
Contributor

Summary

Top bar. Two plain buttons replace the in-panel refinement banner.

  • Analyze is blue before an analysis exists and red once one is loaded. In the red state a first click arms it ("Confirm re-analyze?") and a second click within 3 s runs it; blur or timeout disarms.
  • Refine runs LLM refinement, reads "Refine (update)" when a baseline exists, swaps to "Refining… ✕" while a job runs, and is disabled with a tooltip naming the reason (no analysis / analysis running / no AI provider).

Refinement backend.

  • Incremental refinement carries the previous refined grouping onto a fresh analysis and asks the LLM only for adjustments (carry_over_grouping).
  • In-flight refinement jobs can be cancelled.
  • RefinementResult records head_sha and the covered files; older cached JSON still deserializes (tested).
  • After re-analysis a cached refinement is auto-applied only when its head commit and its full file set (grouped + infrastructure) match the fresh diff; otherwise it becomes the baseline for the next incremental update. This fixes File 'src/sepseeq/cli.py' not found in diff after re-analyzing with a stale cached refinement.

Also: PR/MR head polling with a "New commits" bar, and a typecheck:e2e npm script so Playwright spec files are type-checked without a browser.

Review

Three independent reviews were run on the first cut (OpenCodeReview delegation, an over-engineering pass, and a senior code review). Fixed in this PR:

  • e2e specs broken by a bad selector rewrite (would have failed to parse).
  • Re-analyze during a running refinement: the job is cancelled and its pending stream rejected, so the top bar cannot stick on "Refining…"; a job that completes after a fresh analyze no longer overwrites last_analysis/last_refinement.
  • In-memory refinement baseline cleared on every analyze, and the frontend baseline flag reset, so a baseline cannot leak across repos/branches.
  • Auto-apply guard now requires full file-set equality including infrastructure files.
  • Carried-over groups keep only files the fresh pass still groups, so infra-classified files are not rebuilt with zero-line metadata.
  • PR head watcher no longer emits a phantom "new commits" event when its seed poll failed.
  • Duplicate incremental-baseline block in start_refine_groups / refine_groups folded into one helper.
  • Removed a stray 5 MB output.gif from the commit.

Deliberately not taken: replacing the two-click confirm with window.confirm (design choice), dropping the incremental flag from the command API, and the larger watch_git_head/watch_pr_head and ls-remote dedupe refactors. Those are follow-ups if wanted.

Tests

  • cargo test -p diffcore-core -p diffcore-tauri: 2229 passed, 0 failed.
  • npx tsc --noEmit and npm run typecheck:e2e: clean.
  • npm run build: OK.
  • Playwright was not run: its bundled Chromium cannot launch on this machine (missing libglib). The top-bar states were verified manually in the built app instead.

Top bar: plain Analyze and Refine buttons replace the in-panel refinement
banner. Analyze is blue before an analysis exists, red once one is
loaded, and asks for a second click before discarding current groups.
Refine greys out with a tooltip naming why it is unavailable.
Refinement: incremental mode carries the previous refined grouping onto
a fresh analysis and asks the LLM only for adjustments; in-flight jobs
can be cancelled; a cached refinement is only auto-applied after
re-analysis when its head commit and full file set match the fresh
diff, otherwise it becomes the baseline for the next update.
Review fixes: re-analysis cancels an in-flight refinement and rejects
its pending stream so the top bar cannot stick on "Refining"; a job
that finishes after a fresh analyze no longer overwrites it; the
in-memory refinement baseline is cleared on every analyze so it cannot
leak across repos; carried-over groups only keep files the fresh pass
still groups; the PR head watcher no longer emits a phantom push when
its seed poll failed. Adds a `typecheck:e2e` script so spec files are
type-checked without launching a browser.
Sign up for freeto 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.

1 participant

@jakob1379