Skip to content

Match Windows worktree notice accounting to macOS semantics - #503

Merged
coneilen merged 2 commits into
mainfrom
coneilen-microsoft-worktree-count-semantics
Sep 28, 2026
Merged

coneilen merged 2 commits into
mainfrom
coneilen-microsoft-worktree-count-semantics

Conversation

@coneilen

Copy link
Copy Markdown
Collaborator

Summary

Windows computed the worktree notice from different semantics than macOS. The
previous parity-ledger wording was also inaccurate: macOS excludes the canonical
checkout by path, not by branch. It counts every remaining assessment,
including prunable rows, and excludes only prunable rows from the size loop.
This aligns the Windows computation and states those exact semantics in the
ledger.

Changes

  • Identify and exclude the opened canonical checkout by path rather than by
    branch, so the first row is no longer misclassified.
  • Count all remaining assessed rows, including prunable ones, toward the
    worktree count; sum only non-prunable rows toward size.
  • Round each complete worktree to whole KiB before summing, approximating
    macOS du -sk allocated-usage reporting.
  • Clarify the ledger row to state count/size semantics, thresholds, and the
    residual limits. The row remains Partial.

macOS reference evidence

macOS runtime evidence is added by PR #500 at commit 10173c9f (that PR is
still open, so these paths are not present at this PR's merge-base):
GraphCode 0.1.76 (299), built from 717240cd, macOS 26.7. In that report R
means direct observation of the running app; the seven/eight boundary and both
screenshots are R evidence.

Those macOS captures establish the target behavior only. They are not
Windows validation.

Test plan

RED: & $env:GRAPHCODE_ZIG0152 test src\WorktreeStatus.zig -> behavioral failures: 4 of 27 tests failed, covering first-row/opened-checkout identity, prunable count/size, threshold boundaries, and logical-versus-allocated size; output preserved in worktree-notice-red-test.log.
GREEN: & $env:GRAPHCODE_ZIG0152 test src\WorktreeStatus.zig -> 29 tests passed.
REGRESSION: pwsh -NoProfile -File Tools\windows\Tests\WindowsShell.Tests.ps1 -ZigExecutable $zig -> 654 tests passed; scaffold contract passed. & $env:GRAPHCODE_ZIG0152 build -Doptimize=ReleaseSafe "-Dwinghostty-dir=$env:GRAPHCODE_WINGHOSTTY_ROOT" -> passed.

Limits of this test plan

The GREEN result is unit-level only. No live Windows toolbar/chip boundary
walkthrough was performed, so the ledger row stays Partial.

The initial shell-suite attempt stopped early because the pinned Winghostty test
library was missing. That is not a green result and is not counted as one;
the successful retry above is the run that stands, and it has a positive test
count. Filtered Zig tests are deliberately not used as suite evidence, because a
zero-match --test-filter still exits successfully.

Windows reads FILE_STANDARD_INFORMATION.AllocationSize and rounds each
complete worktree to KiB. This is a deliberate approximation of macOS
du -sk allocated-usage reporting; identical byte accounting across filesystems
has not been demonstrated.

Checklist

  • I have read the Contributing Guidelines
  • I have signed off my commits (git commit -s) per the DCO
  • Tests pass locally (make test): macOS/Xcode is unavailable on this Windows host; the Windows shell suite and build pass.
  • Code follows the existing style (make check): macOS/Xcode lint is unavailable on this Windows host.
  • I added the test before the implementation and observed the intended RED failure

@coneilen
coneilen force-pushed the coneilen-microsoft-worktree-count-semantics branch from 981041e to c194063 Compare September 28, 2026 21:48
coneilen and others added 2 commits September 28, 2026 16:10
Exclude the opened checkout from notice counts and sizes, count prunable worktrees without sizing them, and measure allocated file usage with per-worktree KiB rounding.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
Document that macOS counts prunable assessments while excluding their bytes, and distinguish Windows AllocationSize as an approximation to du -sk accounting.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen force-pushed the coneilen-microsoft-worktree-count-semantics branch from c194063 to c2ff32c Compare September 28, 2026 23:11
@coneilen
coneilen merged commit c4b565c into main Sep 28, 2026
16 checks passed
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