Prevent team-sync downgrade on transient GitHub API failure
Summary
fetch_github_teams() currently returns an empty list on GitHub API/network failures, and sync_user_github_teams() treats that as authoritative state. This can remove users from all github-team groups during transient outages.
Why this matters
A temporary API error (rate limit, network hiccup, timeout) can accidentally revoke group-based resource access for users.
Current behavior
fetch_github_teams()logs warning and returns[]on failure.sync_user_github_teams()removes memberships not in the incoming team list.
Expected behavior
Transient failures should not be interpreted as "user belongs to zero teams".
Proposed fix
- Make fetch return an explicit failure signal (e.g.
None/Result type) instead of[]. - Skip removal sync when team-fetch status is unknown/failed.
- Add tests for failure-path semantics to prevent regressions.
Acceptance criteria
- No github-team membership removals happen when team fetch fails.
- Existing successful sync behavior remains unchanged.
- Unit tests cover success and failure paths.
A fix is now open in PR #61.\n\nThis updates the GitHub team sync path so transient team-fetch failures are treated as unknown membership instead of an authoritative empty team list, which avoids unintended access downgrade/removal during temporary GitHub API failures.\n\nTest coverage for the failure-path behavior was also added.