Skip to content

feat(sync): read every payload as exactly one gzip member - #457

Open
A-EDev wants to merge 1 commit into
mainfrom
feat/sync2-payload-one-gzip-member
Open

A-EDev wants to merge 1 commit into
mainfrom
feat/sync2-payload-one-gzip-member

Conversation

@A-EDev

@A-EDev A-EDev commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

A payload's body must now be exactly one gzip member, as flow-sync #102 specifies, so libraries that read gzip framing differently can't take different data from one signed object.

  • The body must start with 1f 8b 08 00, so FLG is 0. MTIME, XFL and OS aren't checked.
  • Nothing may follow the member. This uses bufread::GzDecoder rather than read::GzDecoder, because the latter's internal buffer swallows what follows the member, so into_inner couldn't see it.
  • GzDecoder still checks the CRC-32 and ISIZE.
  • The 64 MiB stop stays as the read's limit. A read that stops there leaves the trailer unread, so the leftover check refuses it, and the separate length comparison had nothing left to catch.
  • This device's own payloads still round trip, and the limit is tested on both sides.
  • Vectors from flow-sync 345a836, byte for byte. The fixtures README is that commit's whole file, which also brings its pairing line up to date.

Follows flow-sync #102.

Related issue

None.

Change type

  • Feature

Validation

Run on macOS arm64.

  • pnpm test: not run, no frontend file changed
  • pnpm build: not run, no frontend file changed
  • cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --check: exit 0
  • cargo clippy --all-targets --all-features in src-tauri: exit 0, no warnings in the files this changes
  • cargo test --no-fail-fast --all-targets --all-features in src-tauri: 1287 passed, 0 failed, 9 ignored
  • I smoke-tested the affected desktop behavior. Nothing ran in a real window.

Before the change, payloads failed on the new negatives. Checked by breaking the code on purpose, one change at a time, with sync2_vectors:

Change Tests that failed
A flag is allowed 1
No check of the start 1
Leftover bytes are allowed 2
read::GzDecoder, whose buffer hides leftovers 1
The read has no limit 1
The limit is one higher 1
The limit is one lower 1

Risk and compatibility

  • No format or database change. Every encoder writes FLG 0 and one member; this PR tests only this app's encoder.

  • Not run against Android or a server under this rule.

  • Overlaps other open PRs on the fixtures README and the changelog.

  • No new secrets, private data, telemetry, or broad Tauri permissions were introduced.

  • User-facing documentation was updated where needed. (spec/crypto.md in flow-sync [Bug]: Severe UI lag in theatre mode (ResizeObserver layout loop) + main window opens floating/above on Hyprland #102)

  • Dependency and lockfile changes are intentional and limited to this PR. (none)

  • Breaking changes and upgrade steps are clearly documented. (none for honest clients)

Copilot AI balanced review requested due to automatic review settings November 7, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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.

2 participants