@@ -100,6 +100,64 @@ test.describe('orchestrator/scheduling/registry (#11862 Sub 18)', () => {
100100 } ) ) . toBeNull ( ) ;
101101 } ) ;
102102
103+ test ( 'githubWorkflowSync cadence uses terminal timestamp before start timestamp (#13832)' , ( ) => {
104+ const descriptor = TASK_REGISTRY . find ( d => d . taskName === 'githubWorkflowSync' ) ;
105+ expect ( descriptor , 'githubWorkflowSync is registered' ) . toBeTruthy ( ) ;
106+
107+ expect ( descriptor . getDueTask ( {
108+ state : {
109+ githubWorkflowSync : {
110+ lastRunAt : 0 ,
111+ lastSuccessAt : new Date ( 1200 ) . toISOString ( )
112+ }
113+ } ,
114+ now : 1800 ,
115+ intervals : { githubWorkflowSync : 1000 } ,
116+ enables : { githubWorkflowSync : true }
117+ } ) ) . toBeNull ( ) ;
118+
119+ expect ( descriptor . getDueTask ( {
120+ state : {
121+ githubWorkflowSync : {
122+ lastRunAt : 0 ,
123+ lastSuccessAt : new Date ( 1200 ) . toISOString ( )
124+ }
125+ } ,
126+ now : 2200 ,
127+ intervals : { githubWorkflowSync : 1000 } ,
128+ enables : { githubWorkflowSync : true }
129+ } ) ) . toMatchObject ( { taskName : 'githubWorkflowSync' , source : 'periodic-sync' } ) ;
130+ } ) ;
131+
132+ test ( 'githubWorkflowSync failed terminal attempts also cool down retries (#13832)' , ( ) => {
133+ const descriptor = TASK_REGISTRY . find ( d => d . taskName === 'githubWorkflowSync' ) ;
134+ expect ( descriptor , 'githubWorkflowSync is registered' ) . toBeTruthy ( ) ;
135+
136+ expect ( descriptor . getDueTask ( {
137+ state : {
138+ githubWorkflowSync : {
139+ lastRunAt : 0 ,
140+ lastErrorAt : new Date ( 1200 ) . toISOString ( )
141+ }
142+ } ,
143+ now : 1800 ,
144+ intervals : { githubWorkflowSync : 1000 } ,
145+ enables : { githubWorkflowSync : true }
146+ } ) ) . toBeNull ( ) ;
147+
148+ expect ( descriptor . getDueTask ( {
149+ state : {
150+ githubWorkflowSync : {
151+ lastRunAt : 0 ,
152+ lastErrorAt : new Date ( 1200 ) . toISOString ( )
153+ }
154+ } ,
155+ now : 2200 ,
156+ intervals : { githubWorkflowSync : 1000 } ,
157+ enables : { githubWorkflowSync : true }
158+ } ) ) . toMatchObject ( { taskName : 'githubWorkflowSync' , source : 'periodic-sync' } ) ;
159+ } ) ;
160+
103161 test ( 'continuous tasks (chroma/bridgeDaemon/mlx) are intentionally NOT in registry' , ( ) => {
104162 const names = TASK_REGISTRY . map ( d => d . taskName ) ;
105163 expect ( names ) . not . toContain ( 'chroma' ) ;
0 commit comments