Repository navigation
#762: reconcile rebuilds a request from its bot branch, approved again by people - #802
Open
ephico2real2 wants to merge 3 commits into
Open
ephico2real2 wants to merge 3 commits into
ephico2real2 wants to merge 3 commits into
Conversation
…n by people After a database restore the reconcile operation's rebuild-requests step takes each bot branch the database lacks, one item at a time (core/rebuild.py). - The head must have the bot's shape: one parent on main, the bot's name and email as author and committer with one date, this request's, this instance's and one plan hash's trailers, the bot's subject, changes inside one namespace folder, the open PR on the same head with the same plan hash in its body, and files that hash to the plan hash again. Anything else is reported and not rebuilt: the item fails and auto-approval stays paused. - A head already in main is skipped as merged, a folder that moved on as superseded, and an adoption and a host that cannot read commits are reported. - The row comes back under its own ID in pending_approval, with the files and base Git holds and no approvals. Git carries no authority (docs/01), so the rules decide it again: at least one approver, no auto-approval, and no self-approval. The run's starter is the requester (via svc-cmapi-workflows). The requester the commit names is refused as approver. Once approved, push_branch adopts the same branch and open_pr takes up the same PR. #796: git_reconcile no longer closes the PR or deletes the branch of a request the database lacks while its head is not in main. It counts them as unrecorded and keeps them for the reconcile operation. Decision record and sources: docs/reviews/2026-12-01-issue-762/README.md. Docs: docs/02, docs/14, docs/16, GLOSSARY, citations relocated. Written by Opus 5.5 (high), the implementer.
CI's service job: Plan.stored reads plan.rebuilt, and the test's SimpleNamespace stands in for a Plan field by field, as it already gives adoption=None. Written by Opus 5.5 (high), the implementer.
Conflicts were citation line numbers in docs/14, docs/16, docs/02 and citations.lock.json. main's versions are taken, #762's doc edits are applied again, and the citations are relocated and written with scripts/doc-citations.py (0 problems). Written by Opus 5.5 (high), the implementer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #762
Closes #796
Part of #26
What it does
After a database restore, the reconcile operation rebuilds each bot branch the database lacks, one item of
rebuild-requestsat a time (cmapi/src/cmapi/core/rebuild.py). docs/01, "Database recovery", asks for this.The branch must have the bot's shape (
verify):Any other branch is reported and not rebuilt. Its item fails, so the run fails and auto-approval stays paused.
Skipped: a head already in main (
merged), and a folder that moved on since the commit's parent (superseded).Reported: an adoption (its snapshot of the live objects is not in Git), and a host adapter that cannot read commits (the Gitea stand-in, FakeGit).
The rebuilt row: it comes back under its own ID in pending_approval, with the files and base that Git holds and no approvals. Git carries no authority (docs/01, "Approval of record"), and the bot does not sign its commits, so the rules decide the request again:
The run's starter is the requester, sent by
svc-cmapi-workflows. The requester that the commit names cannot approve or reject it.Once approved:
push_branchadopts the same branch andopen_prtakes up the same PR.git_reconcile deletes the bot branch and closes the PR of a request a restored database lacks #796:
git_reconcileclosed the PR and deleted the branch of every request a restored database lacked, at its first pass after the restore. It now keeps a branch or PR with no row whose head is not in main, and counts it asunrecorded.The decisions, the options rejected and the sources are in
docs/reviews/2026-12-01-issue-762/README.md. The sources are git-commit(1) and git-interpret-trailers(1), GitHub's commitverificationand the repository activity API, Flux's.spec.verify, and Argo CD's signature verification. The options rejected are keeping the approval in pr_open, sealing or signing the bot's commits, and GitHub's pusher record.Proof (local PostgreSQL 16, no cluster)
cmapi/tests/service/test_reconcile_rebuild_762.pyruns on real Git through the Git layer and GitHub's PR paths (StubGitHub):autois null andselfApprovalis false. The named requester and the starter get 409self-approval. An approver approves it, and it reaches pr_open on the same PR and head, with no second PR.not-the-bot), and no row is written.hash-mismatch), and no row is written.git_reconcileafter the restore keeps the PR and the branch.cmapi/tests/core/test_approvals.pycovers the rebuilt rule and the named-requester refusal.All six fail before the change. The output from before and after is in the record folder. These files also pass with the change:
test_git_layer.py(89 tests, one test adjusted: a no-row orphan whose head main already holds is still deleted),test_operations_26.py(21, the reconcile test updated),test_operations_review_774.py,test_review_288_f2.py,test_review_288_f6.py,test_reject_decision_779_780.pyandtests/core/test_approvals.py.Not tested: an update or a delete rebuilt end to end, and anything on CRC or kind.
Filed
next_idcan reissue a lost request's ID. Not in this change.Who wrote what
Opus 5.5 (high), the implementer, wrote every commit and file in this PR. The review has not run yet. The change touches approval and Git provenance (security), so it needs reviewer 1 and reviewer 2.