Repository navigation
Description
What happened
The installer collapses every GitHub API refusal into one sentence, so a spent
quota is indistinguishable from a repository the token cannot read, and the
response that says which is thrown away:
✗ codeaf: GitHub's API could not be reached or refused (a rate limit, or a repository you cannot read?); pin VERSION=<tag>, or export GITHUB_TOKEN
base: dev@470ab4a6f (the served /get/devaf is scripts/install.sh on its dev
revision, which differs from codeaf/stable and carries INSTALL_NAME=devaf).
Two defects, one failure path:
api_problemrenders one sentence for 401, 403-quota, 403-forbidden, 5xx and
transport failure, whilehttp_getdiscards the body and the headers of that
same response. GitHub states the reason on that response
(x-ratelimit-remaining: 0,x-ratelimit-reset: <epoch>, body
API rate limit exceeded), and the message therefore cannot name the reason
or the moment the refusal lifts. Its advice,or export GITHUB_TOKEN, is
backwards when a token was already exported and is the cause.- A 403 from a token-bearing request aborts even though the anonymous quota is
a separate bucket. No single unauthenticated retry of the same
release_api_getis attempted, so an install that could complete fails.
Not a defect, and not to be changed here: the script's header states the
one-repository, API-only intent (REPOSITORY, "no other repository is asked"),
so a fallback to releases.atom or HTML is a deliberate design choice, not an
omission.
Replication
Deterministic (no model).
Drive the repository's own fake GitHub at CODEAF_GITHUB_API (as
internal/release/install_test.go already does, CODEAF_GITHUB_API= +
github.server.URL). The stub answers every /repos/Agent-Field/codeaf/* call
with 403 and:
- body
{"message":"API rate limit exceeded for user ID <id>."} x-ratelimit-limit: 5000,x-ratelimit-remaining: 0,x-ratelimit-reset: <epoch one minute ahead>x-oauth-scopes: repo, workflowso the token itself reads as valid
Run the installer with GITHUB_TOKEN=<any non-empty> and no VERSION. Today it
prints the sentence above and exits 1; the output names neither quota nor the
reset moment, and a valid token is reported as unusable only insofar as the
advice contradicts it. Control: release_api_get without authenticate against
the same stub is still refused by the stub, which is how the missing anonymous
retry is observed.
Field (real models).
None. No model is involved; the behaviour is deterministic.
Where
scripts/install.sh:
api_problem— searchGitHub's API could not be reached or refused.- its call sites — search
api_problem(channel selection for--stable, and
release discovery for the other channels). http_get/release_api_get— searchHTTP_STATUS; the status is kept and
the headers and body are discarded (--outputto a file no caller reads).tag_matches_channeland theVERSIONpin sit on the same path; the pin is
the reason the escape hatch is printed.
Acceptance
- e2e: with the stub above and a token whose account quota is spent, the
installer finishes the install — exit0,INSTALL_DIR/INSTALL_NAMEpresent
and reporting the tag it installed — by retrying the same API call
unauthenticated, instead of failing with the generic refusal. Driven through
CODEAF_GITHUB_API; the stub asserts the retried request carried no
Authorizationheader. - e2e: with a token GitHub rejects (
401, bodyBad credentials), stderr
names the token as rejected and does not advise exporting one; exit1. With
a403that carries no rate-limit headers, stderr names access, not quota. - e2e: for the quota
403, stderr states the reason (quota) and the reset
moment read fromx-ratelimit-reset, rendered in the host's local time. - Unit: the reason string is a pure function of (status, headers, body):
remaining: 0or anAPI rate limit exceededbody → quota;401→ rejected
token; any other403→ access; and the reset rendering falls back to a
relative wait when the header is absent. - The manual page covering install failures quotes the new wording, and the
change entry'sinvalidatesnames the belief that one sentence covered all
API refusals.
Activity
installer: name why GitHub's API refused, and retry a refused token o…