The GitHub Actions job "Validate and test" on pekko-grpc.git/main has succeeded.
Run started by GitHub user pjfanning (triggered by pjfanning).

Head commit for run:
5d0a3446ad77639ea050a4828b1ae4abfad4a880 / PJ Fanning 
<[email protected]>
Replace the resolver's assert with an IllegalArgumentException (#873)

Motivation:
The pekko-http transport resolver checked the host it was asked to resolve
against the configured `override-authority` with `assert`. Two problems:

`assert` throws `AssertionError`, which is an `Error` and not an `Exception`, so
it passes straight through a handler that catches `Exception` and is not what a
caller inspecting a failed connection would expect to match on.

`assert` is also elided entirely under `-Xdisable-assertions`. That is the
calling application's compiler flag, not this project's, so the check silently
disappears in a build this project does not control.

The message was also just "assertion failed", naming neither the host nor the
authority it was compared against.

Modification:
Extracted `checkAuthority`, which throws an `IllegalArgumentException` naming
both hosts and the client it belongs to. Extracting it also gives the check a
seam a test can reach; it previously lived inside a closure passed to
`ClientTransport.withCustomResolver`.

Result:
The check runs regardless of the caller's compiler flags, fails with an
exception rather than an error, and says what mismatched.

Tests:
- 3 cases in `PekkoHttpClientUtilsSpec`: a matching authority, no configured
  authority, and a mismatch asserting the failure is an `Exception` and names
  both hosts
- Confirmed the guard bites: restoring `assert` fails the mismatch case, since
  `AssertionError` is not an `Exception`
- sbt "runtime/testOnly ...PekkoHttpClientUtilsSpec" - 12 passed
- sbt "runtime/mimaReportBinaryIssues" - passed
- sbt scalafmtAll scalafmtSbt - applied
- sbt "runtime/test" - not run locally, left to CI

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

Report URL: https://github.com/apache/pekko-grpc/actions/runs/33490799859

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to