Repository navigation
Description
Describe the bug
Repository and Codespaces listing errors can be swallowed, causing command modules to delete the cached credentials and call an undefined main(). Batch mutation loops also swallow authentication and scope failures, can continue after a token-wide failure, and leave a successful process exit status after failed operations. Codespace deletion additionally expects HTTP 204 even though GitHub returns HTTP 202; this is currently masked because callers ignore the returned boolean.
To Reproduce
Steps to reproduce the behavior:
- Run
ghpew reposorghpew codespacesand cause a generic listing failure such as a network error or HTTP 500. - Observe that the cached configuration is deleted and the command reports
ReferenceError: main is not definedinstead of the original error. - Alternatively, run a batch mutation where one item fails or the token lacks the required scope.
- Observe that token-wide failures are handled as per-item failures and the process can still exit successfully.
Expected behavior
- Listing failures preserve the original error and do not delete cached credentials unless the failure is specifically authentication-related.
- Resolved mutation requests are treated as successful for any valid 2xx response, including HTTP 202 for Codespace deletion.
- Ordinary per-item failures may be reported while processing continues.
- Authentication or scope failures abort the remaining batch without automatically replaying already attempted mutations.
- Any failed mutation produces a nonzero process exit status.
- Focused regression tests cover these contracts without coupling to ANSI or spinner rendering.
Screenshots
N/A
** Please complete the following information:**
- OS: All supported platforms
- Terminal: All terminals
- Version: 1.5.1
Additional context
Issue #48 requested broader test coverage and was substantially addressed by PR #67. This issue captures the concrete runtime defects found while assessing the remaining coverage gaps.
Acceptance checklist:
- Treat a resolved repository, archive, Codespace, or gist mutation request as success rather than matching one hard-coded 2xx status.
- Propagate generic repository and Codespaces listing errors and remove the broken command-level
main()fallbacks. - Continue after ordinary per-item mutation failures, but abort on authentication or scope failures without replaying the batch.
- Return mutation outcomes through the command layer and set a nonzero exit status when any mutation fails.
- Add focused regression tests for listing propagation, Codespace HTTP 202, ordinary partial failure, token-wide batch abort, and API error mapping.
Activity