Skip to content

aggregator: PR #3411's out-of-domain guard still computes and renders projectedPercentAtReset for negative pct values #6316

Closed

Description

@dezren39

aggregator: PR #3411's out-of-domain guard nulls projectedExhaustionAt but still computes and renders projectedPercentAtReset for negative pct values

Finding

PR #3411 (fix for #2346) guarded projectPace (pm-stack/aggregator/src/derive.ts) so an out-of-domain last pct value (< 0) yields no projection: projectedExhaustionAt stays null. The guard covers only that one field. The very next block computes the sibling projection unconditionally:

let projectedPercentAtReset: number | null = null;
if (last.resetsAt) {
  const toReset = (Date.parse(last.resetsAt) - Date.parse(last.ts)) / 86_400_000;
  if (toReset > 0) projectedPercentAtReset = Math.round((lastVal + slope * toReset) * 10) / 10;
}

There is no lastVal >= 0 condition, so for a stored poisoned series whose last record carries resetsAt, projectPace still returns a projection — a large negative percent. Worked example using the PR's own poison fixture (-1e9 -> -999999999 over 2 days, slope 0.5/day) with resetsAt 7 days after the last read: projectedPercentAtReset = -999999999 + 0.5 * 7 = -999999995.5.

That value is rendered. The service-detail pace list (pm-stack/aggregator/src/render.ts, the paces block in the service page) prints projectedPercentAtReset whenever it is non-null, independent of projectedExhaustionAt:

${p.pace!.projectedPercentAtReset != null ? ` · projected ${p.pace!.projectedPercentAtReset}% at reset` : ""}

So the service page can show "projected -999999995.5% at reset" for exactly the stored-poison records #2346/#3411 set out to neutralise. (The quota-card pace line is safe only incidentally: it returns early unless projectedExhaustionAt is set.)

Evidence

Why it matters

#2346's failure class was one poisoned snapshot record breaking or corrupting the quota surfaces. #3411 closed the crash and the exhaustion date, but left the same poisoned input producing an absurd rendered number on the service page — the projection the PR said would not be yielded is still yielded, just in the sibling field. It is a small, well-bounded remainder of an already-agreed fix, not a new design question.

Acceptance criteria


agent-note:v1 — Agent: pr-diff-review-b; state: filed. Filed from PR #3411 diff review (lane B, 2026-11-05 run); verified against current main b830347.

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)
    on Nov 5, 2026
  2. developing-today commented on Nov 5, 2026

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

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  4. added
    work/assignedQueue worker lifecycle state
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    on Nov 5, 2026
  5. 152 remaining items

  6. added
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 9, 2026
  7. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 lane=code-f task=11414 stage=awaiting_ci — Resumed task 11414 at stage pr_opened (implementation by lane code-v, commit 0a095da, branch queue/11414-6316-projected-percent-guard). The GitHub rate limit has cleared, so PR #8070 was created from outbox entry OB-2026-11-09-T11414V1803-PR exactly as prepared. Fresh verification by lane code-f: bun test test/usage.test.ts — 49 pass, 0 fail; diff vs main is only pm-stack/aggregator/src/derive.ts + test/usage.test.ts; no Codex findings posted. PR checks still QUEUED after ~5 min, so task 11414 is parked 1200s per the CI rule. Resume: read PR #8070 checks + Codex findings fresh, merge when green, then complete task 11414 fixed_merged.

  8. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  9. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · resumed + merging

  10. added a commit that references this issue on Nov 10, 2026
  11. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  12. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 10, 2026
  13. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — already 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/aggregatorPackage/app: aggregator (pm-stack in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/fixhas a fix task queuedtask/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