feat(desktop): file-changes tree view in dual-solve panes#294
feat(desktop): file-changes tree view in dual-solve panes#294dripsmvcp wants to merge 8 commits into
Conversation
chore: promote test branch to main (desktop app + examples)
each dual-solve candidate pane showed a flat filename list plus a single column that stacked every changed file's hunks, which is hard to scan once a diff touches more than one or two files. replace that block with a reusable FileChanges view modeled on the gittensor-ui repositories components: a compact nested file tree (folders-first) as a narrow rail drives a content pane showing only the selected file's diff. selection is local per candidate, so the claude and codex panes navigate independently. - fileTree.ts: pure buildFileTree(paths) -> nested FileNode[], folders-first alphabetical, intermediate dirs synthesized from path segments; unit-tested. - diffParse.ts: lift parseDiff out of Diff.tsx so the renderer and the new view share one parser (behavior unchanged). - FileChanges.tsx: tree rail + per-file diff pane, derived entirely from the candidate's existing diff string. no new ipc or server change. - DualSolve.tsx: swap the ul + Diff block for <FileChanges>. renderer-only. typecheck clean; 100 tests pass including 7 new tree cases.
shows the per-candidate file tree rail driving the diff pane.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughDiff parsing is extracted into a shared module, a nested file-tree builder and tests are added, and a new FileChanges view renders a left file rail with a right-side diff pane. DualSolve now uses FileChanges for candidate diffs. ChangesFileChanges dual-pane diff navigator
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Stylelint (17.14.0)desktop/src/renderer/src/app.cssError: ENOENT: no such file or directory, open '/.stylelintrc.json' Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@desktop/src/renderer/src/components/diffParse.ts`:
- Around line 26-31: The diff parsing in diffParse is over-matching file header
markers, causing real added/removed lines like `++counter` or `--flag` to be
dropped. Update the skip logic in the parser branch that checks
`line.startsWith(...)` so it only ignores actual patch headers (`+++ ` and `---
`) while preserving content lines that merely begin with `++` or `--`. Keep the
change localized to the diff line filtering logic so both diff views render
those lines correctly.
In `@desktop/src/renderer/src/components/FileChanges.tsx`:
- Around line 48-57: The file row in TreeRow is currently rendered as a
clickable div, which makes it mouse-only and not keyboard-focusable. Update the
TreeRow render in FileChanges to use a real button element with type="button"
while keeping the existing selection and onClick behavior tied to node.path.
Also add the corresponding focused-state styling in
desktop/src/renderer/src/app.css so the selected row has a clear keyboard focus
indicator matching the existing fc-file / fc-file sel styling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: fc38eaac-aa2e-47d3-8aa3-ee65105532c4
⛔ Files ignored due to path filters (1)
desktop/docs/screenshots/dual-solve-file-changes.pngis excluded by!**/*.png
📒 Files selected for processing (7)
desktop/src/renderer/src/app.cssdesktop/src/renderer/src/components/Diff.tsxdesktop/src/renderer/src/components/FileChanges.tsxdesktop/src/renderer/src/components/diffParse.tsdesktop/src/renderer/src/components/fileTree.tsdesktop/src/renderer/src/views/DualSolve.tsxdesktop/test/file-tree.test.ts
two coderabbit findings on vouchdev#294: - diffParse dropped any content line starting with "+++"/"---", so a real added "++counter" or removed "--flag" line vanished from the diff. restrict the header skip to the actual markers "+++ " / "--- " (trailing space + path). adds diff-parse.test.ts covering the regression and basic parsing. - file rows in the tree rail were clickable <div>s — mouse-only, not keyboard-focusable. switch to <button type="button"> and add a focus-visible style; the .fc-file class now resets button chrome so the look is unchanged. verified live: rows are real buttons, keyboard-focusable, selection still swaps the diff pane. typecheck clean; 104 tests pass.
each dual-solve candidate pane showed a flat list of changed filenames followed by a single column that stacked every changed file's hunks. once a diff touches more than a file or two that's hard to scan and there's no way to focus one file.
this replaces that block with a reusable file-changes view modeled on the gittensor-ui
repositoriescomponents (fileTree.ts+RepositoryCodeBrowser), trimmed to changed files only: a compact nested file tree (folders-first) as a narrow rail drives a content pane that shows just the selected file's diff. selection is local per candidate, so the claude and codex panes navigate independently.what's in here:
fileTree.ts— purebuildFileTree(paths)returning a nestedFileNode[], folders-first alphabetical, with intermediate directories synthesized from path segments. unit-tested.diffParse.ts— liftsparseDiffout ofDiff.tsxso the existing renderer and the new view share one parser (behavior unchanged).FileChanges.tsx— the tree rail + per-file diff pane, derived entirely from the candidate's existingdiffstring.DualSolve.tsx— swaps theul+Diffblock for<FileChanges>.renderer-only: no new ipc, no server or transport change. the candidate
diffalready arrives from the job poll; the tree is derived from it.verification:
tsc -bclean;100 passed (100)including 7 newbuildFileTreecases. also checked live in the electron app — the rail renders the nested tree per candidate, defaults to the first file, and clicking a file swaps the diff pane (src/parser.py→tests/test_parser.py).out of scope by design: go-to-file search, breadcrumbs, directory-listing tables, commit metadata, synced selection across candidates, syntax highlighting.
Summary by CodeRabbit