Skip to content

FIX: Do not send a bogus Circle-Token header - #119

Merged
larsoner merged 1 commit into
scientific-python:masterfrom
larsoner:fix-circle-token
Jul 28, 2026
Merged

larsoner merged 1 commit into
scientific-python:masterfrom
larsoner:fix-circle-token

Conversation

@larsoner

Copy link
Copy Markdown
Collaborator

This is a live bug for every public-repo user who does not set api-token, which is the documented default. Found while verifying the native-fetch swap in #118 against the real API.

With no api-token, the action sends Circle-Token: null (the literal string). CircleCI rejects that:

no header             : 200
Circle-Token: null    : 401   {"message":"Invalid token provided."}
Circle-Token: <empty> : 200
real token            : 200

So the artifacts request 401s, .items is missing, and the run fails. The fix is to send the header only when a token was actually supplied.

Why CI never caught this

.github/workflows/status.yml passes api-token: ${{ secrets.CIRCLECI_TOKEN }}, so this repo's own self-test always takes the authenticated path. The tokenless path that public-repo users depend on was never exercised — worth considering whether the self-test should cover both.

Verification

Running run() against the live CircleCI API (job 361, no token, only getOctokit faked):

status state      : success
status target_url : https://output.circle-artifacts.com/output/job/982be.../root_artifact.md

and that URL returns 200. Before the fix the same script failed with CircleCI API returned 401. The unit test now asserts the header is absent rather than 'null'; 22 tests, 100% coverage.

Note this PR is branched off master, not off #118, so it can go in independently — but it should be in the release.

🤖 Generated with Claude Code

With no api-token configured the action sent 'Circle-Token: null', which
CircleCI now rejects with 401 Invalid token provided, even for public
projects. Omitting the header entirely returns 200, so only send the
header when a token was actually supplied.

This repo's own test workflow passes secrets.CIRCLECI_TOKEN, so its
self-test never exercised the tokenless path that public-repo users
without an api-token rely on.

Co-Authored-By: Claude Opus 5 <[email protected]>
@larsoner
larsoner merged commit a960a42 into scientific-python:master Jul 28, 2026
3 checks passed
@larsoner
larsoner deleted the fix-circle-token branch July 28, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant