Skip to content

fix: don't fail the upload when the branch is not on origin#349

Merged
gregberge merged 3 commits into
mainfrom
greg/arg-472-first-local-run-fails-on-a-feature-branch
Jul 23, 2026
Merged

fix: don't fail the upload when the branch is not on origin#349
gregberge merged 3 commits into
mainfrom
greg/arg-472-first-local-run-fails-on-a-feature-branch

Conversation

@gregberge

Copy link
Copy Markdown
Member

Fixes ARG-472: running the upload locally from a branch that isn't pushed yet killed the run with fatal: couldn't find remote ref <branch> — and the process still exited 0, so users saw green tests and no build.

core: merge-base resolution never fails the upload

getMergeBaseCommitSha was the only link in the baseline resolution chain that could throw: it fetched the head/base refs without catching failures. Fetch failures now fall back to the local history:

  • Ref missing on origin (branch not pushed yet — the first-local-run case): use the local ref, which is the exact state being built. Expected case, debug log only. In the common scenario (base branch on origin, feature branch local), the merge base is still resolved correctly, so the build even gets a proper baseline instead of the no-baseline fallback.
  • Other failures (network, auth…): keep the freshest previously-fetched state when available, otherwise the local ref, and print a warning so misconfigurations stay visible.
  • Ref unavailable both on origin and locally: resolve to null → build without baseline, as resolveBaseline and listAncestorCommits already handle.

vitest: upload failures fail the run instead of exiting 0

Vitest decides the exit code before reporters run onTestRunEnd, so a throwing reporter surfaced as an "Unhandled Error" while the process exited 0. The reporter now catches upload errors, reports them and sets process.exitCode = 1. A new ignoreUploadFailures option (mirroring the Playwright reporter) opts out of failing the run.

Test plan

  • New unit tests: unpushed head branch resolves the merge base from the local ref, ghost refs resolve to null without throwing, unreachable origin falls back to local history with a warning
  • New unit tests: reporter failure path sets exit code 1, ignoreUploadFailures keeps it unset and is not forwarded to upload()
  • Reproduced the ARG-472 scenario end to end (bare origin, unpushed poc-argos branch): merge base resolved, no crash
  • check-types, lint, full unit suites of core (116) and vitest (45) pass

🤖 Generated with Claude Code

gregberge and others added 2 commits July 23, 2026 17:32
…igin

Running the upload from a branch that is not pushed yet made
getMergeBaseCommitSha die on `git fetch` (exit 128, "couldn't find
remote ref"), killing the whole upload. It was the only link in the
baseline resolution chain that could throw.

Fetch failures now fall back to the local history instead of failing:
- ref missing on origin (e.g. branch not pushed yet): use the local ref,
  which is the exact state being built; expected, logged in debug only.
- other failures (network, auth…): keep the freshest fetched state when
  available, fall back to the local ref otherwise, and surface a warning.

When a ref is unavailable both on origin and locally, the merge base
resolves to null, which produces a build without baseline as the rest of
the chain already handles.

Closes ARG-472

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Vitest decides the exit code before reporters run onTestRunEnd, so an
error thrown by the Argos reporter surfaced as an "Unhandled Error"
while the process still exited 0: green tests, no build, no signal.

The reporter now catches upload errors, reports them and fails the run
explicitly through process.exitCode. A new ignoreUploadFailures option
(same as the Playwright reporter) keeps the run green when wanted.

Closes ARG-472

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gregberge
gregberge requested a review from jsfez July 23, 2026 15:33
@linear-code

linear-code Bot commented Jul 23, 2026

Copy link
Copy Markdown

ARG-472

@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
argos-js-sdk-reference Ready Ready Preview, Comment Jul 23, 2026 3:36pm

Request Review

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gregberge
gregberge merged commit d49db4a into main Jul 23, 2026
70 checks passed
@gregberge
gregberge deleted the greg/arg-472-first-local-run-fails-on-a-feature-branch branch July 23, 2026 15:42
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