Skip to content

Fail early during local run if the token is not valid#263

Open
GuillaumeLagrange wants to merge 2 commits intomainfrom
cod-2173-codspeed-run-should-fail-before-running-the-benchmarks-if
Open

Fail early during local run if the token is not valid#263
GuillaumeLagrange wants to merge 2 commits intomainfrom
cod-2173-codspeed-run-should-fail-before-running-the-benchmarks-if

Conversation

@GuillaumeLagrange
Copy link
Contributor

@GuillaumeLagrange GuillaumeLagrange commented Mar 11, 2026

Tested scenarii

user logged in, private repo with no access ✅
user logged in, repo that does not exist ✅
user logged in, private repo with access ✅
user token expired, public repo ✅
user token expired, private repo with no access ✅
user token expired, repo that does not exist ✅
user token expired, private repo with access ✅
user not logged in, public repo ✅
user not logged in, private repo ✅
user not logged in, repo that does not exist ✅

user logged in, public repo

  • If write access in codspeed ✅
  • If no write access in codspeed ⚠️
    • Fails on 401 during upload because we don't check if the user has proper write access to repository here
    • This is expected and kinda harder to to and out of scope for this ticket

Since we are not going to upload the result anyway, we should still be
able to perform the run if the API is not available. This allows offline
usage during dev or in a very controlled sandbox environment that only
outputs profile.
1. Repo found
  a. Logged in: user is set, repositoryOverview is set — repo found
  b. NOT logged in: user is null, repositoryOverview is set => bails
    with "session expired"

2. REPOSITORY_NOT_FOUND => falls through to `get_or_create_project_repository`
  a. Logged in: `get_or_create_project_repository` succeeds
  b. NOT logged in: `get_or_create_project_repository` fails, bail with
  "session expired"
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 11, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks


Comparing cod-2173-codspeed-run-should-fail-before-running-the-benchmarks-if (f4d85a8) with main (7a17aba)

Open in CodSpeed

@GuillaumeLagrange GuillaumeLagrange force-pushed the cod-2173-codspeed-run-should-fail-before-running-the-benchmarks-if branch 2 times, most recently from 77b4420 to f4d85a8 Compare March 11, 2026 17:13

/// Resolve repository information from override, git remote, or API fallback
///
/// When there is no explicit repository overrid, this flow also makes sure the user is logged in with a valid token
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// When there is no explicit repository overrid, this flow also makes sure the user is logged in with a valid token
/// When there is no explicit repository override, this flow also makes sure the user is logged in with a valid token

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.

2 participants