Skip to content

fix(safety): E2E sequence-gap message reports the wrong "last" counter - #57

Merged
SoundMatt merged 1 commit into
mainfrom
fix/e2e-seq-gap-message
Jul 29, 2026
Merged

fix(safety): E2E sequence-gap message reports the wrong "last" counter#57
SoundMatt merged 1 commit into
mainfrom
fix/e2e-seq-gap-message

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

  • safety/e2e.go's gap-detection branch mutated r.lastSeq to the just-received (gapped) sequence number before using it to build the diagnostic message, so Message always reported recv-1 instead of the actual previously-accepted counter.
  • The gap-detection condition and rejection behavior (returning *E2EError{Kind: ErrSequenceGap}) were correct and unaffected — only the human-readable forensic text was wrong.
  • Capture the previous counter before overwriting r.lastSeq, and lock in the exact message text with an assertion in TestUnwrap_sequenceGap.

Why it matters

This message is forensic/diagnostic text for investigating sequence gaps — a safety-relevant condition per REQ-SAFETY-009. A misleading "last" value undermines root-cause analysis after a real fault.

Closes #49

Test plan

  • go build ./..., go vet ./...
  • go test -race -count=1 ./... — all green, including the updated TestUnwrap_sequenceGap
  • gofusa check/trace/verify (v0.36.0, this repo's current CI pin) — all green

safety/e2e.go's gap-detection branch set r.lastSeq to the just-received
(gapped) sequence number *before* using it to build the diagnostic
message, so "last=%d" in the E2EError.Message always printed recv-1
instead of the actual previously-accepted counter. The gap-detection
condition and rejection behavior were unaffected — only the forensic
message text was wrong, which misleads anyone debugging a sequence gap
from logs (a safety-relevant condition per REQ-SAFETY-009).

Capture the previous counter before overwriting r.lastSeq, and assert
on the exact message text in TestUnwrap_sequenceGap so this can't
silently regress again.

Closes #49

Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit 5c8c683 into main Jul 29, 2026
14 checks passed
@SoundMatt
SoundMatt deleted the fix/e2e-seq-gap-message branch July 29, 2026 15:20
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.

safety/e2e.go: sequence-gap error message reports wrong "last" counter (mutated before read)

1 participant