Documentation
¶
Overview ¶
Command record-fixtures captures real GitHub GraphQL responses for a fixed set of accounts/repos and vendors them under tests/fixtures/ as replay fixtures for the layer-2 data tests.
Why record instead of hand-authoring: a hand-written mock body tends to be internally consistent (e.g. followers.totalCount equals len(nodes)), which masks aggregation bugs like #470 where the card must show the true total (59) but the code counts the fetched page (24). A response recorded from the real API carries the genuine asymmetry, so the bug cannot hide.
This tool hits the live API and therefore needs a token; it is NOT run in CI. Re-record intentionally when the upstream query changes or the pinned values need refreshing:
GITHUB_TOKEN=$(gh auth token) go run ./internal/tools/record-fixtures
Each recording POSTs the SAME query file the production code uses (internal/githubapi/queries/<file>) so the fixture matches the wire shape genqlient expects. Note the circularity caveat: a field the active query does not request will be absent from the recording too — layer 1 (query field-presence) guards that separately.