Skip to content

fix(id): fuzz numeric invariants compare through f64 — integers above 2^53 lose precision and violated invariants can pass (PR #8635 review finding) #8752

Closed

Description

@dezren39

Finding (from PR review)

The fuzz campaign's numeric invariants convert record values through f64, silently losing integer precision above 2^53 — so a violated numeric_order or numeric_bounds invariant can pass. Records stores serde_json::Value, which preserves these integers exactly; the loss happens only in the campaign's comparison helper.

Codex raised this on PR #8635 (feat(id): deterministic fuzz for id world dev (#5541 phase 4)):

Essence of the comment: with first = 9007199254740993 and second = 9007199254740992, numeric_order sees equal values after conversion although first > second; a numeric maximum of 9007199254740992 similarly fails to reject the larger integer. Preserve integer precision during comparisons, or explicitly reject values and bounds that cannot be checked exactly rather than reporting success.

No-response evidence

Still-live evidence (current main, read 2026-11-11 via gh api, two reads)

pkgs/id/src/world_dev.rs on main:

  • fn numeric(...) (~lines 1378–1387) returns value.as_f64() — a serde_json integer above 2^53 is rounded at this conversion.
  • FuzzInvariant::NumericOrder (~lines 1366–1375) compares the two f64 results with a > b; NumericBounds (~lines 1351–1365) compares against min/max: Option<f64>. Equal-after-rounding values therefore pass both checks.

Acceptance criteria

  • Numeric invariant comparisons are exact for integer record values (e.g. compare as i64/u64/serde_json::Number before any float conversion), or values/bounds that cannot be represented exactly are rejected as a campaign error rather than reported as passing — with regression tests at the 2^53 boundary (9007199254740993 vs 9007199254740992).
  • Or: resolve by a documented decision on this issue explaining why inexact comparison is acceptable for declared invariants.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 11, 2026
  2. developing-today commented on Nov 11, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  4. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up / triaged

    • Agent: queue worker (repo-worker-code), lane code-d
    • Session / ID: task 15005
    • Found via: queue claim
    • Task: Triaged issue fix(id): fuzz numeric invariants compare through f64 — integers above 2^53 lose precision and violated invariants can pass (PR #8635 review finding) #8752 inline and proceeding to the fix in the same claim: fuzz numeric invariants in pkgs/id/src/world_dev.rs compare record values through f64, losing integer precision above 2^53.
    • Triage: work kind task/small-fix; priority priority/normal (Codex P2 on a merged PR, correctness of a declared-invariant checker, no production-path impact — normal fits); effort effort/s; kind/bug already present. First concrete step: replace the f64 comparison path with exact numeric comparison (integer record values and integer bounds compared exactly as integers; non-integer values compared exactly against integer/float counterparts) and add regression tests at the 2^53 boundary.
    • Expectation: effort/s. Done = numeric_order with 9007199254740993 vs 9007199254740992 reports a violation, numeric_bounds with max 9007199254740992 rejects 9007199254740993, existing fuzz tests still pass, PR opened and merged under standing criteria.
    • Links: source PR feat(id): deterministic fuzz for id world dev (#5541 phase 4) #8635 (merged); no branch/PR yet.
  5. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    effort/sSmall: expected under 2 hours of work
    queue/claimedQueue worker lifecycle state
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 11, 2026
  6. 9 remaining items

  7. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up (resume) / Codex finding dispositioned

  8. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 11, 2026
  9. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  10. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    Agent: repo-worker-code / any-a
    State: done (already_done)
    Task: repo-queue task 15018 (triage follow-on of task 15005, enqueued 2026-11-11T19:55:59Z)
    Evidence: the fix landed before this follow-on was claimed — PR #8755 MERGED 2026-11-11T19:53:53Z, merge commit 5a0b771; issue #8752 CLOSED 2026-11-11T19:53:55Z. Verified fresh on main by lane any-a: pkgs/id/src/world_dev.rs now compares via NumericValue::cmp_exact (integers exact, bounds as serde_json::Number; world_dev.rs:1385-1491). No duplicate work done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/pr-comment-reviewFiled by the pr-comment-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions