Relay: act on Prior Group/Object ID Gaps across Objects (§2.1, §9.1, §12.8) - #104
Merged
Merged
Conversation
…9.1, §12.8) The relay checked only the gap rules decidable from one Object. It now records every Prior Group and Object ID Gap in the dedup ledger (same 32-Group window and lock) and, on live subgroup and datagram Objects: - drops an Object inside a gap announced earlier, or in a Group a gap covered: it is known not to exist, permanently (§2.1), so it is neither forwarded nor cached (§9.1 SHOULD NOT); - accepts a gap covering an Object or Group already received: an Object may go from existing to not existing (§2.1); - ends the track when one Group carries two Prior Group ID Gap values (§12.8): PUBLISH_DONE MALFORMED_TRACK, the Object not cached. Interpretation, chosen with the user and marked in ClaimDelivered and STATUS.md: §12.8/§12.9 list the first two cases as malformed, but §2.1 says the first "is not a protocol error and the Track is not malformed". §9.1's specific rule is also taken over §9.4's general MUST NOT drop. API: message.ObjectPriorGaps (one zero-alloc walk; PriorObjectIDGap delegates to it). Internal: TrackEntry.ClaimDelivered takes the gaps and returns an error for a malformed track; a rejected Object leaves no state. runFanout's three malformed paths share one closure. Tests, each verified red with its behaviour disabled: TestTrackEntry_ClaimDeliveredGapProperties (forwarded / dropped / malformed), _MalformedLeavesNoTrace, TestObjectPriorGaps, TestRelay_ObjectInsideAnnouncedGapDropped (subgroup and datagram; the FETCH afterwards serves the next Object, not the dropped one), and TestRelay_MalformedObjectEndsTrack's two different-values cases. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Summary
Until now the relay checked only the Prior Group ID Gap (§12.8) and Prior Object ID Gap (§12.9) rules that a single Object can show on its own. It now records every gap it sees, in the dedup ledger
TrackEntryalready keeps (same 32-Group window, same lock). On live subgroup and datagram Objects it:A rejected Object leaves no state in the ledger.
Interpretation (marked per CLAUDE.md; chosen with you)
The draft conflicts with itself here:
The relay follows §2.1 and §9.1. It also takes §9.1's specific SHOULD NOT over §9.4's general "MUST NOT reorder or drop objects received on a multi-object stream". The reasoning is in the
ClaimDelivereddoc and a new STATUS.md Limitations entry.If that's wrong: the two drop paths would end the track instead, and the
forwarded/droppedoutcomes inTestTrackEntry_ClaimDeliveredGapPropertieswould becomemalformed.API
message.ObjectPriorGaps(raw) PriorGapsreads both gaps in one pass, without allocating.PriorObjectIDGapnow calls it.registry.TrackEntry.ClaimDelivered(group, object, gaps) (fresh bool, err error).Not covered (listed in STATUS.md; §12.8/§12.9 stay PARTIAL)
Tests (each verified red with its behaviour disabled)
TestTrackEntry_ClaimDeliveredGapPropertiescovers forwarded, dropped and malformed outcomes, including a Group covered after it arrived.TestTrackEntry_ClaimDeliveredMalformedLeavesNoTracechecks that a malformed Object records nothing.TestObjectPriorGaps, including a zero-allocation check.TestRelay_ObjectInsideAnnouncedGapDroppedcovers a subgroup Object gap, a datagram Object gap and a datagram Group gap. The Object inside the gap is never forwarded, the next Object arrives, and a FETCH afterwards serves the next Object but not the dropped one.TestRelay_MalformedObjectEndsTrackhas two cases where one Group carries two gap values, on subgroups and on datagrams.-raceandmake bench-quickall pass, with no allocs/op increase. The benchmark Objects carry no properties.🤖 Generated with Claude Code