Skip to content

fleet-queue(fallback): parse_ts accepts impossible dates — Feb 31 / non-leap Feb 29 / Apr 31 silently roll into the next month and shift marker lease math by days #6667

Closed

Description

@dezren39

Problem

parse_ts in the queue fallback mode (pkgs/fleet/crates/fleet-queue/src/fallback.rs:151-158) validates the day field only as 1..=31, regardless of month or leap year. Impossible dates are accepted and silently normalized by days_from_civil into a different real date, shifting the parsed epoch by days:

  • 2026-02-31T00:00:00Z → parses as 2026-03-03
  • 2026-02-29T00:00:00Z (2026 is not a leap year) → parses as 2026-03-01
  • 2026-04-31T00:00:00Z → parses as 2026-05-01

Marker timestamps are authoritative for all lease math in fallback mode ("The marker's own embedded ts is authoritative — comment metadata is never consulted for lease math", fetch_markers doc), and parse_marker accepts any marker whose ts parses. So a claim/heartbeat marker stamped with an impossible date gets a silently shifted activity time — up to ~3 days of phantom lease — instead of being rejected as malformed the way a month-13 timestamp already is (ts_round_trip pins 2026-13-06 → None, but no impossible-day case).

Evidence

Verified on the laptop against origin/main @5492f27e02 (probe ~/git/fleet/probe-fallback-contest, real fallback.rs included verbatim, parse_ts/format_ts called directly):

parse_ts(2026-02-31T00:00:00Z) = Some(1772496000) = 2026-03-03T00:00:00Z
parse_ts(2026-02-29T00:00:00Z) = Some(1772323200) = 2026-03-01T00:00:00Z
parse_ts(2024-02-29T00:00:00Z) = Some(1709164800) = 2024-02-29T00:00:00Z   (leap year: correct)
parse_ts(2026-04-31T00:00:00Z) = Some(1777593600) = 2026-05-01T00:00:00Z
parse_ts(2026-01-31T00:00:00Z) = Some(1769817600) = 2026-01-31T00:00:00Z   (control: correct)

Why it matters

Fallback markers are the claim state: a misparsed ts moves last_activity, which decides Live vs Stale, supersede, and contest outcomes. Every other malformed-marker shape (bad month, bad hour, unparseable text) is rejected as "not a marker at all" precisely so near-misses never move claim state — impossible days are the one shape that slips through and actively moves it in the wrong direction.

Acceptance criteria

  • parse_ts returns None for day-of-month values that do not exist in the given month/year (Feb 29 on non-leap years, Feb 30/31, Apr/Jun/Sep/Nov 31), while still accepting 2024-02-29 and all valid dates.
  • ts_round_trip (or a sibling test) gains the impossible-date cases above.
  • Round-trip property preserved: parse_ts(format_ts(e)) == Some(e) for the existing epoch set.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    on Nov 7, 2026
  2. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor
  3. added
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/fleetpkgs/fleet multicall binary + platform crates
    on Nov 7, 2026
  4. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (lane B, new-issue-creator-code-b)
    • Session / ID: new-issue-creator-code-b run, 2026-11-06 19:20 CST
    • Found via: filed this run
    • Task: Small fix: make fallback parse_ts reject day-of-month values that do not exist in the given month/year instead of normalizing them into the next month.
    • Expectation: effort/xs — done when parse_ts returns None for Feb 29 (non-leap)/Feb 30-31/Apr 31, 2024-02-29 still parses, and ts_round_trip gains the impossible-date cases.
    • Links: probe ~/git/fleet/probe-fallback-contest (laptop, real fallback.rs verbatim @5492f27e02)
  5. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-q — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-q posts progress markers; after 30 minutes of silence any other worker may pick this up.)

    🤖 Agent note · picked up

  6. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 7, 2026
  7. 6 remaining items

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

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-l — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-l posts progress markers; after 30 minutes of silence any other worker may pick this up.)

    🤖 Agent note · picked up (resume of parked work)

  10. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Progress from repo-worker-code-l: resumed: PR #6684 verified as a single-file change (fallback.rs +70/-1, fix 9df8a5e + property tests 234e448); Codex on head clean (no findings, none unresolved); re-running cargo test -p fleet-queue --features client on the laptop before merging under the standing criteria (scripts-test still pending in the runner backlog)

  11. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Released by repo-worker-code-l (outcome: done). Issue #6667 FIXED and merged (resume of lane code-q's parked work): PR #6684 #6684 merged be4040c (fix 9df8a5e + property tests 234e448 by lane code-q). parse_ts now validates the day against the real month length with the Gregorian leap rule, so impossible dates (Feb 31, non-leap Feb 29, Apr 31) return None instead of rolling into the next month and shifting fallback lease math. Resume verification by this lane: Codex review on head 234e448 completed with no findings and none unresolved; cargo test -p fleet-queue --features client re-run on the laptop at the PR head: 40 passed / 0 failed (EXIT:0), matching the parked evidence. PR-tier scripts-test was still pending in the runner backlog at merge — merged under the standing merge criteria with locally re-verified tests. Issue auto-closed by the PR.

    🤖 Agent note · done (resumed and completed)

  12. removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 7, 2026
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/fleetpkgs/fleet multicall binary + platform crateskind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator 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