@@ -196,6 +196,158 @@ test('runReleaseConductor blocks apply when release conductor flag is disabled',
196196 assert . equal ( commandCalls . some ( ( entry ) => entry . command === 'git' && entry . args [ 0 ] === 'tag' ) , false ) ;
197197} ) ;
198198
199+ test ( 'runReleaseConductor keeps dry-run proposal-only when queue evidence is missing and no recent success exists' , async ( ) => {
200+ const readJsonOptionalFn = async ( filePath ) => {
201+ const normalized = String ( filePath ) ;
202+ if ( normalized . includes ( 'queue-supervisor-report.json' ) ) {
203+ return {
204+ exists : false ,
205+ error : null ,
206+ path : filePath ,
207+ payload : null
208+ } ;
209+ }
210+ return {
211+ exists : true ,
212+ error : null ,
213+ path : filePath ,
214+ payload : {
215+ schema : 'priority/policy-live-state@v1' ,
216+ generatedAt : '2026-03-06T10:00:00Z' ,
217+ state : { }
218+ }
219+ } ;
220+ } ;
221+
222+ const runGhJsonFn = ( args ) => {
223+ if ( args [ 0 ] !== 'api' ) {
224+ throw new Error ( `unexpected gh args: ${ args . join ( ' ' ) } ` ) ;
225+ }
226+ return {
227+ workflow_runs : [
228+ {
229+ id : 1 ,
230+ status : 'completed' ,
231+ conclusion : 'success' ,
232+ updated_at : '2026-03-06T09:00:00Z'
233+ }
234+ ]
235+ } ;
236+ } ;
237+
238+ const { report, exitCode } = await runReleaseConductor ( {
239+ repoRoot : process . cwd ( ) ,
240+ now : new Date ( '2026-03-06T12:00:00.000Z' ) ,
241+ args : {
242+ apply : false ,
243+ dryRun : true ,
244+ reportPath : 'tests/results/_agent/release/release-conductor-report.json' ,
245+ queueReportPath : 'tests/results/_agent/queue/queue-supervisor-report.json' ,
246+ policySnapshotPath : 'tests/results/_agent/policy/policy-state-snapshot.json' ,
247+ repo : 'owner/repo' ,
248+ stream : 'comparevi-cli' ,
249+ channel : 'stable' ,
250+ version : '0.8.0' ,
251+ dwellMinutes : 60 ,
252+ quarantineStaleHours : 24 ,
253+ help : false
254+ } ,
255+ environment : {
256+ GITHUB_REPOSITORY : 'owner/repo' ,
257+ RELEASE_CONDUCTOR_ENABLED : '0'
258+ } ,
259+ runGhJsonFn,
260+ runCommandFn : ( ) => ( { status : 0 , stdout : '' , stderr : '' } ) ,
261+ readJsonOptionalFn,
262+ writeReportFn : async ( reportPath ) => reportPath
263+ } ) ;
264+
265+ assert . equal ( exitCode , 0 ) ;
266+ assert . equal ( report . decision . status , 'pass' ) ;
267+ assert . equal ( report . release . proposalOnly , true ) ;
268+ assert . equal ( report . gates . greenDwell . status , 'fail' ) ;
269+ assert . equal ( report . gates . queueHealth . status , 'fail' ) ;
270+ assert . equal ( report . gates . quarantine . status , 'fail' ) ;
271+ assert . equal ( report . decision . blockerCount , 0 ) ;
272+ assert . ok ( report . decision . advisories . some ( ( entry ) => entry . code === 'green-dwell-no-recent-success' ) ) ;
273+ assert . ok ( report . decision . advisories . some ( ( entry ) => entry . code === 'queue-report-unavailable-dry-run' ) ) ;
274+ } ) ;
275+
276+ test ( 'runReleaseConductor still blocks dry-run when the dwell window contains workflow failures' , async ( ) => {
277+ const readJsonOptionalFn = async ( filePath ) => {
278+ const normalized = String ( filePath ) ;
279+ if ( normalized . includes ( 'queue-supervisor-report.json' ) ) {
280+ return {
281+ exists : true ,
282+ error : null ,
283+ path : filePath ,
284+ payload : {
285+ paused : false ,
286+ throughputController : { mode : 'healthy' } ,
287+ retryHistory : { }
288+ }
289+ } ;
290+ }
291+ return {
292+ exists : true ,
293+ error : null ,
294+ path : filePath ,
295+ payload : {
296+ schema : 'priority/policy-live-state@v1' ,
297+ generatedAt : '2026-03-06T10:00:00Z' ,
298+ state : { }
299+ }
300+ } ;
301+ } ;
302+
303+ const runGhJsonFn = ( args ) => {
304+ if ( args [ 0 ] !== 'api' ) {
305+ throw new Error ( `unexpected gh args: ${ args . join ( ' ' ) } ` ) ;
306+ }
307+ return {
308+ workflow_runs : [
309+ {
310+ id : 1 ,
311+ status : 'completed' ,
312+ conclusion : 'failure' ,
313+ updated_at : '2026-03-06T11:45:00Z'
314+ }
315+ ]
316+ } ;
317+ } ;
318+
319+ const { report, exitCode } = await runReleaseConductor ( {
320+ repoRoot : process . cwd ( ) ,
321+ now : new Date ( '2026-03-06T12:00:00.000Z' ) ,
322+ args : {
323+ apply : false ,
324+ dryRun : true ,
325+ reportPath : 'tests/results/_agent/release/release-conductor-report.json' ,
326+ queueReportPath : 'tests/results/_agent/queue/queue-supervisor-report.json' ,
327+ policySnapshotPath : 'tests/results/_agent/policy/policy-state-snapshot.json' ,
328+ repo : 'owner/repo' ,
329+ stream : 'comparevi-cli' ,
330+ channel : 'stable' ,
331+ version : '0.8.0' ,
332+ dwellMinutes : 60 ,
333+ quarantineStaleHours : 24 ,
334+ help : false
335+ } ,
336+ environment : {
337+ GITHUB_REPOSITORY : 'owner/repo' ,
338+ RELEASE_CONDUCTOR_ENABLED : '0'
339+ } ,
340+ runGhJsonFn,
341+ runCommandFn : ( ) => ( { status : 0 , stdout : '' , stderr : '' } ) ,
342+ readJsonOptionalFn,
343+ writeReportFn : async ( reportPath ) => reportPath
344+ } ) ;
345+
346+ assert . equal ( exitCode , 1 ) ;
347+ assert . equal ( report . decision . status , 'fail' ) ;
348+ assert . ok ( report . decision . blockers . some ( ( entry ) => entry . code === 'green-dwell-failed' ) ) ;
349+ } ) ;
350+
199351test ( 'runReleaseConductor creates signed tag when apply is enabled and signing key is available' , async ( ) => {
200352 const readJsonOptionalFn = async ( filePath ) => {
201353 const normalized = String ( filePath ) ;
@@ -351,4 +503,4 @@ test('runReleaseConductor stays proposal-only when signing material is unavailab
351503 assert . equal ( report . release . proposalOnly , true ) ;
352504 assert . equal ( report . release . tagCreated , false ) ;
353505 assert . equal ( commandCalls . some ( ( entry ) => entry . command === 'git' && entry . args [ 0 ] === 'tag' ) , false ) ;
354- } ) ;
506+ } ) ;
0 commit comments