@@ -23,6 +23,7 @@ import * as Schema from "effect/Schema";
2323import * as Sink from "effect/Sink" ;
2424import * as Stream from "effect/Stream" ;
2525import * as TestClock from "effect/testing/TestClock" ;
26+ import * as Tracer from "effect/Tracer" ;
2627import { ChildProcess , ChildProcessSpawner , CommandLine } from "effect/process" ;
2728
2829import {
@@ -4001,6 +4002,44 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
40014002 } ) ,
40024003 ) ;
40034004
4005+ it . effect ( "records no failed span reading status of a repository without a remote" , ( ) =>
4006+ Effect . gen ( function * ( ) {
4007+ const cwd = yield * makeTmpDir ( ) ;
4008+ yield * initRepoWithCommit ( cwd ) ;
4009+ yield * git ( cwd , [ "checkout" , "-b" , "feature" ] ) ;
4010+ const driver = yield * GitVcsDriver . GitVcsDriver ;
4011+ const spans : Array < Tracer . NativeSpan > = [ ] ;
4012+ const tracer = Tracer . make ( {
4013+ span : ( options ) => {
4014+ const span = new Tracer . NativeSpan ( options ) ;
4015+ spans . push ( span ) ;
4016+ return span ;
4017+ } ,
4018+ } ) ;
4019+ const traced = < A , E > ( effect : Effect . Effect < A , E > ) =>
4020+ Effect . gen ( function * ( ) {
4021+ spans . length = 0 ;
4022+ const exit = yield * effect . pipe ( Effect . withTracer ( tracer ) , Effect . exit ) ;
4023+ const failedSpans = spans . flatMap ( ( span ) =>
4024+ span . status . _tag === "Ended" && Exit . isFailure ( span . status . exit ) ? [ span . name ] : [ ] ,
4025+ ) ;
4026+ return { exit, failedSpans } ;
4027+ } ) ;
4028+
4029+ const status = yield * traced ( driver . statusDetailsRemote ( cwd ) ) ;
4030+ assert . isTrue ( Exit . isSuccess ( status . exit ) ) ;
4031+ assert . deepStrictEqual ( status . failedSpans , [ ] ) ;
4032+
4033+ // A caller that needs a remote still fails, in its own span.
4034+ const fetch = yield * traced ( driver . fetchRefCommit ( { cwd, ref : "refs/pull/1/head" } ) ) ;
4035+ assert . include (
4036+ Exit . isFailure ( fetch . exit ) ? Cause . pretty ( fetch . exit . cause ) : "" ,
4037+ "No git remote is configured for this repository." ,
4038+ ) ;
4039+ assert . deepStrictEqual ( fetch . failedSpans , [ "GitVcsDriver.fetchRefCommit" ] ) ;
4040+ } ) ,
4041+ ) ;
4042+
40044043 it . effect ( "can read cached remote divergence without fetching upstream" , ( ) =>
40054044 Effect . gen ( function * ( ) {
40064045 const cwd = yield * makeTmpDir ( ) ;
0 commit comments