Skip to content

feat(commitrequest)!: say why a write outside a save's window closed it early, and split identity_change into precise close reasons - #491

Merged
sunib merged 3 commits into
fix/commitrequest-watch-gapfrom
feat/commitrequest-path-conflict-close
Nov 27, 2026
Merged

sunib merged 3 commits into
fix/commitrequest-watch-gapfrom
feat/commitrequest-path-conflict-close

Conversation

@sunib

@sunib sunib commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #490. Answers gitops-api ask #42, and open question 3 in docs/design/concurrent-author-windows.md.

Problem

A save's window can close before its own timers run out because of a write outside it. The save then commits what the window held at that point, without its author's later edits, and nothing on the request said so. The metric couldn't tell most of these situations apart either: close_reason="identity_change" covered three different causes.

Change

Close reasons. identity_change is replaced by three precise reasons:

close_reason (log form) When
other_target (other-target) A write of another GitTarget on the same branch arrives; GitTargets on one branch commit one window at a time
unproven_footprint (unproven-footprint) Another author writes, and the write's files or the window's can't be proven apart (shared file, kustomize, placement template, encrypted type)
single_window (single-window) Another author writes after the worker has fallen back to one window at a time

path_conflict and footprint_fallback stay as they are. On git_commit_windows_total, the existing timer_source="commit_request" label picks out windows a save was attached to. Together, they show how many saves were cut short and by what. No new metric is needed.

Request status. A request whose window closed for one of those five reasons gets FinalizeResult.WindowClosedEarly set to that close_reason value:

  • The worker marks the request in finalizeWindow and copies the mark onto the result in resolveCommitRequest. The "CommitRequest resolved" log line includes it.
  • The controller adds a line to Ready and Reconciling: "the window closed early, because : edits made after that are not part of this save". Each cause has its own wording.
  • The Ready reason is unchanged (Committed, AlreadyPresent), and a failure keeps only its own message.

Not reported: closes that pre-date concurrent windows and aren't caused by another write: buffer_limit, foreign_commit, apply_due, resync_before_apply, shutdown. attach_next isn't reported either, since the author's own next save causes it.

Docs: interpreting-metrics.md gains the new values and how to read save windows, and UPGRADING.md gains an entry. configuration.md, push-cooldown.md and the concurrent-windows design doc are updated; the design doc's history of the pre-stage-2 identity_change is left as it was.

Breaking change

gitopsreverser_git_commit_windows_total no longer has close_reason="identity_change". A query or alert on it matches nothing. Sum other_target, unproven_footprint and single_window for the old total.

Tests

  • TestWindowAdmission_ARequestWhoseWindowAnotherWriteClosedIsToldWhy puts a request on alice's window, then a write outside it arrives. Five cases:
    • carol writes alice's file: path_conflict;
    • carol writes a document in a shared file: unproven_footprint;
    • a write of GitTarget team-b: other_target;
    • carol writes after the fallback to one window: single_window;
    • carol writes a file of her own, and alice's window closes on its timer: nothing.
  • TestWindowFinalizeReason_ClosedEarlyByAnotherWrite: exactly the five reasons are reported, under the exported values.
  • TestCommitWindowMetrics_*: single_window is counted under its own name, and every reason maps to its label.
  • TestApplyFinalizeResultToStatus: each value adds its own note to Committed and AlreadyPresent; other values and failures get none.
  • The reference model (window_model_test.go) now uses unproven_footprint and still agrees with the worker.
  • TestWindowAdmission_AGitTargetChangeProvesTheOpenWindowsAgain: a GitTarget change makes two open windows' footprints unknown, and both now close as unproven_footprint, not path_conflict. Before the fix, closeConflictingWindows called every overlap a path_conflict, so alice's save would have been told another author touched its file. The reference model makes the same split.

🤖 Generated with Claude Code

…window early

When a write by another author touches a file an open window holds, the window closes with
path_conflict, and a request attached to it commits less than its author may have meant to save.
Nothing on the request said so. The worker now marks the request when path_conflict closes its
window, FinalizeResult carries the mark as ClosedByPathConflict, and the request's Ready and
Reconciling messages add that the window closed early. The reason is unchanged, so clients that read
Committed keep working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 53cc5aef-4437-4ac7-b84b-54dac5d513fc
Commits

Reviewing files that changed from the base of the PR and between d392f3b and bd423af.

Files selected for processing: 15

  • docs/UPGRADING.md
  • docs/configuration.md
  • docs/design/concurrent-author-windows.md
  • docs/design/push-cooldown.md
  • docs/interpreting-metrics.md
  • internal/controller/commitrequest_controller_unit_test.go
  • internal/controller/commitrequest_finalize.go
  • internal/git/branch_worker.go
  • internal/git/commit_request_attach.go
  • internal/git/commit_request_attach_loop.go
  • internal/git/commit_window_metrics_test.go
  • internal/git/window_admission.go
  • internal/git/window_admission_test.go
  • internal/git/window_model_test.go
  • internal/telemetry/exporter.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@sunib
sunib added this pull request to stack #492 November 27, 2026 17:45
@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/git/window_admission.go 91.6% 2 Missing ⚠️
internal/git/branch_worker.go 85.7% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…d it early, and split identity_change

A save's window is cut short not only by path_conflict. A write of another GitTarget on the branch,
another author writing where the files cannot be proven apart, a write after the worker fell back to
one window, and the fallback itself close it too. All of these used to be one close reason,
identity_change, apart from the last two.

git_commit_windows_total's identity_change is now three precise reasons: other_target,
unproven_footprint and single_window. With timer_source="commit_request" the counter shows which
saves were cut short, and why. FinalizeResult.WindowClosedEarly carries that close reason for
path_conflict, unproven_footprint, other_target, single_window and footprint_fallback, and the
request's Ready and Reconciling messages say why its window closed early. The reason is unchanged.

BREAKING CHANGE: gitopsreverser_git_commit_windows_total no longer has close_reason="identity_change".
It is one of other_target, unproven_footprint or single_window; sum the three for the old total.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sunib sunib changed the title feat(commitrequest): say when another author's write closed a save's window early feat(commitrequest)!: say why a write outside a save's window closed it early, and split identity_change into precise close reasons Nov 27, 2026
…nt as unproven_footprint

closeConflictingWindows reproves the open windows before a write and closed every overlapping pair
with path_conflict. After a GitTarget change makes the footprints unknown, they overlap only because
nothing is proven, so a save attached to one was told another author touched its file. A pair that
shares a proven path still closes with path_conflict; a pair that overlaps through an unknown
footprint closes with unproven_footprint. The reference model makes the same split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sunib
sunib merged commit 9970ce7 into main Nov 27, 2026
23 checks passed
@sunib
sunib deleted the feat/commitrequest-path-conflict-close branch November 27, 2026 18:48
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