@@ -181,9 +181,23 @@ async function findFirstContinuableListAddress(
181181 stateDir ,
182182 ) ;
183183 if ( probe . result . code !== 0 || probe . envelope . ok !== true ) continue ;
184- if ( readNestedBoolean ( probe . envelope . data , 'canContinue' ) === true ) {
185- return address ;
186- }
184+ if ( readNestedBoolean ( probe . envelope . data , 'canContinue' ) !== true ) continue ;
185+
186+ // Validate with the actual mutation command to avoid optimistic can* probes
187+ // that may still fail in some fixture/environment combinations.
188+ const verify = await harness . runCli (
189+ [
190+ 'lists' ,
191+ 'continue-previous' ,
192+ docPath ,
193+ '--target-json' ,
194+ JSON . stringify ( address ) ,
195+ '--out' ,
196+ harness . createOutputPath ( 'doc-lists-continue-previous-verify' ) ,
197+ ] ,
198+ stateDir ,
199+ ) ;
200+ if ( verify . result . code === 0 && verify . envelope . ok === true ) return address ;
187201 }
188202 return null ;
189203}
@@ -203,9 +217,23 @@ async function findFirstJoinableWithPreviousAddress(
203217 stateDir ,
204218 ) ;
205219 if ( probe . result . code !== 0 || probe . envelope . ok !== true ) continue ;
206- if ( readNestedBoolean ( probe . envelope . data , 'canJoin' ) === true ) {
207- return address ;
208- }
220+ if ( readNestedBoolean ( probe . envelope . data , 'canJoin' ) !== true ) continue ;
221+
222+ // Validate with the actual mutation command to avoid optimistic can* probes
223+ // that may still fail in some fixture/environment combinations.
224+ const verify = await harness . runCli (
225+ [
226+ 'lists' ,
227+ 'join' ,
228+ docPath ,
229+ '--input-json' ,
230+ JSON . stringify ( { target : address , direction : 'withPrevious' } ) ,
231+ '--out' ,
232+ harness . createOutputPath ( 'doc-lists-join-verify' ) ,
233+ ] ,
234+ stateDir ,
235+ ) ;
236+ if ( verify . result . code === 0 && verify . envelope . ok === true ) return address ;
209237 }
210238 return null ;
211239}
0 commit comments