2.3 KiB
2.3 KiB
spec, created, status
| spec | created | status |
|---|---|---|
| docs/specs/integrations/requirements/github-authentication.md | 2026-08-07 | done |
Implementation Plan: GitHub CLI account stderr fallback
Overview
Update the host gh account command runner so a successful command with an empty
stdout can return its stderr report to the existing legacy account parser. Keep
non-empty stdout authoritative, preserving JSON account discovery and token
resolution behavior. Add a regression test at the real subprocess boundary.
Backend
Successful command output selection
apps/backend/internal/github/gh_accounts.go,systemGHAccountRunner.Run: on a successfulghcommand, return stdout when it contains non-whitespace; if stdout is empty, return stderr. Preserve existing cancellation, timeout, and non-zero exit handling.
Tests
- What: A legacy
gh auth statuscommand that exits successfully and emits its report only on stderr is parsed into the expectedGHAccount. File:apps/backend/internal/github/gh_accounts_test.go. How: Use a temporary executable namedghonPATH, make structured status fail with an unsupported-flag exit, emit legacy status on stderr, and calllistGHAccountswithsystemGHAccountRunner. - What: Existing JSON, legacy stdout, token, and environment-sanitization
behaviors remain green. File: existing tests in
apps/backend/internal/github/gh_accounts_test.go. How: run the focused package test selection and the package's full test suite.
Verification Results
- RED:
rtk go test ./internal/github -run TestSystemGHAccountRunnerUsesStderrWhenStdoutEmpty -count=1failed withunsupported gh auth status outputbefore the production change. - GREEN: the same regression test passed after the fallback was added.
- Focused:
rtk go test ./internal/github -run 'Test(ListGHAccounts|ResolveGHAccountToken|GitHubCLIEnvironment|SystemGHAccountRunner)' -count=1passed 12 tests. - Full package:
rtk go test ./internal/github -count=1passed 1,092 tests. rtk git diff --checkpassed.
Implementation Waves And Parallel Candidates
Wave 1 (sequential):
No parallel-safe tasks: the production runner and its regression test share one behavioral boundary.
Open Questions
None.