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 — aggregator(derive): projectPace throws RangeError on validator-passing pct records — one poisoned snapshot breaks the quota card, service page, and service.json · Issue #2346 · developing-today/code

aggregator(derive): projectPace throws RangeError on validator-passing pct records — one poisoned snapshot breaks the quota card, service page, and service.json #2346

New issue
Copy link
New issue
Copy link
Closed
#3411
Closed
aggregator(derive): projectPace throws RangeError on validator-passing pct records — one poisoned snapshot breaks the quota card, service page, and service.json#2346
#3411
Copy link
Assignees
dezren39
Labels
app/aggregatorPackage/app: aggregator (pm-stack in this repo)effort/xsTrivial: expected under 30 minutes of workkind/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/triageQueue packet kind: verify, reproduce, and route this item

Description

@dezren39
dezren39
opened on Oct 29, 2026
Issue body actions

Summary

projectPace in the pm-stack aggregator throws RangeError: Invalid Date on snapshot records that pass the store's own validator, and the throw propagates uncaught through the quota card render, the service detail page, and /api/quota/service.json. One poisoned pct record in the append-only snapshot store breaks those views for its service on every render until the record is removed by hand.

Evidence (verified on main 5a34fa7)

  • pm-stack/aggregator/src/derive.ts:939-940 — the projection is computed with no range guard:

    const projectedExhaustionAt =
      lastVal >= 100 ? last.ts : new Date(Date.parse(last.ts) + ((100 - lastVal) / slope) * 86_400_000).toISOString();

    The only guards above it are days < 0.5 → null and slope <= 0.05 → null (derive.ts:935-937). Nothing bounds lastVal from below, so a small positive slope plus a very negative last value pushes the projected instant past the maximum representable Date (±8.64e15 ms), producing an Invalid Date whose .toISOString() throws.

  • pm-stack/aggregator/src/snapshots.ts:36-52 (isSnapshotRecord) — a numeric value is accepted iff Number.isFinite(r.value). There is no pct range check, so a record with unit: "pct" and value: -1_000_000_000 is a valid store record: SnapshotStore.readAll() returns it and append() happily persists it.

  • Call sites do not catch: render.ts paceLineHtml (called per service card) calls projectPace directly; the service detail path maps projectPace over every metric (render.ts, paces construction); src/server.ts /api/quota/service.json maps it the same way. A throw in any of them aborts the whole render/response, not just the pace line.

Reproduction (probe run this run, bun, against unmodified main)

Records (both pass isSnapshotRecord):

{ ts: "2026-10-20T00:00:00Z", value: -1_000_000_000, unit: "pct", metricId: "weekly", ... }
{ ts: "2026-10-22T00:00:00Z", value:   -999_999_999, unit: "pct", metricId: "weekly", ... }

projectPace(recs, "weekly") → throws RangeError: Invalid Date (slope = 0.5 pts/day over 2 days; projected offset ≈ 2×10⁹ days ≈ 1.7×10¹⁷ ms, past the Date maximum).

Control: ordinary records (30 → 40 over the same window) return a sane projection (2026-11-03T00:00:00.000Z).

A milder variant does not throw but is still wrong: values −5000 → −4999.88 (slope 0.06) project exhaustion in the year 2259 — a negative-percent metric should support no exhaustion projection at all.

Why it matters

The snapshot store is append-only and written by several jobs (fleet-feed collector, stewardship-cycle, the Jules keeper, a Python mirror). A single bad pct observation — a misparse, a sign flip, a units mixup upstream — permanently poisons the quota views for that service: the store has no delete path, readAll keeps returning the record, and every affected page/API call throws instead of degrading to "no pace line", which is the function's own documented contract ("Null when history cannot support a projection — never invented", derive.ts:923-925).

Related but distinct: #1540 covers the validator accepting records it cannot read back (non-finite estimate pairs, non-ISO timestamps). This issue is downstream of the validator: even records the validator legitimately accepts can crash the projection, so the fix belongs in projectPace as well as (optionally) the validator.

Acceptance criteria

  • projectPace never throws for any records isSnapshotRecord accepts: out-of-range projections return null (or a clamped/null projectedExhaustionAt) instead of an Invalid Date exception.
  • A last value below 0 (or otherwise outside the plausible pct domain) yields no exhaustion projection.
  • Regression tests in the aggregator test suite cover: the extreme-negative pair above, the mildly-negative pair, and the existing sane cases (single point, flat slope) still behaving as before.
  • Quota card render, service detail render, and /api/quota/service.json succeed for a service whose stored history contains such a record.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    source/creatorFiled by the new-issue-creator job
    on Oct 29, 2026
  2. developing-today commented on Oct 29, 2026

    @developing-today
    developing-todayBot
    on Oct 29, 2026 – with developing.today
    Contributor
    More actions

    CODE-1191

  3. dezren39
    added
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued queue task
    effort/xsTrivial: expected under 30 minutes of work
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    on Oct 29, 2026
  4. dezren39 commented on Oct 29, 2026

    @dezren39
    dezren39
    on Oct 29, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a run 2026-10-29 09:05 CDT
    • Found via: filed this run
    • Task: Triage the projectPace RangeError on validator-passing pct records; pin the no-projection rule for out-of-domain values, then route a small_fix packet with regression tests
    • Expectation: effort/xs — done when triage pins the fallback rule and a fix packet with the extreme/mild negative cases exists
    • Links: probe /tmp/probe-laneA-pace/probe.ts (bun, real derive.ts + snapshots.ts, main 5a34fa7)
  5. github-actions
    assigned
    dezren39
    on Oct 29, 2026
  6. dezren39
    added
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 1, 2026
  7. 16 remaining items

  8. dezren39
    added
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    on Nov 1, 2026
  9. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up (resume)

    • Agent: repo-worker-code (lane A)
    • Session / ID: queue task 5244
    • Found via: queue claim (small_fix packet, queue repo-health-code-pilot) — resume of parked state
    • Task: Fix aggregator(derive): projectPace throws RangeError on validator-passing pct records — one poisoned snapshot breaks the quota card, service page, and service.json #2346 — projectPace RangeError guard. PR aggregator(derive): projectPace RangeError guard — no projection for out-of-domain pct (#2346) #3411 already open @15e9a541f from the prior attempt; laptop tests 36/36 + 75/75 recorded on the PR.
    • Resume verification (fresh, this shift): diff matches the pinned scope exactly (derive.ts guard + snapshots.ts pct validator + 3 regression cases + stored-poison readAll case); Codex review completed on head 15e9a54 with no findings; PR MERGEABLE/CLEAN. Proceeding to merge.
    • Links: aggregator(derive): projectPace RangeError guard — no projection for out-of-domain pct (#2346) #3411
  10. dezren39
    removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status:in-review
    on Nov 1, 2026
  11. dezren39
    added a commit that references this issue on Nov 1, 2026

    Merge pull request #3411 from developing-today/queue/5244-2346-projec…

    c2024ee
  12. dezren39
    closed this as completedin #3411on Nov 1, 2026
  13. developing-today
    added
    status:done
    on Nov 1, 2026
  14. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: repo-worker-code (lane A)
    • Session / ID: queue task 5244
    • Result: fixed_merged — PR aggregator(derive): projectPace RangeError guard — no projection for out-of-domain pct (#2346) #3411 merged (merge commit c2024ee); aggregator(derive): projectPace throws RangeError on validator-passing pct records — one poisoned snapshot breaks the quota card, service page, and service.json #2346 closed by the merge.
    • Verification: fresh diff review matched the pinned scope; Codex review on head 15e9a54 completed with no findings; laptop tests recorded on the PR: usage.test.ts 36/36 (incl. the three aggregator(derive): projectPace throws RangeError on validator-passing pct records — one poisoned snapshot breaks the quota card, service page, and service.json #2346 regression cases + stored-poison readAll case), neighboring suites 75/75.
    • Links: aggregator(derive): projectPace RangeError guard — no projection for out-of-domain pct (#2346) #3411
  15. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
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/aggregatorPackage/app: aggregator (pm-stack in this repo)effort/xsTrivial: expected under 30 minutes of workkind/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/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.