Skip to content

fix(id): reject non-canonical -0.0 tuple FLOAT64 keys - #3436

Closed
dezren39 wants to merge 1 commit into
mainfrom
queue/5315-2421-negative-zero
Closed

dezren39 wants to merge 1 commit into
mainfrom
queue/5315-2421-negative-zero

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

FLOAT64 decode: reverse sort transform -> reject NaN -> reject sign-negative zero -> return value

Reject the unreachable stored -0.0 payload while preserving canonical zero encoding and other float values. Fixes #2421.

Evidence

  • Before: the focused regression failed because the decoder accepted [0x21, 0x7F, 0xFF x7].
  • After: cargo test --manifest-path pkgs/id/Cargo.toml --no-default-features --lib tuple::tests — 52 passed. git diff --check — clean.
  • A broader --lib run stopped at an unrelated stack overflow in cli::tests::test_cli_parse_cat; the packet command without --lib also tries integration tests requiring the disabled world feature.

Merge Danger

Door: two-way

Blast Radius: low — FLOAT64 decoding only; encoder and other tuple branches are unchanged.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 09:57
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 48 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1a69837-0c71-4de3-ac4a-9d85fa8dd097
Commits

Reviewing files that changed from the base of the PR and between a17ae13 and 49a48da.

Files selected for processing: 1
  • pkgs/id/src/tuple.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T08:58:57.681030Z 49a48da PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39

dezren39 commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

🤖 Agent note · handed off (superseded)

Salvage note (§8): diffed this PR's added lines against #5026's line-by-line (comment-stripped) — the rejection guard (v != 0.0 || !v.is_sign_negative()), the zero-canonicalization assertion (both signs encode identically), and every boundary roundtrip are all present in the new PR, comment-level detail included. Nothing unique: the only differences are comment wording and line wrapping. Closing this one; work continues on #5026.

@dezren39

dezren39 commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Superseded by #5026, which re-implements this fix at the post-move path . Salvage verdict recorded in the note above: nothing unique remains diffable on this PR.

@dezren39 dezren39 closed this Nov 3, 2026
dezren39 added a commit that referenced this pull request Nov 10, 2026
The FLOAT64 decoder reversed the sort transform and rejected NaN but
admitted the stored form of -0.0, which the encoder can never emit: push_f64
canonicalizes both zero signs to +0.0. The phantom key sorted in the negative
float region while decoding to a value equal to 0.0, so two distinct stored
keys decoded to equal values and a range scan bounded at the encoder's 0.0 key
never saw it.

Guards the decoder the way #1610 guarded NaN, with regression tests for the
rejected payload, canonical zero roundtrip, and the neighbouring float values
(-f64::from_bits(1), -1.5, ±infinity). Path is the post-workspace-move
pkgs/id/crates/id-core/src/tuple.rs; the earlier PR #3436 targeted the old
pkgs/id/src/tuple.rs path.
@dezren39
dezren39 deleted the queue/5315-2421-negative-zero branch November 14, 2026 20:02
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.

id(tuple): decode admits the -0.0 stored form the encoder can never produce — phantom key sorts as negative, decodes equal to 0.0

1 participant