@@ -556,10 +556,10 @@ func (s *Service) recoverSingleApplyOperation(ctx context.Context, driverID int,
556556 return
557557 }
558558
559- // The check refresh request depends only on the apply settling to terminal
559+ // The merge gate request depends only on the apply settling to terminal
560560 // success; record it before control-request cleanup so a cleanup error
561561 // cannot suppress it.
562- s .recordCheckRefreshIfApplyResolved (applyLeaseCtx , driverID , finalApply .ID )
562+ s .recordMergeGateIfApplyResolved (applyLeaseCtx , driverID , finalApply .ID )
563563
564564 // If the derived state above settled the apply terminally and a stop or
565565 // cancel is still pending, complete it now so the request does not linger
@@ -738,10 +738,10 @@ func (s *Service) driveClaimedMultiOperation(ctx context.Context, driverID int,
738738 // error must not suppress it.
739739 s .publishTerminalSummaryIfWon (operationLeaseCtx , driverID , finalApply , result )
740740
741- // Like the terminal summary, the check refresh request depends only on the
741+ // Like the terminal summary, the merge gate request depends only on the
742742 // apply settling to terminal success; record it before control-request
743743 // cleanup so a cleanup error cannot suppress it.
744- s .recordCheckRefreshIfApplyResolved (operationLeaseCtx , driverID , finalApply .ID )
744+ s .recordMergeGateIfApplyResolved (operationLeaseCtx , driverID , finalApply .ID )
745745
746746 if err := s .completePendingControlRequestsIfApplyResolved (operationLeaseCtx , driverID , finalApply .ID ); err != nil {
747747 s .logger .Error ("operator: failed to complete pending control requests for resolved apply" ,
@@ -914,11 +914,11 @@ func (s *Service) recoverApplyPendingStop(ctx context.Context, driverID int, own
914914 // summary; publish it if this projection won the terminal swap.
915915 s .publishTerminalSummaryIfWon (applyLeaseCtx , driverID , finalApply , result )
916916
917- // Like the terminal summary, the check refresh request depends only on the
917+ // Like the terminal summary, the merge gate request depends only on the
918918 // apply settling to terminal success (the data-plane apply can complete
919919 // while a stop was requested); record it before control-request cleanup so
920920 // a cleanup error cannot suppress it.
921- s .recordCheckRefreshIfApplyResolved (applyLeaseCtx , driverID , finalApply .ID )
921+ s .recordMergeGateIfApplyResolved (applyLeaseCtx , driverID , finalApply .ID )
922922
923923 if err := s .completePendingControlRequestsIfApplyResolved (applyLeaseCtx , driverID , finalApply .ID ); err != nil {
924924 s .logger .Error ("operator: failed to complete pending control requests after stop reconciliation" ,
@@ -1019,83 +1019,83 @@ func (s *Service) completePendingRequestForResolvedApply(ctx context.Context, dr
10191019 return nil
10201020}
10211021
1022- // hasCheckRefreshConsumer reports whether a check refresh consumer — the
1023- // webhook handler's refresh processor — exists on this server. The handler
1024- // registers OnCheckRefreshRecorded at construction, so a nil callback means
1022+ // hasMergeGateConsumer reports whether a merge gate consumer — the
1023+ // webhook handler's merge gate processor — exists on this server. The handler
1024+ // registers OnMergeGateRecorded at construction, so a nil callback means
10251025// no GitHub runtime is configured: no PR check state to refresh and no
10261026// processor to drain requests.
1027- func (s * Service ) hasCheckRefreshConsumer () bool {
1028- return s .OnCheckRefreshRecorded != nil
1027+ func (s * Service ) hasMergeGateConsumer () bool {
1028+ return s .OnMergeGateRecorded != nil
10291029}
10301030
1031- // recordCheckRefreshIfApplyResolved records a durable check refresh request
1031+ // recordMergeGateIfApplyResolved records a durable merge gate request
10321032// once the apply has settled to terminal success. A completed apply —
10331033// including a completed rollback — changes the live schema of its
10341034// (environment, database type, database) target, which stales the stored plan
10351035// check state of every other open PR planning against that target. The check
1036- // refresh processor consumes the durable request to re-plan those PRs. The
1036+ // merge gate processor consumes the durable request to re-plan those PRs. The
10371037// apply is reloaded because the derived-state write operates on a copy and
10381038// does not mutate the caller's row. Recording is idempotent (one request per
10391039// apply) and never fails the drive tail: errors are logged and counted, and
10401040// the backstop sweep over recently completed applies re-records anything
1041- // missed here. No-op on a server with no check refresh consumer (no GitHub
1041+ // missed here. No-op on a server with no merge gate consumer (no GitHub
10421042// runtime configured) and for every settled state other than terminal
10431043// success — only terminal success mutates the target schema.
1044- func (s * Service ) recordCheckRefreshIfApplyResolved (ctx context.Context , driverID int , applyID int64 ) {
1045- if ! s .hasCheckRefreshConsumer () {
1044+ func (s * Service ) recordMergeGateIfApplyResolved (ctx context.Context , driverID int , applyID int64 ) {
1045+ if ! s .hasMergeGateConsumer () {
10461046 // Without a GitHub webhook runtime this server has no PR check state
10471047 // to refresh and no processor to drain requests, so a recorded row
10481048 // would sit pending forever.
1049- s .logger .Debug ("operator: no check refresh consumer registered (GitHub is not configured on this server); skipping check refresh recording" ,
1049+ s .logger .Debug ("operator: no merge gate consumer registered (GitHub is not configured on this server); skipping merge gate recording" ,
10501050 "driver" , driverID )
10511051 return
10521052 }
10531053 apply , err := s .storage .Applies ().Get (ctx , applyID )
10541054 if err != nil {
1055- s .logger .Error ("operator: failed to reload apply before recording check refresh request; the backstop sweep will record it" ,
1055+ s .logger .Error ("operator: failed to reload apply before recording merge gate request; the backstop sweep will record it" ,
10561056 "driver" , driverID , "error" , fmt .Errorf ("reload apply %d: %w" , applyID , err ))
10571057 return
10581058 }
10591059 if apply == nil {
1060- s .logger .Error ("operator: apply not found while recording check refresh request; no refresh will be recorded " ,
1060+ s .logger .Error ("operator: apply not found while recording merge gate request; sibling checks will not be re-planned " ,
10611061 "driver" , driverID , "error" , fmt .Errorf ("reload apply %d: %w" , applyID , storage .ErrApplyNotFound ))
10621062 return
10631063 }
10641064 if ! state .IsState (apply .State , state .Apply .Completed ) {
10651065 // Only terminal success mutates the target schema; every other outcome
10661066 // (still running, stopped, cancelled, failed, reverted) leaves sibling
10671067 // plan checks accurate.
1068- s .logger .Debug ("operator: apply did not settle to terminal success; no check refresh recorded" ,
1068+ s .logger .Debug ("operator: apply did not settle to terminal success; no merge gate recorded" ,
10691069 append (apply .LogAttrs (), "driver" , driverID )... )
10701070 return
10711071 }
10721072
1073- recorded , err := s .storage .CheckRefreshRequests ().Record (ctx , & storage.CheckRefreshRequest {
1073+ recorded , err := s .storage .MergeGateRequests ().Record (ctx , & storage.MergeGateRequest {
10741074 ApplyID : apply .ID ,
10751075 ApplyIdentifier : apply .ApplyIdentifier ,
10761076 Environment : apply .Environment ,
10771077 DatabaseType : apply .DatabaseType ,
10781078 DatabaseName : apply .Database ,
10791079 Repository : apply .Repository ,
1080- PullRequest : apply .PullRequest ,
1080+ ChangeKey : storage . ChangeKeyForPullRequest ( apply .PullRequest ) ,
10811081 RequestedBy : apply .Caller ,
10821082 })
10831083 if err != nil {
1084- s .logger .Error ("operator: failed to record check refresh request for completed apply; sibling PR checks stay stale until the backstop sweep records it" ,
1084+ s .logger .Error ("operator: failed to record merge gate request for completed apply; sibling PR checks stay stale until the backstop sweep records it" ,
10851085 append (apply .LogAttrs (), "driver" , driverID , "error" , err )... )
1086- metrics .RecordCheckRefreshRecordFailure (ctx , apply .Database , apply .Environment )
1086+ metrics .RecordMergeGateRecordFailure (ctx , apply .Database , apply .Environment )
10871087 return
10881088 }
10891089 if ! recorded {
1090- s .logger .Debug ("operator: check refresh request already recorded for completed apply" ,
1090+ s .logger .Debug ("operator: merge gate request already recorded for completed apply" ,
10911091 append (apply .LogAttrs (), "driver" , driverID )... )
10921092 return
10931093 }
1094- s .logger .Info ("operator: recorded check refresh request for completed apply; sibling PR checks against the target will be re-planned" ,
1094+ s .logger .Info ("operator: recorded merge gate request for completed apply; sibling PR checks against the target will be re-planned" ,
10951095 append (apply .LogAttrs (), "driver" , driverID )... )
1096- metrics .RecordCheckRefreshRecorded (ctx , apply .Database , apply .Environment , metrics .CheckRefreshSourceDriveTail )
1096+ metrics .RecordMergeGateRecorded (ctx , apply .Database , apply .Environment , metrics .MergeGateSourceDriveTail )
10971097 // Non-nil by the consumer gate above; wake the processor to drain now.
1098- s .OnCheckRefreshRecorded ()
1098+ s .OnMergeGateRecorded ()
10991099}
11001100
11011101// reconcileUnclaimableParent handles a claimed operation whose parent apply
0 commit comments