Skip to content

Latest commit

 

History

History
159 lines (130 loc) · 10 KB

decision-commitrequest-and-commitwindow.md

File metadata and controls

159 lines (130 loc) · 10 KB

Decision: CommitRequest and CommitWindow stay two kinds

Status: considered 2026-12-01; both kinds stay. With a CommitWindow per commit window (idea-commit-window-records.md), the two kinds looked close enough to merge: drop CommitRequest, and give CommitWindow a message a frontend can edit. This page records why that was weighed and set aside, the declared windows that were considered on the way, and what the names should be.

The direction we considered

  • A client creates or finds a CommitWindow, and sets spec.commitMessage on it, editable while the window collects.
  • CommitRequest goes away: the window is both what collects the writes and what carries the message.
  • One kind instead of two, and a frontend that edits the message in place.

The overlap is there. Both reference a GitTarget, both carry window timers, both report an outcome and a commit, and a declared CommitWindow (below) with a message would do almost everything a CommitRequest does.

Why both stay

They are two steps of one process. A window collects writes; a save ends the change and says why. Git has the same split: the index collects changes, and git commit -m ends them with a message. Nobody edits the message into the index while staging. The two kinds answer different questions: CommitWindow what the worker did, CommitRequest what the person asked for.

The overlap comes from declared windows, not from the records. A CommitRequest with attach: Next already is a window declared up front: created before the writes, waiting for the next window, with timers and a message. With a changeKey on the request, a declared CommitWindow adds nothing a save lacks. So the overlap is removed from the other side: CommitRequest stays the one kind clients write, and CommitWindow stays a record only the operator writes.

An editable message costs more than it looks:

  1. Who wrote it. Today the message comes from the person who created the CommitRequest, established from the audit event of the create. An editable field is an update, and anyone with update rights in the namespace could rewrite another person's message. Keeping "established, never asserted" would need every update's author proven too: new machinery for one field.
  2. It still needs an "I am done" signal. The window commits when it closes. A frontend that edits the message needs to know the window has not closed yet, and a way to say "close now": a second mutable field. Creating a CommitRequest is that signal today, and the save barrier orders it after the writes before it.
  3. The objects would have to live on source clusters. Clients work where CommitRequests live, source clusters included. Records alone can stay on the control cluster. As the client API, a CommitWindow would have to be created and updated by the operator in tenants' namespaces, on clusters where it does not install the CRD. That was optional; it would become required.
  4. It breaks the spec and status split. A CommitWindow's spec is its creator's ask and never changes. The operator creates the implicit windows; a user editing their spec puts two owners on one object.
  5. It undoes built and settled work. The save barrier, attach, whenNothingToCommit, catchUp, the source-cluster serving path, the schema revision protocol and the gitops-api client all hang on CommitRequest. No users makes a break cheap, not free, and the client team would pay for it too.

What gives a frontend the same power

  1. The frontend picks a change key and shows a draft of its own. Nothing on the server is needed before the first write.
  2. It writes with the key (in Audit-ID). The first write opens a window; its CommitWindow appears with status.changeKey. The frontend watches CommitWindows for its key and author and shows each write landing as it happens.
  3. The person writes the message whenever they like, in the frontend.
  4. The frontend creates a CommitRequest with the key and the message, which ends the change. Its status names the CommitWindow, and the window names it back.

That is one command kind, created once, so its author is established; one record kind that only the operator writes; nothing new on source clusters; and no ordering problem for a declaration.

What follows for the idea

  • CommitRequest gains spec.changeKey with keyed saves, and stays the only kind a client writes. A CommitRequest is the signal that finishes a change, with a message (where each concept lives).
  • Declared CommitWindows are not needed for the frontend case above; the design is kept below until a case needs it.
  • CommitWindow stays read-only for users: an operator-written record, whose spec is only its gitTargetRef.

What would reopen it

A case where the message has to change while the window collects, and someone other than the person writing it must see that change before the commit: for example, a shared "change in progress" view that several people or tools read. Then an editable message has a reader, and earns its cost. Short of that, it is state the frontend can keep itself.

Declared windows, as considered

Before the change key settled the frontend case, a client could create a CommitWindow up front to say which writes belong to its change. The design, kept for when a case needs it:

  • A declaration registers intent and opens no collection. Only a write opens a window, so "a request never opens a window" keeps holding. The first write with its key, by its author, on its GitTarget, starts collection, and the window from then on is the declared object.
  • It selects by change key only (spec.selection.changeKey). A selector by namespace or resource type would absorb unrelated work of the same author; it would come only for a case that shows it is needed.
  • No round trip. The write carries the key, so the client need not wait for the declaration: a write that reaches the worker first opens a keyed window, and the declaration binds to it.
  • Its author comes from the audit event of its create (tier create_uid), and it only takes that author's writes. One open declaration per author and key; a second is refused.
  • It closes like a keyed window: on its timers, or when a CommitRequest naming its key attaches. It may set spec.window, its own timers.
  • Admission follows the saves: a GitTarget that admits a client's CommitRequests admits its declarations.

It would have changed the record too:

  • A spec of its own, written by clients. selection and window, immutable, and an origin (Implicit or Declared) in status, decided from who created the object.
  • Timer layers. CommitWindow.spec.window over GitTarget.spec.commit.window over the built-in defaults, per field, which needs the timer type's +kubebuilder:default markers moved into the operator: a default on the type applies wherever it is used, so a declared window would never inherit its target's timers.
  • Source clusters. A frontend works on the source cluster, so declarations would be created there, as CommitRequests are, and the operator would update objects in tenants' namespaces.
  • Ends of its own. A declaration whose writes never come ends on its own maximum; a key that keeps getting writes after the declared window closed opens new windows, which are ordinary records.

What it was not, either: cross-author, across GitTargets, a transaction (writes are live before any commit), or a replacement for implicit windows.

And the names?

The question came up with this one: is CommitWindow the right name, or is it a staging phase (GitStaging)?

CommitWindow stays. The reasons, strongest first:

  • "Staging" already means an environment. In GitOps, and in this repository's own designs, it names a stage of promotion: "a base shared by prod and staging". A GitStaging kind in a GitOps operator reads as something about the staging environment.
  • The Git analogy is weaker than it looks. Git's staging area is one per repository, curated by the person: they choose what to add and what to leave out. A commit window is one of many open at once, filled by the operator from live writes, closed by timers and close reasons, and a person cannot leave a write out of it. "Staging" promises a control that is not there.
  • "Window" names what it is: a bounded collection of writes over a span of time, closed by an idle timer, a maximum or a save. With change keys it is still bounded that way.
  • It is the word everywhere already. "Commit window" is in about 105 files: the metrics (git_commit_windows_total, git_commit_window_duration_seconds, close_reason), the docs, and GitTarget.spec.commit.window. Naming rule 1 in definitions.md is one concept, one word; a new kind name for an existing concept would make two.
  • It pairs with its neighbor. CommitRequest is the command, CommitWindow is the collection it ends: the Commit prefix groups the two kinds about commits, as Git groups the kinds about repositories.

Names considered and why not:

Name Why not
GitStaging, StagedChange "Staging" is the environment, and it promises curation the window does not offer
ChangeSet, Change The change is the logical thing, named by its key, and can span several windows (changes, windows and saves); the object is one instance
PendingCommit "Pending writes" already names what a branch worker holds (definitions.md), and a window can end with no commit
CommitDraft A draft is something a person edits; this one only the operator writes

The staging analogy is still useful for explaining it, with its limit stated: a commit window is like Git's staging area, except that the operator fills it from live writes and closes it on its own.