Skip to content

fix(istream): feed throws the SofabException it declares for visitor rejections (#129) - #130

Merged
Andste82 merged 1 commit into
mainfrom
fix/feed-unwraps-visitor-rejection-129
Oct 14, 2026
Merged

Andste82 merged 1 commit into
mainfrom
fix/feed-unwraps-visitor-rejection-129

Conversation

@Andste82

@Andste82 Andste82 commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

What

IStream.feed declares throws SofabException, but a rejection raised by generated code inside the Visitor (schema bounds, MESSAGE_SPEC §7.1; receiver caps, §6.2.1) reached the caller still wrapped in the UncheckedIOException carrier. feed already unwrapped the cause to latch the terminal verdict, then rethrew the wrapper.

It now rethrows the SofabException for every code: INVALID_MSG, LIMIT_EXCEEDED and a visitor-raised ARGUMENT. After a LIMIT_EXCEEDED refusal, every later feed call also throws a plain SofabException with that code.

What doesn't change

  • The latching rules: INVALID_MSG / LIMIT_EXCEEDED lock the decoder into the refused state by code, and a visitor-raised ARGUMENT doesn't.
  • An UncheckedIOException whose cause is not a SofabException (the visitor's own I/O failure) passes through as thrown, and the decoder stays usable.
  • Inside visitor callbacks, Sofab.invalid / limitExceeded / argument, Seq and PayloadAcc still throw the wrapper. Visitor methods can't throw a checked exception, so they must.
  • The wire format: Sofab.API_VERSION stays 1.

Breaking

This is source-breaking for callers that caught UncheckedIOException around feed and read getCause(); they catch SofabException instead. It is recorded as (d) in the 0.13.0 list of breaking changes in pom.xml (0.13.0 is unreleased). The generated tryDecode / Decoder.feed javadoc already says only @throws SofabException, and becomes true with no generator change.

Tests

  • Every assertion that expected the wrapper at the feed boundary now asserts SofabException (LimitExceededIsTerminalTest, InvalidIsTerminalTest, ReceiverCapTest, SequenceGrowthTest, Utf8StrictTest, Utf8ChunkOffsetTest, SofabTest).
  • Removed the "accept either kind of exception" workarounds in common/Decode.verdict, BooleanTolerantTest and HeaderLimitsTest. Without them, a wrapper escaping feed fails the tests instead of being quietly unwrapped.
  • mvn verify: 1620 tests, 0 failures.

Closes #129

🤖 Generated with Claude Code

…rejections (#129)

IStream.feed declares `throws SofabException`, but a rejection raised by
generated code inside the Visitor -- every schema-bound check (MESSAGE_SPEC
7.1) and every receiver cap (6.2.1) -- left feed still wrapped in the
UncheckedIOException carrier that let it cross the Visitor interface. A
caller catching what the signature promised never caught it; crucible's
Java driver had been unwrapping getCause() itself to cope.

feed already unwrapped the cause to latch the terminal verdict, then
rethrew the wrapper. It now rethrows the cause, for every code: INVALID_MSG,
LIMIT_EXCEEDED (whose wrapped delivery had been documented as API) and a
visitor's own ARGUMENT. The repeat of a latched LIMIT_EXCEEDED is a plain
SofabException too. An UncheckedIOException whose cause is not a
SofabException -- the visitor's own I/O failure -- still passes through as
thrown, and inside a callback the carriers (Sofab.invalid / limitExceeded /
argument, Seq, PayloadAcc) are unchanged: a Visitor method still cannot
throw a checked exception.

Source-breaking, recorded as (d) in pom.xml's 0.13.0 block. The tests that
asserted the carrier at the feed boundary now assert SofabException, and
the "whichever carrier" fallbacks in Decode.verdict, BooleanTolerantTest
and HeaderLimitsTest are gone so an escaping carrier fails instead of
being silently unwrapped.

Closes #129

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Andste82
Andste82 force-pushed the fix/feed-unwraps-visitor-rejection-129 branch from df2fc1e to d052b30 Compare October 14, 2026 05:28
@Andste82
Andste82 merged commit 68bbd5a into main Oct 14, 2026
4 checks passed
@Andste82
Andste82 deleted the fix/feed-unwraps-visitor-rejection-129 branch October 14, 2026 05:42
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.

IStream.feed rethrows the UncheckedIOException carrier instead of the documented SofabException

1 participant