Skip to content

feat(core): resolve baseline from commits when no Git provider#332

Merged
gregberge merged 2 commits into
mainfrom
greg/find-baseline-from-commits
Jul 1, 2026
Merged

feat(core): resolve baseline from commits when no Git provider#332
gregberge merged 2 commits into
mainfrom
greg/find-baseline-from-commits

Conversation

@gregberge

Copy link
Copy Markdown
Member

What

When a project has no remote content access (no Git provider connected), Argos can't compute the baseline server-side. This adds client-side baseline resolution that leans on the new /baseline API (argos#2322), which finds an eligible baseline build from a list of candidate commits.

How

Resolution (resolveBaseline) runs only when hasRemoteContentAccess is false and no reference commit is explicitly configured:

  1. Merge base first — find the merge base between the build branch and its base branch. This is always the starting point.
  2. Resolve the reference commit — ask /baseline over [mergeBase, ...ancestors] for the closest commit (the merge base itself or an ancestor) that has an eligible baseline build. Searched in growing batches: 100, then 500 per request, up to 5000. That build's commit becomes the reference commit.
  3. No baseline yet → the baseline build may still be processing — fall back to referenceCommit = mergeBase and send up to 300 parent commits so the server resolves the baseline asynchronously once that build completes.

Notes

  • The batched search and the merge-base orchestration are dependency-injected in find-reference-commit.ts, so they're unit tested (no real git/network needed).
  • listParentCommits is merged into listAncestorCommits — one git commit-listing primitive. parentCommits (which the server slices [0] off) is derived as [refCommit, ...ancestors].
  • Adds real git-integration tests for listAncestorCommits.

Test plan

  • tsc clean
  • eslint / prettier clean
  • vitest — 105 passed, 2 skipped

🤖 Generated with Claude Code

When a project has no remote content access (no Git provider connected),
Argos can't compute the baseline server-side. Resolve it client-side:

- Find the merge base between the build branch and its base branch.
- Ask the new /baseline API to pick the closest commit (the merge base
  itself or an ancestor) that has an eligible baseline build, searching
  in growing batches (100, then 500 per request, up to 5000).
- If none is found yet (the baseline build may still be processing),
  fall back to the merge base and send its parent commits so the server
  can resolve the baseline once that build completes.

The batched search and the merge-base orchestration live in
find-reference-commit.ts with dependency injection so they are unit
tested. listParentCommits is merged into listAncestorCommits (the sole
git commit-listing primitive).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gregberge gregberge requested a review from jsfez July 1, 2026 08:12
@vercel

vercel Bot commented Jul 1, 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 1, 2026 8:37am

Request Review

Add the /baseline path and findBaseline operation to the generated
schema so the typed client can call the new endpoint. Scoped to the
baseline endpoint only; it references existing schema types (Sha1Hash,
Build, Error).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gregberge gregberge merged commit d3fc6f1 into main Jul 1, 2026
68 checks passed
@gregberge gregberge deleted the greg/find-baseline-from-commits branch July 1, 2026 13:07
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