Skip to content

Commit 619544b

Browse files
committed
test: mirror the prober's git invocation in the CI diagnostic
The first diagnostic round proved the prober's inline snapshot returns no branch on hosted runners while the fixture's own git calls succeed; capture the mirrored invocation's exit status and stderr to name the cause.
1 parent 2555ee3 commit 619544b

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

programaTests/TabManagerUnitTests.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,11 +618,28 @@ final class TabManagerPullRequestProbeTests: XCTestCase {
618618
) ?? "UNRESOLVED"
619619
let inlineSnapshot = GitMetadataProber.initialWorkspaceGitMetadataSnapshot(for: repoURL.path)
620620
let probePanels = manager.activeWorkspaceGitProbePanelIdsForTesting(workspaceId: backgroundWorkspace.id)
621+
// Mirror the prober's exact invocation and surface status + stderr.
622+
let mirror = Process()
623+
mirror.executableURL = URL(fileURLWithPath: gitPath)
624+
mirror.arguments = ["branch", "--show-current"]
625+
mirror.currentDirectoryURL = repoURL
626+
let mirrorOut = Pipe(); let mirrorErr = Pipe()
627+
mirror.standardOutput = mirrorOut; mirror.standardError = mirrorErr
628+
var mirrorSummary = "spawn-failed"
629+
do {
630+
try mirror.run(); mirror.waitUntilExit()
631+
let out = String(data: mirrorOut.fileHandleForReading.readDataToEndOfFile(), encoding: .utf8) ?? ""
632+
let err = String(data: mirrorErr.fileHandleForReading.readDataToEndOfFile(), encoding: .utf8) ?? ""
633+
mirrorSummary = "status=\(mirror.terminationStatus) stdout=\(out.trimmingCharacters(in: .whitespacesAndNewlines)) stderr=\(err.trimmingCharacters(in: .whitespacesAndNewlines).prefix(300))"
634+
} catch {
635+
mirrorSummary = "spawn error: \(error)"
636+
}
621637
XCTFail(
622638
"branch never arrived. gitPath=\(gitPath) " +
623639
"inlineSnapshot(branch=\(inlineSnapshot.branch ?? "nil"), dirty=\(inlineSnapshot.isDirty)) " +
624640
"modelBranch=\(backgroundWorkspace.panelGitBranches[backgroundPanelId]?.branch ?? "nil") " +
625641
"activeProbes=\(probePanels.count) " +
642+
"mirror[\(mirrorSummary)] " +
626643
"bgWorkspaceDir=\(backgroundWorkspace.currentDirectory ?? "nil") repo=\(repoURL.path)"
627644
)
628645
}

0 commit comments

Comments
 (0)