Skip to content

fix(open): make --open non-fatal and reject composed mode cleanly#1009

Merged
reuvenharrison merged 4 commits into
mainfrom
fix/open-composed-nonfatal
Jun 14, 2026
Merged

fix(open): make --open non-fatal and reject composed mode cleanly#1009
reuvenharrison merged 4 commits into
mainfrom
fix/open-composed-nonfatal

Conversation

@reuvenharrison

@reuvenharrison reuvenharrison commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

What

Two fixes to --open (on breaking and changelog).

1. --open is now non-fatal for runtime failures

The changelog/breaking output is already printed before the upload runs. Previously, an upload error (or an unsupported spec source) returned exit code 130, which pre-empted --fail-on and changed the command's exit status. A side-by-side review that could not be uploaded should never alter the result of the check.

Now a runtime --open failure (upload error, unreachable host, unsupported source) is warned to stderr (so piped --format json/yaml output on stdout stays clean) and the command continues to its normal --fail-on exit.

Also removes the now-dead getErrUploadAndOpenFailed.

2. --open + composed (-c) is rejected at argument validation

Composed mode diffs a glob of many files, which the two-spec review can't represent. This is a static, user-fixable incompatibility, so it's validated up front in getParseArgs (alongside the existing checkStdinWithComposed / checkColor checks) as checkOpenWithComposed, failing before any diff runs with exit 100 and a clear message:

--open cannot be used with composed mode (-c): the side-by-side review compares exactly two specs

That distinction is deliberate: a transient upload blip can't be fixed by editing your command (so it warns and continues, per #1), but -c --open can (so it fails fast like any invalid flag combination). checkOpenWithComposed no-ops on diff/summary, which share getParseArgs but don't define --open.

3. Comments generalized to "the server"

--open uploads to oasdiffSiteURL(), which defaults to oasdiff.com but follows OASDIFF_URL for a local dev server or self-hosted deployment. The zero-knowledge comments hardcoded "oasdiff.com" as the destination; reworded to "the server" so they stay accurate for any OASDIFF_URL target.

Test

go build ./..., go vet, and go test ./internal/ pass. New Test_OpenWithComposedRejected covers both breaking and changelog; verified diff -c / summary -c (no --open flag) are unaffected.

Related

🤖 Generated with Claude Code

--open is additive: the changelog/breaking output is already printed before
the upload. Two problems made it behave otherwise:

1. An upload error (or unsupported source) returned exit code 130, which
   pre-empted --fail-on and changed the command's exit status. A side-by-side
   review that could not be opened should never alter the result of the check.
   Now the failure is warned to stderr (not stdout, so piped --format
   json/yaml output stays clean) and the command continues to its normal
   --fail-on exit.

2. Composed mode (-c) diffs globs of many files, which the two-spec encrypted
   payload and the review page cannot represent. Previously readSpecSource
   tried to read the literal glob string from disk and produced a confusing
   "no such file or directory". Now --open returns a clear "does not support
   composed mode" message (still non-fatal per the above).

Removes the now-dead getErrUploadAndOpenFailed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.33%. Comparing base (6cbe79f) to head (82cc5d3).

Files with missing lines Patch % Lines
internal/handlers.go 68.75% 3 Missing and 2 partials ⚠️
internal/changelog.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1009   +/-   ##
=======================================
  Coverage   87.32%   87.33%           
=======================================
  Files         274      274           
  Lines       14141    14152   +11     
=======================================
+ Hits        12348    12359   +11     
+ Misses       1280     1278    -2     
- Partials      513      515    +2     
Flag Coverage Δ
unittests 87.33% <64.70%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

reuvenharrison and others added 3 commits June 14, 2026 15:43
…F_URL)

--open uploads to oasdiffSiteURL(), which defaults to oasdiff.com but follows
OASDIFF_URL for a local dev server or a self-hosted deployment. The zero-knowledge
comments hardcoded "oasdiff.com" as the upload target, which reads as if the
destination were fixed. Reword to "the server" (noting oasdiff.com as the
default) so the comments stay accurate for any OASDIFF_URL target.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the composed-mode rejection out of uploadAndOpen (which runs only after the
full diff + changelog output) into getChangelog's flag validation, returning
getErrInvalidFlags (exit 101). --open + -c is a static, user-fixable
incompatibility, not a runtime upload problem, so it should fail fast with a
clear message like any other invalid flag combination rather than running the
whole diff and emitting a late warning. The non-fatal handling stays for genuine
runtime/upload failures, which is what it was for.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the --open/-c incompatibility check into getParseArgs alongside the sibling
argument validators (checkStdinWithComposed, checkColor) as checkOpenWithComposed,
rather than in getChangelog. This is where flag-combination validation belongs:
it fails before any diff work, returns the conventional exit 100 (matching the
other Args validators), and keeps changelog/getChangelog free of the concern.
checkOpenWithComposed no-ops on diff/summary, which share getParseArgs but don't
define --open. Adds a run_test covering both breaking and changelog.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@reuvenharrison reuvenharrison merged commit da2f424 into main Jun 14, 2026
14 checks passed
@reuvenharrison reuvenharrison deleted the fix/open-composed-nonfatal branch June 14, 2026 18:04
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