Repository navigation
fix(istream): feed throws the SofabException it declares for visitor rejections (#129) - #130
Merged
Merged
Conversation
…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
force-pushed
the
fix/feed-unwraps-visitor-rejection-129
branch
from
October 14, 2026 05:28
df2fc1e to
d052b30
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
IStream.feeddeclaresthrows SofabException, but a rejection raised by generated code inside theVisitor(schema bounds, MESSAGE_SPEC §7.1; receiver caps, §6.2.1) reached the caller still wrapped in theUncheckedIOExceptioncarrier.feedalready unwrapped the cause to latch the terminal verdict, then rethrew the wrapper.It now rethrows the
SofabExceptionfor every code:INVALID_MSG,LIMIT_EXCEEDEDand a visitor-raisedARGUMENT. After aLIMIT_EXCEEDEDrefusal, every laterfeedcall also throws a plainSofabExceptionwith that code.What doesn't change
INVALID_MSG/LIMIT_EXCEEDEDlock the decoder into the refused state by code, and a visitor-raisedARGUMENTdoesn't.UncheckedIOExceptionwhose cause is not aSofabException(the visitor's own I/O failure) passes through as thrown, and the decoder stays usable.Sofab.invalid/limitExceeded/argument,SeqandPayloadAccstill throw the wrapper. Visitor methods can't throw a checked exception, so they must.Sofab.API_VERSIONstays 1.Breaking
This is source-breaking for callers that caught
UncheckedIOExceptionaroundfeedand readgetCause(); they catchSofabExceptioninstead. It is recorded as (d) in the 0.13.0 list of breaking changes inpom.xml(0.13.0 is unreleased). The generatedtryDecode/Decoder.feedjavadoc already says only@throws SofabException, and becomes true with no generator change.Tests
feedboundary now assertsSofabException(LimitExceededIsTerminalTest,InvalidIsTerminalTest,ReceiverCapTest,SequenceGrowthTest,Utf8StrictTest,Utf8ChunkOffsetTest,SofabTest).common/Decode.verdict,BooleanTolerantTestandHeaderLimitsTest. Without them, a wrapper escapingfeedfails the tests instead of being quietly unwrapped.mvn verify: 1620 tests, 0 failures.Closes #129
🤖 Generated with Claude Code