Repository navigation
✨ feat: fence Integration-aware promotion with exact-tested CAS - #15912
Conversation
Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
Safety correction: existing mutation Boundary exposes reconcile/lookup even with mode OFF, so method availability did not prove journaling. New ExecuteJournaled contract freezes effective mode, refuses OFF/missing persistence, fsyncs intent before the effect and fsyncs the result/directory before acknowledgement. Ordinary Execute retains legacy OFF passthrough. New regressions cover missing/off journals, mode change during effect, cold journal reopen/replay and logging/Crux alias forwarding. Promotion uses only the explicit journal-required contract. This is a new immutable head; all required/full applicable CI must run again. Prior head results are not final proof. No activation or existing-flow change. |
Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
Safety refinement: destination-only CAS cannot fence a concurrent author push. This head adds a second atomic updateRefs condition: the same-repository author ref must still equal the exact tested author head and is left unchanged. Both conditions succeed or neither destination/source update applies. Fork-head promotion is explicitly unsupported because GitHub cannot perform this transaction across repositories; no read-then-write downgrade or protection/permission change. Added deterministic concurrent-source-head regression and provenance binding. Required-context compatibility, trusted combined CI, production live-guard/controller wiring and actual isolated-provider verification remain blockers; this is not execution-ready. Exact-head full CI restarted; prior-head green is not transferred. No local suites/builds or live mutations run. |
There was a problem hiding this comment.
Read integration_promotion.go against the v5 tree, the new ExecuteJournaled contract in crux/effects and convergence/mutation, and the existing reconcile path in client.go:3357-3430. This looks correct to me as a fenced, unactivated transport.
What I verified:
- Fail-closed boundary chain.
integrationPromotionJournaledunwrapsLoggingBoundaryand requires the terminal boundary to beReconciler+Lookup+JournaledBoundary(integration_promotion.go:62-81);*mutation.Boundarysatisfies all three (boundary.go:177,:252, newExecuteJournaled).LoggingBoundary.ExecuteJournaledreturnsErrDeniedrather than passing through when itsNextcannot journal (crux/effects/effects.go:308), andmutation.Boundary.ExecuteJournaleddenies on off-mode / nil ledger / nil or path-less journal (boundary.go:56-59), so unlike legacyExecutethere is no off-mode passthrough here. - CAS pre-conditions are checked before the claim is journaled. Tree, both ordered parents and the tested SHA are compared against
Git.GetCommit(integration_promotion.go:160-165),HeadRef == Baseis rejected invalidate()(two updates to one ref in a singleupdateRefswould be ambiguous), and all-zero / upper-case OIDs are rejected byintegrationPromotionOID. - Reconcile path matches the existing idiom. On
ErrNeedsReconciliationthe destination is read once;== TestedSHA→ applied,== ExpectedSHA→ not applied and safe to retry because the server-sidebeforeOidis unchanged, anything else →ErrIntegrationDestinationChangedwith no retry (integration_promotion.go:207-222). That mirrorsclient.go:3357-3430and is covered byTestIntegrationPromotionReconcilesWithoutBlindTTLRetry. frozen := *binExecuteJournaledcopies a struct with only pointer/func/value fields (Boundary,Executor— no locks), so the mode freeze is safe.syncPersistentholdsj.mubeforelockAndRefreshLocked, as that helper's contract requires (journal.go:295).- No caller of
PromoteIntegrationStepexists in the tree, consistent with the body's "no activation" scope.
One open question, not a verified defect: the author-head fence relies on GitHub accepting a refUpdates entry whose beforeOid == afterOid (integration_promotion.go:186-189) as a pure precondition. I could not confirm from the public updateRefs docs that a no-op update is honoured rather than rejected or ignored; TestIntegrationPromotionAuthorHeadMovesAfterLiveGuard exercises the stub, not the live API. Worth a one-off live check before any lane is wired to this, since a rejection would surface as a hard failure rather than a silent downgrade.
CI: all completed checks green at 6ba38d4 (arm64 build still running).
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
Pre-merge protocol review caught one further authority-scope edge: SDK redirects after repository rename/transfer must not let an old enrolled name authorize writes to a different resolved repository. This head rejects URL/path-ambiguous repository identifiers and requires returned repository full_name to match the enrolled scope. Added rename/alias regressions. The atomic-ref race fixture now evaluates the actual submitted ref updates, so concurrent-head tests cannot accidentally pass from a hard-coded expected-source check. No runtime caller or live write added. Prior-head tests/coverage/lint/security were green, images still running; complete CI must reset for this safety correction. No previous-head proof is transferred. |
There was a problem hiding this comment.
Read integration_promotion.go, the new ExecuteJournaled / syncPersistent paths and the existing Boundary.Execute / Executor.Execute they sit on, at merge-base. The transport looks correct to me as a bounded, uncalled protocol; one design note below.
What I verified:
- Pre-flight is strict and ordered —
validate()rejects cross-repo heads,HeadRef == Base,ExpectedSHA == TestedSHA/AuthorHead, non-lowercase/all-zero OIDs and unsafe ref names (integration_promotion.go:45-62,:88-107), thenGit.GetCommitis checked for exact tree and ordered parents[ExpectedSHA, AuthorHead](:155-159) before any claim is taken. - Guard runs inside the effect, before the mutation, and its failure is
NotAppliedso the journal records it as not applied rather than Unknown (:162-165;executor.go:123-126). - Reconciliation is conservative — on
ErrNeedsReconciliation, ref ==TestedSHA→ applied; ref ==ExpectedSHA→ not applied and safe to retry becausebeforeOidis unchanged; anything else →ErrIntegrationDestinationChanged, no retry (:204-218).LoggingBoundarydoes implementReconcile(crux/effects/effects.go:327), so a logging wrapper doesn't silently skip this path. - No lock hazards —
frozen := *bcopiesBoundary, whose only pointer-ish members are*Ledger/*Journal(no embedded mutex);syncPersistenttakesj.mu, whichBegin/RecordResulthold per-call, not across the effect callback (journal.go:377,:420;executor.go:117), so the pre-effect fsync inside the callback cannot deadlock. ExecuteJournaled's pre-checks (boundary.go:55-58) cover every passthrough branch ofExecute(nil,!JournalingEnabled, missing ledger/journal), so the "refuses an unjournaled boundary" claim holds.- No non-test caller of
PromoteIntegrationStepexists, matching the body.
Design note (low, not a blocker): ExecuteJournaled requires JournalingEnabled(mode), which is true for shadow as well as enforce. In shadow, a failed Ledger.Acquire only logs "shadow fence would have denied" and proceeds with Epoch: 0 (boundary.go:110-125), so the hive-side exclusive-writer fence is advisory there; the real protection is the server-side beforeOid CAS plus the live guard. That is consistent with the comment's "journal-required" wording, but the PR title says "fence … with exact-tested CAS" and the IntegrationPromotionGuard doc says the guard "must revalidate the destination's exclusive writer". When a caller is wired, consider requiring FencingEnabled (enforce) for this effect specifically, or state in the method doc that in shadow the ledger does not withhold. Since nothing calls it yet, this is a follow-up, not a defect in this diff.
The body's scope and its "still required" list match the diff; I agree the no-op refUpdate (beforeOid == afterOid) on the author ref needs a live-API check before any activation — the fake server in the tests cannot prove GitHub accepts it.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the new transport against the tree at 6c45a1c (callers in pkg/convergence/mutation and crux/effects). Looks correct to me; nothing I could verify as a defect.
What I checked:
- No lock inversion in the fsync hook.
Journal.syncPersistenttakesj.mu(journal.go:621) from inside the effect closure inBoundary.ExecuteJournaled(boundary.go:63-66). That is safe becauseExecutor.Executereleases the journal betweenBeginand the effect call (executor.go:106→:121), so the mutex is free when the closure runs. Post-effect sync (boundary.go:70-74) runs afterRecordResultandrelease, so the acknowledgement it syncs is the one the executor just wrote. - Reconcile path matches the boundary's contract. On
ErrNeedsReconciliation,PromoteIntegrationStepreads the destination and passesExternalState{}when it still sits atExpectedSHA(integration_promotion.go:218-224).mutation.Boundary.Reconciletreats!Appliedas "authorize the same logical op to retry" (boundary.go:208-235), and the retry re-sends the identicalbeforeOid, so a stale duplicate cannot overwrite a moved destination. Any other SHA returnsErrIntegrationDestinationChangedwithout touching the journal — the conservative choice. - Mode freeze is real.
frozen.Mode = nilafter resolvingb.Mode()once (boundary.go:52-56) meansfrozen.Executecannot re-evaluate the mode mid-operation;Boundaryholds no mutex ornoCopy, so the value copy is fine. - Logging wrapper is unwrapped consistently.
integrationPromotionJournaleddescends throughLoggingBoundary.Nextbefore checkingReconciler/Lookup/JournaledBoundary, and the outerLoggingBoundaryalso implementsReconcile(effects.go:327) andExecuteJournaled(effects.go:307), so the later type assertions on the outer value succeed. KindBranchUpdateexists andClaim.Validateaccepts therefs/heads/<base>target; changelog fragment name follows theadded-<slug>.mdconvention;docs/integration-orchestration.mddescribes the same-repo fork restriction, the no-op author-ref fence and theExecuteJournaledrefusal exactly as the code does.
One open question, not a defect, and the PR body already names it: whether GitHub's updateRefs accepts a beforeOid == afterOid no-op entry alongside the destination update is a provider-behaviour fact I cannot verify from the tree. The code fails closed either way (a refusal is journaled as Unknown and reconciled before any retry), so nothing here depends on the answer until a lane actually calls PromoteIntegrationStep — which, as stated, none does.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read the new transport against the tree at
Open question, not a finding: Review findings from Conclusion: read What I verified
Open question (not a finding): the author-head fence relies on GitHub accepting a |
There was a problem hiding this comment.
Read the diff against the v5 tree at merge-base 85e9ec7, plus the callers it plugs into. Looks correct to me.
What I verified
src/pkg/convergence/mutation/boundary.go:47-73—ExecuteJournaledfails closed on OFF mode / nil ledger / nil journal / empty journal path, freezesMode()into the copied executor so a mid-operation mode flip cannot change behaviour, and delegates to the existingExecute, so claim acquire/release andErrAlreadyApplied→ idempotent-success (boundary.go:143-157) are reused rather than duplicated.- No deadlock from
syncPersistent()inside the effect closure:Journal.Begin(journal.go:372) releasesj.mubeforeExecutor.Executeruns the effect (executor.go:121), andsyncPersistentonly takesj.mu+ the flock after that. The post-effect sync atboundary.go:67-71runs afterExecutehas already released the claim. src/pkg/github/integration_promotion.go:160-176— the exact-commit check (sha, tree, exactly two parents in order[ExpectedSHA, AuthorHead]) runs before the boundary, and the liveguardruns inside the effect, so a guard refusal is journaledNotAppliedand never leaves anUnknownentry.updateRefsinput shape (repositoryId,refUpdates[].{name,beforeOid,afterOid,force},clientMutationId) matches the GraphQL API; the author-ref no-op entry (beforeOid == afterOid) is the fork-safe fence the body describes, andvalidate()(integration_promotion.go:43) refuses cross-repo heads rather than downgrading.- Reconcile path (
integration_promotion.go:207-234): onlyTestedSHA/ExpectedSHAobservations resolve the journal; anything else returnsErrIntegrationDestinationChangedand leaves the operation unresolved — consistent with "no blind TTL retry". - Nothing outside tests calls
PromoteIntegrationSteporExecuteJournaled— matches the "not wired" claim. ExistingExecuteOFF-mode passthrough is untouched.
One nit (low): the PR body cites "immutable head 6ba38d4e…" but the PR head is 6637e09a…. Worth refreshing the body so the merge guard it describes points at the commit that actually gets merged.
CI at this head is green (all test shards, golangci-lint, gosec, govulncheck). I have not approved — that signature is a maintainer's.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
|
Actual source receipt: Hive App merged this bounded promotion foundation at 2026-10-31T03:19:44Z, squash |
Bounded phase one
Adds the real GitHub atomic promotion transport and deterministic protocol regressions. This is a protocol foundation, not an execution engine completion claim. No current automerge lane calls it; existing OFF/advisory/enforce authoring behavior, tracker, preparation/native presentation, native authority and runtime configuration remain unchanged. No activation or deployment.
Validation
No local tests/builds/guards run, per AGENTS.md. Changed Go files formatted only; canonical CI must supply the verdict. Required and full applicable workflows must be terminal green on immutable head
6637e09a27beefb2b45e6ef1a50b382c2d69c922before a guarded source-only merge.Still required
A real trusted combined-candidate CI producer, durable execution scheduler and separate versioned experimental opt-in, live authority/eligibility wiring, bounded parallel execution and recovery, opt-in tracker diagnostics and comparative benchmark. Conditional no-op provider/protection compatibility requires actual isolated verification before enabling execution. No parity, producer installation or production throughput claim.