#610

github-actions: share repo discovery and per-repo runs across panes, and stop at the rate limit

Openwiiiimmopened 13d ago

Several github-actions panes on one machine make one request per repo per refresh between them, instead of one each.

Context / problem

With 3 accounts and 48 repos, one pane makes at least 2,880 REST requests an hour against GitHub's 5,000. Two panes go over the limit. The widget has no backoff. Part of stealth-factory/opscope#630.

Scope

In:

  • Three shared readings: who the token belongs to, repo discovery, and runs per repo.
  • Per-repo readings, so panes with different repo lists share the overlap, and two panes that go stale together split the repos.
  • The state and text filters and the selection stay per pane. window_hours is part of the reading because it changes the query.
  • A rate-limit record: a spent limit (x-ratelimit-remaining: 0, or 403/429 with retry-after) stops every github-actions pane until x-ratelimit-reset. Header parsers are parse_*, always compiled, with tests.
  • fetched on screen is the reading's own time, not when this pane drew it.
  • The freshness row from core.
  • r re-asks readings older than 30 s (or refresh, if shorter).
  • A share_readings setting (default on), the regenerated config.example.json, and README, help and CONFIGURE text, including that run titles are stored for up to 2 hours.

Out:

  • The jobs view (fetch_jobs), which fires once on a key press.
  • Changing any refresh interval.

Acceptance

  • Two panes over the same repos make one request per repo per refresh (a test against the store's counters, and a manual smoke test in the PR).
  • A simulated spent limit stops every pane until the reset, and each pane says when it will ask again.
  • share_readings: false behaves exactly as today.
  • Fixture tokens never appear in the store file.
  • N of M runs in the window and the partial note survive sharing.
Agent notes
  • Fetch: one_pass() main.rs:1205; discover_accounts :1010, discover_repos :1110 (up to 5 pages of 40 per account), fetch_runs_for :938 (RUN_PAGE 100). take_rate() :201 reads rate headers; add x-ratelimit-reset.
  • Keys: gha.who/1:{host}:{fp}, gha.repos/1:{host}:{fp}:{hash(accounts, pushed_days, max_repos)}, gha.runs/1:{host}:{fp}:{owner/name}:{window_hours}. Rate record gha.gate/1:{host}:{login}:core.
  • Size (estimate): about 2 MB across 48 busy repos. State bytes written per hour in the PR.

Activity

1
linear-code[bot]13d ago