-
Notifications
You must be signed in to change notification settings - Fork 137
Tighten Wire edge-case handling, add URL append support
#1240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
peter-lawrey
wants to merge
15
commits into
develop
Choose a base branch
from
adv/develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,501
−3,427
Conversation
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
….adoc` as the primary entry point
append support
james-mcsherry
approved these changes
Nov 20, 2025
… KeyedMarshallable for cleaner code
|
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.



This PR makes a series of small functional changes around
Wireedge-cases and configuration, adds URL-level control for file append semantics, and updates the third-party BOM ro 3.27ea7. It also layers in a lot of documentation and test coverage, but those are secondary to the behaviour changes below.Functional changes
1. Minor, but real, functional clean-ups
These are smaller behaviour tweaks rather than big features:
SelfDescribingTriviallyCopyabledescriptionfield consistently instead of re-calling$description()when validating and copying; makes the logic more robust if the description is cached or overridden.QueryWirecomment/documentation and small refactorInternal renaming (
sep→separator) and Javadoc updates with no change to encoded wire format.The tests add coverage for:
value%2Bplus+space) surviving round-trip.ServicesTimestampLongConverterlongFunctiontoLongUnaryOperatorand keeps the same semantics; the public API (toTime,parse,asString) is unchanged.Misc switch
default:branchesBinaryWire,TextWire,YamlWire, etc., now have explicitdefault: break;branches, making future additions safer and preventing accidental fall-through.2. Safer reference bindings in
BinaryWireandRawWireFiles:
BinaryWire.javaRawWire.javaBefore:
Methods such as
int32forBinding,int64forBinding, andboolForBindingassumed that theIntValue/LongValue/BooleanValuearguments were of the concrete binary reference types and casted directly:Passing the wrong implementation (e.g. a different
IntValueimplementation) would cause aClassCastExceptionat runtime with a fairly unhelpful message.After:
New helper:
BinaryWire.BinaryValueOutnow usesrequireReferencein:RawWire.RawValueOutlikewise usesrequireReferencefor the same binding methods.Impact:
IllegalArgumentExceptioninstead of aClassCastException, making misconfigurations easier to diagnose and avoiding obscure errors deep in the binding path.3. Enforce
WriteBytesMarshallablewhenusesSelfDescribingMessage()isfalse(BinaryWire)File:
BinaryWire.javaBefore:
useSelfDescribingMessage(object)returnedfalsefor an object that did not implementWriteBytesMarshallable, this code would throw aClassCastExceptionat runtime.After:
Impact:
usesSelfDescribingMessage()isfalse, objects must genuinely beWriteBytesMarshallable. If not, you now get a clearly classifiedInvalidMarshallableExceptionwith a helpful message.4. Robust
bytes(...)copying into arbitraryBytesOut(BinaryWire)File:
BinaryWire.javaBefore:
toByteswas not actually aBytesinstance (e.g. some customBytesOut), this cast would throw aClassCastException.After:
A helper that can target any
BytesOut:And in
bytes(...):Impact:
BinaryWirenow correctly supports non-BytesBytesOutimplementations when copying a textual value.Bytestargets behave exactly as before; only previously broken/non-supported cases now work instead of throwing.5.
DefaultValueInrobustness for defaults and referencesFile:
DefaultValueIn.javaSafer
bytesMatch(...)when default isn’t aBytesStore:Before:
defaultValuewasn’t actually aBytesStore, this would fail with aClassCastException.After:
Impact:
falsewhen the default isn’t aBytesStoreinstead of blowing up; the API contract becomes “no match” rather than “crash”.Gracefully handling
nullIntValue/LongValuein reference-binding readers:Before:
After:
Similar change for
int32(...).Impact:
nullfor the reference argument and still get a valid reference created and passed to the setter. Previously this would crash; now it behaves sensibly.bool()default check hardened:defaultValueis a boxed Boolean coming through a different identity.6. URL
?append=support forFileMarshallableOutFile:
FileMarshallableOut.javaBefore:
FMOOptionsobject, loaded throughQueryWirefrom the URL query string. If the query wasn’t in the expected form,appendwould silently remainfalse.After:
New parsing for a plain
appendquery parameter:parseAppendFlag(...)decodes the query and looks forappend=...:decodeComponentusesURLDecoderwith UTF-8 and wraps errors inIORuntimeException.Impact:
Call-sites can now reliably control append vs overwrite semantics with URL query strings like:
file:///path/to/out.yaml?append=trueExisting
QueryWire-style options still work; the explicit parsing only sets a default before reading structured options.7. Guard
MessageHistory.writeHistoryagainst non-WriteDocumentContextFile:
MessageHistory.javaBefore:
DocumentContextpassed in wasn’t aWriteDocumentContext, this would throw aClassCastException.After:
Impact:
DocumentContextimplementation; it simply no-ops unless it’s aWriteDocumentContextat the start of a message.Non-functional changes (docs, tests, formatting)
While not changing runtime behaviour, these are worth noting:
New agent guides:
CLAUDE.mdandGEMINI.mdprovide detailed instructions for different AI code tools.Documentation consolidation:
Legacy
docs/content moved intosrc/main/docs/.Large number of
.adocfiles updated for::lang: en-GB, ToC, and highlighter settings.Tests:
Many new tests around:
DocumentContextrollback (DocumentContextLifecycleTest).ElasticByteBufferTest,ElasticBytesCapacityTest).DefaultValueInedge cases (DefaultValueInCoverageTest).QueryWireTest).MethodWriterBytesTest,MethodReaderArgumentsRecycleTest, etc.).These do not change behaviour but lock in the new contracts above.
Behavioural summary
No change for normal, correct usage of
Wire,BinaryWire,RawWire,DefaultValueIn, andFileMarshallableOut.Improved failures and diagnostics when:
*forBinding(...).BinaryWirewithusesSelfDescribingMessage == falseon a non-WriteBytesMarshallableobject.MessageHistory.writeHistorywith non-WriteDocumentContexts.DefaultValueIn.bytesMatchwith non-BytesStoredefaults, or null references inint32/int64.New functionality:
?append=flag support forFileMarshallableOut.These changes are mostly hardening/clarification around edge cases and mis-use, plus a dependency BOM bump that may affect downstream behaviour via third-party libraries.