Skip to content

fix: the audit's token scope was one folded string, so both tokens were empty - #22

Merged
MarketDataApp merged 1 commit into
mainfrom
fix/audit-token-repository-list
Sep 22, 2026
Merged

MarketDataApp merged 1 commit into
mainfrom
fix/audit-token-repository-list

Conversation

@MarketDataApp

Copy link
Copy Markdown
Contributor

The fleet audit's first real run failed, and failed for the whole run rather than one repository.

Cause

repositories: >- is a folded scalar — YAML joins its lines with spaces. create-github-app-token splits that input on newlines and commas, never spaces, so it read the whole list as one repository name:

  repositories: api code-review-bot
Failed to create token for "MarketData-App/api code-review-bot" (attempt 1): Not Found

Both token steps 404ed, and the audit then ran with an empty token:

  GITHUB_TOKEN:
  REVIEWBOT_BOT_TOKEN:
reviewbot: error: GITHUB_TOKEN is not set

| keeps the newlines.

Why no test caught it

The bug arrived with the repositories: scoping and the test passed throughout, because it split the value on whitespace — which yields the correct set for the broken form and the fixed form alike.

The test now splits the way the action does (newlines and commas) and rejects any entry containing a space. Reverting the workflow to >- makes it fail:

FAILED test_the_tokens_are_scoped_to_the_audited_repositories
  MarketData-App: 'api code-review-bot' is not one repository name; `>-` folds the list into a single string

How it surfaced

The push-to-main trigger, added in #21 for exactly this reason, caught it on the first merge rather than at 07:00 tomorrow.

733 tests pass, ruff clean.

…re empty

The first real run of the fleet audit failed, and it failed for the whole run
rather than for one repository.

`repositories: >-` is a FOLDED scalar: YAML joins its lines with spaces. The
action splits that input on newlines and commas, never on spaces, so it read
the list as a single repository name and asked GitHub for
"MarketData-App/api code-review-bot". That is a 404, both token steps failed,
and the audit then ran with GITHUB_TOKEN empty:

    Failed to create token for "MarketData-App/api code-review-bot": Not Found
    reviewbot: error: GITHUB_TOKEN is not set

`|` keeps the newlines, which is what the action expects.

The bug arrived with the `repositories:` scoping and no test caught it,
because the test split the value on WHITESPACE -- which yields the right set
for the broken form and the correct form alike. It now splits the way the
action does, on newlines and commas, and additionally rejects any entry
containing a space. Reverting the workflow to `>-` fails that test.

Caught by the push-to-main trigger added in the same pull request, on its
first run, which is the trigger doing exactly what it was added for.
@MarketDataApp
MarketDataApp merged commit fa2de6f into main Sep 22, 2026
1 check passed
@MarketDataApp
MarketDataApp deleted the fix/audit-token-repository-list branch September 22, 2026 23:43
@marketdata-code-review

Copy link
Copy Markdown

✅ Ready — Code review

This change switches both GitHub App repository lists from folded to literal YAML scalars so the token action receives separate repository names. The regression test now parses the values using the action's separators and rejects folded, space-joined names.

Rating patch 5/6 (solid) · proof 5/6 (reproducible) · overall 5/6

Findings

Nit

  • tests/test_callers.py:576-581 Move incident history out of the test (style, ff9828f8)
    The new comment records the specific 404 incident and empty-token outcome rather than only the parsing constraint. Keep the separator rationale in the test and leave the incident narrative in the pull request or commit message.

    tests/test_callers.py:576-581 describes the GitHub request, 404, and empty tokens.


Reviewed 4978fec · revision 1 · codex (gpt-5.6-sol) · claude unavailable · rules: default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant