Skip to content

ref(cli): Trim set-commits tests and share repository error hints - #2193

Open
sentry-junior[bot] wants to merge 1 commit into
mainfrom
ref/cli-set-commits-test-cleanup
Open

sentry-junior[bot] wants to merge 1 commit into
mainfrom
ref/cli-set-commits-test-cleanup

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up cleanup from reviewing the set-commits --auto work (#1863–#1866) on main. No behavior change.

Tests removed (duplicate coverage)

  • setCommitsAuto "skips a display name whose URL points to another project" / "matches a display name when the repository has no URL": these were the same two cases as the isSameRepository unit table in git.property.test.ts, wrapped in a full fetch mock. The pure-function table keeps them.
  • setCommitsAuto "throws ValidationError when no repo matches local remote": the name-filter test and the "suggests similar repositories" test already assert the same error, and they check more.
  • isSameRepository rows for GitLab and Azure URL-path matching: the GitLab and Azure setCommitsAuto tests already cover them end to end. They're replaced with one fast-check property, matching by URL path in any case whatever the display name, since CLI AGENTS.md prefers property tests for pure functions.

Test helpers

  • jsonResponse(body, status), a local helper like replays.test.ts has. It replaces the 45 new Response(JSON.stringify(...), { headers: { "Content-Type": ... } }) blocks in releases.test.ts. The pagination test now uses the existing linkHeader() helper.
  • mockAutoFetch(repos) answers the repository search, the previous-release lookup and the release PUT for setCommitsAuto, and records the queries and the refs sent. It replaces 5 hand-written copies of that router. The tests that check request details, concurrency or pagination keep their own mocks.
  • ciEnv(vars): every withEnv() call now keeps the test database and telemetry off and drops the runner's CI variables. Before, some calls did this and others passed {}.

releases.ts

  • setCommitsAuto uses CommitRef instead of writing the same type inline.
  • repositorySuggestions() and addRepositoryHint() now build the similar-repository list and the "add the repository" hint for both the --auto error and the --commit error. Before, each error had its own copy.
  • The nested "org has no repositories" if is collapsed into one condition.
  • The JSDoc now lists Azure DevOps.

Checks (in packages/cli)

  • pnpm run typecheck and pnpm run lint pass.
  • vitest run test/lib/api/releases.test.ts test/lib/git.property.test.ts test/lib/ci.test.ts test/commands/release/ passes (157 tests).
  • Net change: +159 / -388 lines.

via @betegon.

--

View Session [Sentry]

Remove two setCommitsAuto tests that repeat other coverage: the
display-name cases already in the isSameRepository unit table, and the
"no repo matches" case that the name-filter and suggestion tests cover.
Swap the GitLab and Azure isSameRepository rows, which the setCommitsAuto
tests also cover, for a property test of URL-path matching.

Add a local jsonResponse() helper like replays.test.ts, a mockAutoFetch()
router for the setCommitsAuto tests, and a ciEnv() helper so every
withEnv() call keeps the test database and drops the runner's CI
variables.

In releases.ts, reuse CommitRef in setCommitsAuto and share the
similar-repository list and the "add the repository" hint between the
--auto and --commit errors. No behavior change.

Co-Authored-By: bete <28983162+betegon@users.noreply.github.com>
@vercel

vercel Bot commented Nov 12, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 12, 2026 9:51am UTC

Request Review

@github-actions github-actions Bot added the risk: low PR risk score: low label Nov 12, 2026

This branch was previously deployed

1 inactive deployment
Preview — ffad66ee Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant