fix(update): split End-without-Begin from hash failure; coalesce drop-block log spam (VA-96) #97
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/VA-96-self-update-no-session"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the self-update failure tracked in #VA-96, where a server-initiated transfer was observed dropping thousands of
AgentUpdateBlockframes with "no active session", then logging a phantomself-update payload failed hash check; staged file deletedfor anEndthat arrived with noBegin.What changed
EndOutcome::NoSession. AnAgentUpdateEndwith no in-flight session no longer reusesHashMismatch;net.rslogs that no transfer was in progress and nothing was staged, instead of the misleading hash-failure/deleted-file message that implied a payload was received and verified.BlockOutcome::NoSessionand aDropBurstcoalescer. Orphan blocks (no acceptedBegin) are tallied (count, total bytes, first and lastrequest_id) and summarized in one log line per burst, flushed on the nextBegin/End/in-session block or at a 1024-block cap. This replaces the per-blockwarn!that flooded journald with thousands of identical lines in under a second.AgentUpdateBlockexcluded, since those are tallied by the coalescer). ABeginis 4 bytes and anEndis 52, so this makes visible whether the server ever sends an acceptedBegin.Tests
end_without_begin_is_no_session_not_hash_mismatch:Endwith no session yieldsNoSessionand creates no staged file.real_hash_mismatch_still_deletes_staged_file: a genuine mismatch still yieldsHashMismatchand deletes the staged file.block_without_session_returns_no_session: orphan block returnsNoSession.drop_burst_*: the coalescer accumulates first/last/count/bytes, is a no-op when empty, and auto-flushes at the cap to keep output bounded.just pre-commitpasses (fmt, clippy with--deny warnings, build, workspace lib tests).Out of scope (still open under #VA-96)
Confirming the root cause of why a
Beginis never accepted requires a field capture with the new opcode/frame-length diagnostics deployed (default verbosity will not show the debug line; bumpRUST_LOGto includevervain_agent::net=debug). If that capture shows a server-side protocol mismatch, the server fix will be filed and linked as a separate issue. This PR makes the failure observable and non-destructive without masking the underlying defect.