Skip to content

actions: surface genuine oasdiff errors as PR annotations#130

Merged
reuvenharrison merged 2 commits into
mainfrom
feat/surface-oasdiff-errors
May 31, 2026
Merged

actions: surface genuine oasdiff errors as PR annotations#130
reuvenharrison merged 2 commits into
mainfrom
feat/surface-oasdiff-errors

Conversation

@reuvenharrison
Copy link
Copy Markdown
Contributor

Follow-up to #128. Makes a failed oasdiff invocation visible on the PR's Checks tab, not just buried in the raw step log.

What

Each entrypoint (breaking, changelog, diff, pr-comment, validate) now promotes a genuine oasdiff failure to a GitHub ::error:: annotation (in addition to keeping the raw stderr in the log).

Gated on exit code >= 2, not != 0:

  • 0 = success
  • 1 = the intended fail-on / changes-found result — not an error, so a normal "breaking changes found" run is never mislabeled
  • >= 2 = a genuine error (load/parse/etc.) → surfaced

The disallowed-external-ref remedy (exit 123, from #128) is layered on top, so that case gets both the raw message and the actionable "set allow-external-refs: true" hint.

Test

New test-error-annotation.yaml drives the validate (standalone shape) and changelog (early-exit shape) entrypoints with a stubbed oasdiff at exit 102 / 123 / 1, asserting:

  • 102 → a ::error:: annotation is emitted
  • 123 → the allow-external-refs: true remedy is emitted
  • 1no annotation (fail-on is not an error)

This is the only way to assert annotation presence/absence (it isn't visible via step outcome/outputs). Verified locally: all six assertions pass.

Intended to land before the v0.0.51 action release so that release carries the full error-UX change.

reuvenharrison and others added 2 commits May 31, 2026 00:22
Previously a failed oasdiff invocation only printed to stderr (visible in the
raw log, not on the Checks tab) unless it was the disallowed-external-ref case.
Each entrypoint now promotes a genuine failure to a ::error:: GitHub annotation
so it shows on the PR.

Gated on exit code >=2, not "!= 0": exit 0 is success and exit 1 is the
intended fail-on / changes-found result (not an error), so a normal "breaking
changes found" run is never mislabeled as an error. The disallowed-external-ref
remedy (exit 123) is layered on top.

Adds test-error-annotation.yaml: drives the validate (standalone) and changelog
(early-exit) entrypoints with a stubbed oasdiff at exit 102/123/1 and asserts an
annotation is emitted for genuine errors and the remedy for 123, but not for the
fail-on exit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…on test

Previously only validate + changelog were exercised, and the exit-0 success
path was untested. Now loops over all five entrypoints (breaking, changelog,
diff, pr-comment, validate) across four cases each:

- exit 0  (success)            -> no ::error:: annotation
- exit 102 (genuine load error) -> ::error:: annotation surfaced
- exit 123 (disallowed external ref) -> allow-external-refs remedy
- exit 1  (fail-on/changes)     -> no ::error:: annotation

pr-comment is driven with an empty oasdiff-token so its success path skips the
network POST; its error cases early-exit before it. 20 assertions, all
hermetic (stubbed oasdiff, no network).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@reuvenharrison reuvenharrison merged commit f30668f into main May 31, 2026
60 checks passed
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