Skip to content

fix(update): detect Windows GGA shims#300

Open
IrrealV wants to merge 2 commits intoGentleman-Programming:mainfrom
IrrealV:fix/windows-gga-detection
Open

fix(update): detect Windows GGA shims#300
IrrealV wants to merge 2 commits intoGentleman-Programming:mainfrom
IrrealV:fix/windows-gga-detection

Conversation

@IrrealV
Copy link
Copy Markdown
Contributor

@IrrealV IrrealV commented Apr 13, 2026

🔗 Linked Issue

Closes #177


🏷️ PR Type

  • type:bug — Bug fix (non-breaking change that fixes an issue)
  • type:feature — New feature (non-breaking change that adds functionality)
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no functional changes)
  • type:chore — Build, CI, or tooling changes
  • type:breaking-change — Breaking change (fix or feature that changes existing behavior)

📝 Summary

  • Fix Windows GGA detection so shim-based installs are recognized even when LookPath("gga") fails.
  • Keep update detection consistent with availability checks on Windows.
  • Add focused tests for Windows shim paths plus an integrated update-flow assertion.

📂 Changes

File / Area What Changed
internal/cli/run.go Windows ggaAvailable() now checks ~/bin/gga.ps1, ~/bin/gga.exe, and ~/bin/gga.
internal/update/detect.go Windows shim detection returns unknown instead of treating GGA as missing.
internal/update/check_test.go Added low-level and integrated Windows shim coverage for update status.
internal/cli/gga_available_test.go Added Windows gga.ps1 and gga.exe availability tests.

🧪 Test Plan

Unit Tests

go test ./...

E2E Tests (Docker required)

cd e2e && ./docker-test.sh
  • Unit tests pass (go test ./...)
  • E2E tests pass (cd e2e && ./docker-test.sh)
  • Manually tested locally

🤖 Automated Checks

The following checks run automatically on this PR:

Check Status Description
Check Issue Reference PR body must contain Closes/Fixes/Resolves #N
Check Issue Has status:approved Linked issue must have been approved before work began
Check PR Has type:* Label Exactly one type:* label must be applied
Unit Tests go test ./... must pass
E2E Tests cd e2e && ./docker-test.sh must pass

✅ Contributor Checklist

  • PR is linked to an issue with status:approved
  • I have added the appropriate type:* label to this PR
  • Unit tests pass (go test ./...)
  • E2E tests pass (cd e2e && ./docker-test.sh)
  • I have updated documentation if necessary
  • My commits follow Conventional Commits format
  • My commits do not include Co-Authored-By trailers

💬 Notes for Reviewers

This is a narrowly scoped Windows-only fix. The update path now has an integrated test proving GGA remains visible when only the Windows shim exists.

Copilot AI review requested due to automatic review settings April 13, 2026 23:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Windows-specific GGA installation detection so shim-based installs are treated as present during both availability checks and update checks (closing #177).

Changes:

  • Extend Windows ggaAvailable() detection to include ~/bin/gga.ps1 and ~/bin/gga.exe (in addition to ~/bin/gga).
  • Adjust update version detection to return an “unknown” installed version for Windows shim installs instead of treating GGA as missing.
  • Add unit + integrated update-flow tests covering Windows shim presence.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
internal/update/detect.go Adds Windows shim filesystem detection and returns "unknown" when LookPath("gga") fails but a shim exists.
internal/update/check_test.go Adds targeted tests for Windows shim detection and an integrated CheckFiltered assertion for GGA visibility/status.
internal/cli/run.go Expands Windows GGA availability checks to include .ps1 and .exe shims under ~/bin.
internal/cli/gga_available_test.go Adds Windows-specific tests ensuring ggaAvailable() detects gga.ps1 and gga.exe shims.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/update/detect.go
Comment on lines 55 to 69

cmd := execCommand(tool.DetectCmd[0], tool.DetectCmd[1:]...)

// Kill the subprocess when the context fires. We use a goroutine because
// the testable execCommand var returns a plain *exec.Cmd (not CommandContext).
done := make(chan struct{})
go func() {
select {
case <-detectCtx.Done():
if cmd.Process != nil {
_ = cmd.Process.Kill()
}
case <-done:
}
}()
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Windows shim filename list ("gga.ps1", "gga.exe", "gga") is duplicated here and in cli.ggaAvailable(). This increases drift risk (one side updated without the other). Consider extracting the shim names / path-check logic into a shared helper or constant and reusing it from both call sites.

Copilot uses AI. Check for mistakes.
Comment on lines +198 to +200

results := CheckFiltered(context.Background(), "1.0.0", system.PlatformProfile{OS: "windows", PackageManager: "winget", Supported: true}, []string{"gga"})
if len(results) != 1 {
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final assertion if results[0].Status == NotInstalled is redundant because the test already asserts results[0].Status != VersionUnknown / == VersionUnknown just above. Consider removing the redundant check to keep the test focused on a single expectation.

Suggested change
results := CheckFiltered(context.Background(), "1.0.0", system.PlatformProfile{OS: "windows", PackageManager: "winget", Supported: true}, []string{"gga"})
if len(results) != 1 {

Copilot uses AI. Check for mistakes.
@IrrealV
Copy link
Copy Markdown
Contributor Author

IrrealV commented Apr 13, 2026

Resolví el conflicto trayendo la rama al día con main y conservando ambos cambios en internal/update/check_test.go: el test de Windows shim para GGA y el test de parseVersionFromOutput(engram dev). Después corrí gofmt y go test ./... y volví a pushear la rama actualizada.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No instala Engram ni GGA en Windows

2 participants