GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — id(world): restore's EntityImported epoch check uses plain + 1 — prior=u64::MAX wraps to an accepted epoch 0 in release and panics in debug/test · Issue #3961 · developing-today/code

id(world): restore's EntityImported epoch check uses plain + 1 — prior=u64::MAX wraps to an accepted epoch 0 in release and panics in debug/test #3961

New issue
Copy link
New issue
Copy link
Closed
#4505
Closed
id(world): restore's EntityImported epoch check uses plain + 1 — prior=u64::MAX wraps to an accepted epoch 0 in release and panics in debug/test#3961
#4505
Copy link
Assignees
dezren39
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/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobsource/design-architectFiled by the repo design architect jobtask/triageQueue packet kind: verify, reproduce, and route this item

Description

@dezren39
dezren39
opened on Nov 1, 2026
Issue body actions

Finding

WorldCore::restore's standalone EntityImported journal arm validates the owner-epoch advance with a plain + 1 on a u64:

// pkgs/id/src/world/core.rs:367-370 (restore, JournalEntry::EntityImported arm)
ensure!(
    new_owner_epoch == prior_owner_epoch + 1,
    "journal import for handoff {handoff_id:?} does not advance the owner epoch"
);

prior_owner_epoch / new_owner_epoch are u64 (pkgs/id/src/world/mod.rs:513, :814), and pkgs/id/Cargo.toml sets no overflow-checks override in any profile, so the check behaves differently by build:

  • Release (overflow checks off): prior_owner_epoch = u64::MAX, new_owner_epoch = 0 satisfies 0 == MAX + 1 (wrapping) — restore accepts an import whose owner epoch wraps to 0, i.e. the epoch goes backwards to the start. Owner epochs are the fencing currency for the region-seam handoff (id: implement: journaled region-seam export/import #3870 phases 2–5 build on this foundation): an epoch that can wrap to 0 defeats the monotonicity the fence relies on.
  • Debug / test (overflow checks on): the same journal entry panics with attempt to add with overflow inside restore, so a crafted or corrupted journal crashes the restore path instead of being refused with the arm's own error message.

Evidence (main 9268223, verified this run)

  • pkgs/id/src/world/core.rs:368 — the plain + 1 above (file md5 6b67846b2091c327ba9af2cdf93b687a, identical on the sandbox clone and the laptop clone).
  • Laptop probe ~/git/fleet/probe-2026-11-01-laneA-epochwrap/ — the verbatim predicate extracted from core.rs:367-370, compiled with plain rustc on the laptop:
    • Release (rustc -O): controls correct — prior=5 new=6 → true, prior=5 new=5 → false, prior=5 new=7 → false; wrap case prior=MAX new=0 → true, prior=MAX new=MAX → false.
    • Debug (rustc, overflow checks on): controls correct; the wrap case panics (attempt to add with overflow, exit 101) before it can return a verdict.
  • Sibling checks in the same restore already avoid plain arithmetic where it matters: the checkpoint consecutiveness check is the subject of id(world): restore's checkpoint consecutiveness check uses plain + 1 — a penultimate u64::MAX sequence panics in debug/test builds and wraps to an accepted MAX → 0 step in release #3736, and since_checkpoint accounting uses saturating_add (core.rs, EntityExported/EntityImported arms).

Why it matters

This arm is the validating path for journal-carried imports — the checkpoint-carried variant is separately unvalidated (#3942). A handoff import at the last representable epoch is exactly the boundary a fencing epoch must never cross silently: in release it restores as a legitimate advance to epoch 0 (a stale owner's epoch-0 claims become current again), and in debug/test builds the same input is a panic in the restore path rather than a clean refusal. The fix is the checked form used elsewhere in the codebase (checked_add(1) compared against Some(new_owner_epoch), or equivalent), so prior = u64::MAX can never validate an import.

Acceptance criteria

  • WorldCore::restore refuses a standalone EntityImported journal entry with prior_owner_epoch = u64::MAX (any new_owner_epoch) with the existing "does not advance the owner epoch" error — in both debug/test and release builds, with no panic and no wrapping acceptance.
  • Ordinary advances still restore: prior=5, new=6 succeeds; prior=5, new=5 and prior=5, new=7 are still refused.
  • A regression test in pkgs/id/src/world/tests.rs (alongside the existing handoff restore tests) covers the u64::MAX prior epoch case.
  • The same plain-+1 pattern is checked for the other epoch/sequence comparisons added by the id: implement #3870 phase 1 — journal/schema/checkpoint foundation for region-seam handoff #3900 handoff foundation, and any sibling site found is either fixed in the same change or filed separately with a link here.

Dedup: #3736 (open) is the checkpoint event-sequence consecutiveness pair[1].sequence == pair[0].sequence + 1 at core.rs:476 — a different field, arm, and consequence. #3942 (open) covers checkpoint-carried transfers being installed verbatim with no validation at all; its probe exercised the standalone arm only at epoch 5→5, which this arm correctly refuses — the overflow boundary of the standalone arm's own check was not covered. #3902/#3903/#3904 (open) are the #3870 destination-import/coordinator/client phases that build on this foundation; none fixes the phase-1 restore check.

Activity

  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    priority/lowNice to have; do when convenient
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 1, 2026
  2. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a cron run 2026-11-01T20:05Z (America/Chicago 14:05)
    • Found via: filed this run
    • Task: Triage the plain-+1 owner-epoch advance check in WorldCore::restore's standalone EntityImported arm (core.rs:368): at prior=u64::MAX it wraps to an accepted epoch 0 in release and panics in debug/test; route the checked-arithmetic fix.
    • Expectation: effort/s — done when restore refuses the MAX-prior import in all build profiles (no panic, no wrap) and a regression test covers it in pkgs/id/src/world/tests.rs.
    • Links: Evidence in the issue body; laptop probe ~/git/fleet/probe-2026-11-01-laneA-epochwrap/ (verbatim predicate @92682232, core.rs md5 6b67846b). Distinct from issue id(world): restore's checkpoint consecutiveness check uses plain + 1 — a penultimate u64::MAX sequence panics in debug/test builds and wraps to an accepted MAX → 0 step in release #3736 (checkpoint sequence +1) and issue id(world): WorldCore::restore installs checkpoint-carried handoff transfers unvalidated — duplicate sides, non-advancing import epochs, and sequence-claiming transfer events all accepted, unlike the standalone entries #3942 (checkpoint-carried transfers unvalidated).
  3. dezren39
    added a parent issue on Nov 1, 2026
    • Design: reconstruction is admission, continued — carried state, checked succession, and every restore's guards (pkgs/id follow-on to #2898) #4000
  4. dezren39
    added
    source/design-architectFiled by the repo design architect job
    on Nov 1, 2026
  5. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · adopted as Phase 2 of design #4000

    • Agent: design architect (repo-design-architect-code), pass 34
    • Task: This issue is Phase 2 of design Design: reconstruction is admission, continued — carried state, checked succession, and every restore's guards (pkgs/id follow-on to #2898) #4000 (with id(world): restore's checkpoint consecutiveness check uses plain + 1 — a penultimate u64::MAX sequence panics in debug/test builds and wraps to an accepted MAX → 0 step in release #3736). Triage: do NOT re-file, re-scope or split it; record the phase structure instead.
    • Decision recorded on Design: reconstruction is admission, continued — carried state, checked succession, and every restore's guards (pkgs/id follow-on to #2898) #4000 that binds this phase: the EntityImported epoch-advance predicate becomes a checked-successor comparison (checked_add(1) == Some(new_owner_epoch)), NOT saturating_add — saturation would accept prior=MAX,new=MAX as an "advance". Refusal must be the arm's own "does not advance the owner epoch" error in both build profiles (no wrap to epoch 0 in release, no panic in debug). Include the prior=u64::MAX boundary tests. Interaction: Phase 1 (id(world): WorldCore::restore installs checkpoint-carried handoff transfers unvalidated — duplicate sides, non-advancing import epochs, and sequence-claiming transfer events all accepted, unlike the standalone entries #3942) reuses this checked form for checkpoint-carried imports; whichever lands second writes that predicate in its final shape exactly once.
    • Outcome: Linked as a sub-issue of Design: reconstruction is admission, continued — carried state, checked succession, and every restore's guards (pkgs/id follow-on to #2898) #4000; labelled source/design-architect. Existing queued triage packet stands.
    • Links: Design: reconstruction is admission, continued — carried state, checked succession, and every restore's guards (pkgs/id follow-on to #2898) #4000, id(world): restore's checkpoint consecutiveness check uses plain + 1 — a penultimate u64::MAX sequence panics in debug/test builds and wraps to an accepted MAX → 0 step in release #3736, id(world): WorldCore::restore installs checkpoint-carried handoff transfers unvalidated — duplicate sides, non-advancing import epochs, and sequence-claiming transfer events all accepted, unlike the standalone entries #3942
  6. github-actions
    assigned
    dezren39
    on Nov 1, 2026
  7. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    🤖 Agent note · triage-verified (queue task 5902, repo-worker-code, OpenChamber scheduled lane)

    • Fresh evidence: id(world): restore's EntityImported epoch check uses plain + 1 — prior=u64::MAX wraps to an accepted epoch 0 in release and panics in debug/test #3961 OPEN. Plain + 1 still present on current main 29da46385 at core.rs:401; no overflow-checks override in any pkgs/id profile (dev/test default on, release default off).
    • Reproduced this run (verbatim predicate via rustc 1.98.1): release (-O) controls correct, wrap case MAX->0 → true (accepts backwards epoch); debug panics attempt to add with overflow (exit 101). Bug confirmed, not inferred.
    • Siblings: core.rs:510 (pair[1].sequence == pair[0].sequence + 1) is id(world): restore's checkpoint consecutiveness check uses plain + 1 — a penultimate u64::MAX sequence panics in debug/test builds and wraps to an accepted MAX → 0 step in release #3736 territory, tracked separately; core.rs:259,1026 already use checked_add. Only :401 is this issue.
    • Disposition: triaged — defect real, narrow fix (checked form), low risk. Enqueuing small-fix follow-up per the issue acceptance criteria; no fix implemented in this triage run.
  8. dezren39
    removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 2, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done (queue task 5902, repo-worker-code)

    • Outcome: triaged. Findings comment above; follow-up small-fix enqueued as queue task 6266.
    • Labels: removed queue/queued, status/needs-triage (triage complete; fix tracked by task 6266).
  10. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    on Nov 2, 2026
  11. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    agent-note:v1
    task: 6266
    lane: code-e
    state: picked-up
    note: Claimed by lane E worker (direct execution lane). Revalidating restore EntityImported epoch check against fresh main; fix is checked_add form + u64::MAX regression test per acceptance.

  12. dezren39
    closed this as completedin #4505on Nov 2, 2026
  13. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 2, 2026
  14. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    agent-note:v1
    task: 6266
    lane: code-e
    state: done
    note: Fixed and merged in PR #4505 (merge 31f924b). Restore EntityImported arm now uses checked_add(1) == Some(new_owner_epoch); new regression test handoff_import_at_max_owner_epoch_is_refused covers new = 0, 1, u64::MAX at prior = u64::MAX. Verified on laptop: cargo test --lib handoff_ 4/4 pass, cargo test --lib world:: 156/156 pass. Codex review: no findings. Sibling plain-+1 site is the checkpoint sequence check, already filed as #3736. Full cargo test on pkgs/id also shows pre-existing unrelated integration-test compile errors on main (ChainExt missing link field in tests/*.rs, missing tic-tac-toe.wasm) — not touched by this change.

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

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

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/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobsource/design-architectFiled by the repo design architect jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.