Repository navigation
test(remote): measure the lean lane as received, over real E2EE - #854
Merged
Merged
Conversation
The existing lane tests count bytes at the FakeNats tap while the state runs Transport::legacy_fixture(), i.e. plaintext before encryption. Add a harness that wires the production v2 path instead — one secure::Transport shared by the command loop and the event drain (build_transport), a phone-side Channel from the real secure_pair handshake, and a subscription whose messages are counted on receipt and again after Channel::open. Every record is asserted to be a sealed one (FRE2 prefix, wire == plaintext + HEADER + TAG). It measures both declaration states over the same journal (live lane) and both get_session_entries shapes (full and before-paged), asserting the undeclared state is byte-identical to the source and that withdrawing the declaration restores it. The ignored measure_real_e2ee_bytes test replays a real run dump supplied by scripts/verify-e2e-bytes.py (read-only agent.db + grpcurl dump of the real history page, protojson int64 strings converted back to numbers).
`scripts/` was reorganized by #847 while this branch was open, and it settled on `scripts/measure/` for measurement scripts. Moving this one there is more than a path change: the script located the repo root with `parents[1]`, which was correct at `scripts/` and points at `scripts/` itself one level deeper. It now matches the two siblings already in that directory (`parents[2]`), verified by resolving the path and by `--help`. The doc comments and the test's `#[ignore]` reason were updated with it.
huichen
enabled auto-merge (squash)
September 25, 2026 19:46
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.
The trims (#841–#846, #849, #851) were all measured the same way: reconstruct the desktop's published body in Python, or observe the
FakeNatstap. Both are models of the wire, and the second one is worse than it sounds — the lane tests next door run withTransport::legacy_fixture(), which seals nothing, so their tap counts plaintext before encryption.This adds a measurement of what a client actually receives and decrypts.
What it wires
build_transport()with onesecure::Transportshared by the command loop and the event drain, so events go through the real ordered queue.secure_pair()(NoiseXXpsk0, PSK from the invitation URL) plus an independent NATS connection.FRE2prefix andwire == plaintext + HEADER_LEN(28) + TAG_LEN(16). A plaintext path cannot satisfy that, which is what makes this a measurement of the wire rather than of a model.Covers the live lane, and the history page on both shapes the phone uses (
get_session_entriesfull, andbefore+limitpaged). Two states are flipped by declaring or withdrawinglean_events_v1through the realapply_declared_features, and the undeclared state is asserted byte-identical to the source journal — including after withdrawing the declaration, which catches a lane that latches.Measured (three heaviest real runs, 2026-09-26)
Scope, stated in the report itself
FakeNats(real core-NATS line protocol, not an external process). The real-broker rerun is a separate task,todo_2d5e8b4fb8d9.lean_events_v1is flipped, to isolate its effect — the phone also declares coalescing and gzip, so its absolute numbers are only smaller.Included here: the ignored measurement test (
measure_real_e2ee_bytes) andscripts/measure/verify-e2e-bytes.py, which dumps a real run's journal from the read-onlyagent.dband the real history page via grpcurl (converting protojson int64 strings back to numbers —SessionEntryPayload'sdeny_unknown_fields+i64would otherwise fail to decode the whole page).Verification
cargo test --lib verify_e2e→ the self-contained fixture test passes; the measurement is#[ignore]and driven by the script.cargo fmt --check+cargo clippy --all-targets -- -D warningsclean on pinned 1.97.Two flakes seen in one full run and gone on a re-run (
instance::…excludes_second_owner…,remote::commands…desktop_settings_management_is_shared_and_allowlisted). This branch touches three files — a new#[cfg(test)]module, its declaration, and the script — and none of them registers a command or touches an allowlist, so neither can be caused by it.