The stream header width belongs to the record version - #1746
Merged
fog-workflows[bot] merged 1 commit intoSep 9, 2026
Merged
Conversation
The multicast identity header is 128 bytes, and that number is also written into FOS as a dd count. Nothing on the wire carries it, so the two sides cannot negotiate it and nothing compared them. Make the width a property of the record version instead: a FOGMC1 record is 128 bytes, on this side and on FOS's. The test pins the PAIR rather than the number, so a width change that keeps the magic fails here. Changing the width therefore means bumping the magic, and an old client meets FOGMC2, fails its tag test and names the version it cannot read -- instead of taking the wrong number of bytes off a record it cannot frame and dying somewhere inside the decompressor. That is the whole enforcement, and it is deliberately per-repo: neither side has to check the other out, and neither CI depends on the other. The FOS harness compares the two directly when both trees are on one machine, and says when it could not. Verified by mutation: widening the constants while keeping FOGMC1, and bumping the magic while keeping the width, each turn the test red on the named check. The paired client change is FOGProject/fos#180, which closes fos#179. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A767exFmz6sQUcuZofqE1V
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.
Server half of FOGProject/fos#179. Client half is FOGProject/fos#180.
The problem
The multicast identity header is 128 bytes. That number lived in
STREAM_HEADER_FORMATandSTREAM_HEADER_BYTEShere, and again as add bs=1 count=128in FOS. Nothing on the wire carries the width, so the two sides cannot negotiate it, and no check compared them. ADR-0018 recorded it as a known gap.The failure mode was already safe — a mismatched width feeds the decompressor the wrong bytes and the deploy fails — but it fails a long way from its cause.
The fix
Make the width a property of the record version. A
FOGMC1record is 128 bytes, and nothing else.tests/multicast-streams-are-self-identifying.test.phpnow pins the pair rather than the number: the format's magic and the byte width are asserted together, with a message that says what to do. FOS pins the same pair on its side. So a width change that keeps the magic fails a check on whichever side changed it.Changing the width therefore means bumping the magic, and an old client then meets
FOGMC2, fails its tag test, and names the version it cannot read.This is deliberately per-repo enforcement. Neither repo has to check the other out and neither CI depends on the other. The FOS harness compares the two directly when both trees sit on one machine, and prints a line when it could not.
Verification
Mutation-verified — each turns the test red on the named check:
STREAM_HEADER_FORMATwidened to%-152sandSTREAM_HEADER_BYTESto 160, magic unchanged → "a FOGMC1 record is 128 bytes"FOGMC2, width unchanged → "the record magic is FOGMC1"Full suite 349 passed / 0 failed. Both phpstan passes clean. us-spelling clean.
Downstream
None. No route, no schema, no class list.
🤖 Generated with Claude Code
https://claude.ai/code/session_01A767exFmz6sQUcuZofqE1V