Skip to content

feat(ui): show each worked project's uncommitted +/- in Details - #21

Open
guilhermexp wants to merge 7 commits into
mainfrom
feat/worked-projects-diff
Open

guilhermexp wants to merge 7 commits into
mainfrom
feat/worked-projects-diff

Conversation

@guilhermexp

@guilhermexp guilhermexp commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

What

In the Details sidebar (Orchestrator mode), each row of Projects worked now shows the same +A / −D counter as the Project row: the uncommitted changes (including new files) of that project's checkout, right-aligned, with the same colors and separator.

  • A project with no changes, no git or no diff of its own shows nothing. It never borrows another checkout's numbers.
  • The click is unchanged (WorkersModel::reveal_project).
  • A Workers worktree row shows its own worktree's diff.
  • Long names truncate; the counter does not shrink.

How

  • Engine: WatchCheckoutDiffs accepts an optional cwds list next to the existing cwd. It pins every checkout in the list for the life of the stream and releases all pins on drop; a non-git path does not affect the others. No entity or wire format changed. Without a pin, a checkout no chat points at (the usual Workers project) is never captured.
  • UI: details_sidebar/worked_project_diffs.rs opens one local subscription for the section, keyed by the local device and the sorted set of paths, instead of one stream per project (each stream carries every diff with its patch). The Workers registry is local, so the watch never goes to a remote chat's device. Rows match the diff by exact cwd.
  • Lifecycle: no stream while the section is collapsed or empty, outside Orchestrator mode, or while Details is not drawn (closed panel, Settings, gates other than ready; decided before any early exit of Shell::render). If the subscription fails or the stream ends, the current task clears its key so the next render subscribes again, without a redraw loop when the failure repeats.
  • OpenSpec change add-worked-project-diff-totals (proposal, tasks, delta spec) and DOX in crates/ui/AGENTS.md and crates/engine/AGENTS.md.

Known limit (in the spec): a project registered below the repository root (a monorepo subfolder) or through a symlink shows no counter, because the engine reports the diff with the canonical git root as cwd. Summing the whole repository into a subfolder row would be misleading.

Testing

All on Linux (Ubuntu 24.04), on the agents box.

  • Regression test worked_project_rows_show_only_their_own_diff (GPUI TestAppContext, in its own file): with the product code from before this change it fails on first project's +17 / −4 must appear; it passes here. It also checks that a project without a diff shows nothing and that an unrelated checkout's +999 / −888 never appears.
  • Lifecycle tests (worked_project_diff_lifecycle_tests.rs): worktree row with a long name, remote chat still using the local watch, one stream across renders, collapsed section without a stream, incremental update, clean and unavailable snapshots, stream end and immediate failures without redraw loops, hide and show.
  • Engine test checkout_diff_watch_pins_multiple_paths_and_releases_on_drop: two orphan repos plus a non-git folder in one stream; both diffs arrive, survive reconcile past the orphan grace, and retire after the stream is dropped.
  • cargo fmt --all -- --check, cargo test --locked -p zeron-ui --lib (2263 passed; the pre-existing Linux-only failure markdown::link_interaction::rendered_tests::file_link_menu_hides_system_rows_for_remote_and_web_links, already failing on main, is skipped by name) and cargo test --locked -p zeron-engine --lib (577 passed, 4 ignored).
  • openspec validate add-worked-project-diff-totals --strict passes.
  • Real app (scripts/dev-demo.sh, isolated profiles, Xvfb with llvmpipe): an Orchestrator chat touching two temporary git repos registered as Workers projects. Before: both rows without counters. After: +5 / −2 on the dirty repo (git diff --shortstat HEAD gives +3/−2, plus a 2-line new file) and nothing on the clean one. One more line updated it to +6 / −2 live, without reopening the chat.
  • Review: OpenQodex and CodeRabbit over four rounds; their lifecycle findings (closed panel, stream end, Settings early exit) are fixed in abb03ffd and 61803952. The last round had no findings (CodeRabbit was out of quota in that round).
  • Not tested on macOS: check the section in Zeron.app after merging and installing.

Summary by CodeRabbit

  • New Features
    • Expanded Worked Project rows now show added and deleted file counts for matching local checkouts, including Worker worktrees.
    • Diff counts update as checkout changes occur and appear only when there are changes. Clean, non-Git, unavailable, or unrelated checkouts show no counts.
    • Diff tracking runs only while the relevant section and Details panel are visible; hiding them clears the displayed counts.

@guilhermexp

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fa866631-e501-417b-9834-94bf1283abb1

📥 Commits

Reviewing files that changed from the base of the PR and between e801429 and 6180395.


📒 Files selected for processing (11)
  • crates/engine/AGENTS.md
  • crates/engine/src/rpc.rs
  • crates/ui/AGENTS.md
  • crates/ui/src/details_sidebar/view.rs
  • crates/ui/src/details_sidebar/worked_project_diff_lifecycle_tests.rs
  • crates/ui/src/details_sidebar/worked_project_diffs.rs
  • crates/ui/src/details_sidebar/worked_project_diffs_tests.rs
  • crates/ui/src/shell.rs
  • openspec/changes/add-worked-project-diff-totals/proposal.md
  • openspec/changes/add-worked-project-diff-totals/specs/details-sidebar/spec.md
  • openspec/changes/add-worked-project-diff-totals/tasks.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

The engine diff-watch request now accepts multiple checkout paths and retains successful pins for the stream’s lifetime. The Details sidebar watches visible Worked Project paths and displays additions and deletions for matching checkouts.

Changes

Worked Project diff totals

Layer / File(s) Summary
Multi-checkout diff stream
crates/engine/src/rpc.rs, crates/engine/AGENTS.md, openspec/changes/add-worked-project-diff-totals/specs/details-sidebar/spec.md
WATCH_CHECKOUT_DIFFS accepts cwd and cwds, sorts and deduplicates their paths, and retains successful pins until the stream is dropped. Failed pins do not stop other paths. Engine tests cover multiple Git checkouts, a non-Git path, retention, and release.
Visible-path watch lifecycle
crates/ui/src/details_sidebar/worked_project_diffs.rs, crates/ui/src/details_sidebar/view.rs, crates/ui/src/shell.rs, crates/ui/src/details_sidebar/worked_project_diff_lifecycle_tests.rs
The sidebar watches sorted, deduplicated paths while the Worked Projects section and Details panel are visible. It applies updates only for watched paths and clears matching state when the watch is hidden or ends. Lifecycle tests cover updates, cancellation, stream completion, connection EOF, and failed subscription attempts.
Checkout totals in project rows
crates/ui/src/details_sidebar/view.rs, crates/ui/src/details_sidebar/worked_project_diffs_tests.rs, crates/ui/AGENTS.md, openspec/changes/add-worked-project-diff-totals/*
Rows show additions and deletions for matching checkouts with changed files. Tests check row placement and ensure unrelated checkout totals are not displayed. The specifications and documentation describe exact-path matching and watch behavior.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Shell
  participant DetailsSidebar
  participant WATCH_CHECKOUT_DIFFS
  participant CheckoutDiffStream
  Shell->>DetailsSidebar: Render visible Orchestrator Details
  DetailsSidebar->>WATCH_CHECKOUT_DIFFS: Subscribe with sorted visible paths
  WATCH_CHECKOUT_DIFFS->>CheckoutDiffStream: Pin successful checkout paths
  CheckoutDiffStream-->>DetailsSidebar: Send checkout diff frames
  DetailsSidebar-->>DetailsSidebar: Update matching project totals
Loading

Merge Risk: ⚪ Minimal · up to 61803

No merge-blocking issue was found; the worked-project counters and watch lifecycle are ready for normal merge checks.

Pre-merge checks | Passed 4 | Inconclusive 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 31.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 5 files. (6 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main UI change: showing each worked project's uncommitted additions and deletions in the Details sidebar.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 31.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 5 files. (6 skipped: 5 unsupported, 1 too large.)


✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR


🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 LanguageTool
crates/ui/AGENTS.md

LanguageTool checks are incomplete because the per-file request limit of 5 was reached. Remaining text was skipped; findings from completed checks are retained.


🔧 Clippy (1.98.1)

Clippy execution timed out



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.

❤️ Share

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

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium impact] Adds diff counters to worked projects in the sidebar.

No blocking issue is reported; the regression-coverage concern does not prevent merging.

Findings

  1. P2 Hidden-panel test bypasses Shell ▶

T-Rex evidence

Executed Shell visibility mutation script (local file)

  • The authored script attempted the targeted test with and without the hook and restored Shell afterward; its local reference is preserved because upload is unavailable.

Observed test output with Shell hook enabled (local file)

  • The original-head Cargo attempt recorded exit 101 at native linking, showing that the baseline lifecycle test did not execute.

Observed test output with Shell hook disabled (local file)

  • The mutated-hook Cargo attempt recorded exit 101 at native linking, showing that mutant survival remains unverified.

Observed mutation and restoration output (local file)

  • The orchestration output records both failed Cargo attempts and successful source restoration, showing the mutation was reversed.

Captured numbered test and visibility-hook source (local file)

  • The source-reading output preserves the relevant test and production excerpts, supporting the coverage concern without claiming runtime confirmation.

Evidence from the check

  • The authored script attempted the targeted test with and without the hook and restored Shell afterward; its local reference is preserved because upload is unavailable.

Command output from the check

  • The original-head Cargo attempt recorded exit 101 at native linking, showing that the baseline lifecycle test did not execute.

Command output from the check

  • The mutated-hook Cargo attempt recorded exit 101 at native linking, showing that mutant survival remains unverified.

Command output from the check

  • The orchestration output records both failed Cargo attempts and successful source restoration, showing the mutation was reversed.

Command output from the check

  • The source-reading output preserves the relevant test and production excerpts, supporting the coverage concern without claiming runtime confirmation.

View artifacts

Summary

Adds each worked project's uncommitted +A / −D totals to Details.

  • Worked Project rows show the uncommitted totals for their own checkout.
  • One diff watch can follow several checkout paths.

Acknowledged limit: guilhermexp explicitly documented that registered subfolders and symlink paths show no counter when they differ from the engine's canonical Git root. Summing the whole repository into a subfolder row would be misleading. This was not reported as a defect.

T-Rex validation blocked

The targeted lifecycle test could not execute because native ONNX runtime objects referenced unavailable C and C++ symbols on this host: __isoc23_strtol, __isoc23_strtoull, __isoc23_strtoll, and basic_string::_M_replace_cold. Both the unchanged and visibility-hook-disabled attempts stopped during linking, before test execution. The source was restored byte-for-byte. Evidence was saved locally; uploaded references could not be obtained because no artifact-upload interface or destination was available.

Reviews (1) · Last reviewed commit: "fix(ui): release worked diff watch befor..." · Reviewed by Greptile

let request: zeron_rpc::ClientFrame =
serde_json::from_str(&requests.try_recv().unwrap()).unwrap();
assert_eq!(request.params["cwds"], serde_json::json!(paths));
sidebar.update(window, |sidebar, cx| sidebar.hide_worked_project_diffs(cx));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Hidden-panel test bypasses Shell

This test calls hide_worked_project_diffs directly, so it still passes if Shell::render stops calling that helper. A later change could leave checkout watches running while Details is hidden without this test catching it.

Add a test using Shell that starts the watch, closes Details or opens Settings, checks the cancellation request, and reopens Details to check a fresh subscription. This is a non-blocking coverage improvement.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to 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