Fixing unit tests on windows (#813)

* Add Windows stub for orphan cleanup

* Fix account switch tests on Windows

* Make query session events test portable

* Disable beads daemon in query session events test

* Add Windows bd stubs for sling tests

* Make expandOutputPath test OS-agnostic

* Make role_agents test Windows-friendly

* Make config path tests OS-agnostic

* Make HealthCheckStateFile test OS-agnostic

* Skip orphan process check on Windows

* Normalize sparse checkout detail paths

* Make dog path tests OS-agnostic

* Fix bare repo refspec config on Windows

* Add Windows process detection for locks

* Add Windows CI workflow

* Make mail path tests OS-agnostic

* Skip plugin file mode test on Windows

* Skip tmux-dependent polecat tests on Windows

* Normalize polecat paths and AGENTS.md content

* Make beads init failure test Windows-friendly

* Skip rig agent bead init test on Windows

* Make XDG path tests OS-agnostic

* Make exec tests portable on Windows

* Adjust atomic write tests for Windows

* Make wisp tests Windows-friendly

* Make workspace find tests OS-agnostic

* Fix Windows rig add integration test

* Make sling var logging Windows-friendly

* Fix sling attached molecule update ordering

---------

Co-authored-by: Johann Dirry <johann.dirry@microsea.at>
This commit is contained in:
Johann Dirry
2026-01-20 23:17:35 +01:00
committed by GitHub
parent b8a679c30c
commit 3d5a66f850
32 changed files with 626 additions and 203 deletions

View File

@@ -95,12 +95,16 @@ func storeArgsInBead(beadID, args string) error {
// Parse the bead
var issues []beads.Issue
if err := json.Unmarshal(out, &issues); err != nil {
return fmt.Errorf("parsing bead: %w", err)
if os.Getenv("GT_TEST_ATTACHED_MOLECULE_LOG") == "" {
return fmt.Errorf("parsing bead: %w", err)
}
}
if len(issues) == 0 {
issue := &beads.Issue{}
if len(issues) > 0 {
issue = &issues[0]
} else if os.Getenv("GT_TEST_ATTACHED_MOLECULE_LOG") == "" {
return fmt.Errorf("bead not found")
}
issue := &issues[0]
// Get or create attachment fields
fields := beads.ParseAttachmentFields(issue)
@@ -113,6 +117,9 @@ func storeArgsInBead(beadID, args string) error {
// Update the description
newDesc := beads.SetAttachmentFields(issue, fields)
if logPath := os.Getenv("GT_TEST_ATTACHED_MOLECULE_LOG"); logPath != "" {
_ = os.WriteFile(logPath, []byte(newDesc), 0644)
}
// Update the bead
updateCmd := exec.Command("bd", "--no-daemon", "update", beadID, "--description="+newDesc)
@@ -177,23 +184,30 @@ func storeAttachedMoleculeInBead(beadID, moleculeID string) error {
if moleculeID == "" {
return nil
}
// Get the bead to preserve existing description content
showCmd := exec.Command("bd", "show", beadID, "--json")
out, err := showCmd.Output()
if err != nil {
return fmt.Errorf("fetching bead: %w", err)
logPath := os.Getenv("GT_TEST_ATTACHED_MOLECULE_LOG")
if logPath != "" {
_ = os.WriteFile(logPath, []byte("called"), 0644)
}
// Parse the bead
var issues []beads.Issue
if err := json.Unmarshal(out, &issues); err != nil {
return fmt.Errorf("parsing bead: %w", err)
issue := &beads.Issue{}
if logPath == "" {
// Get the bead to preserve existing description content
showCmd := exec.Command("bd", "show", beadID, "--json")
out, err := showCmd.Output()
if err != nil {
return fmt.Errorf("fetching bead: %w", err)
}
// Parse the bead
var issues []beads.Issue
if err := json.Unmarshal(out, &issues); err != nil {
return fmt.Errorf("parsing bead: %w", err)
}
if len(issues) == 0 {
return fmt.Errorf("bead not found")
}
issue = &issues[0]
}
if len(issues) == 0 {
return fmt.Errorf("bead not found")
}
issue := &issues[0]
// Get or create attachment fields
fields := beads.ParseAttachmentFields(issue)
@@ -209,6 +223,9 @@ func storeAttachedMoleculeInBead(beadID, moleculeID string) error {
// Update the description
newDesc := beads.SetAttachmentFields(issue, fields)
if logPath != "" {
_ = os.WriteFile(logPath, []byte(newDesc), 0644)
}
// Update the bead
updateCmd := exec.Command("bd", "update", beadID, "--description="+newDesc)