Skip to content

pm-stack(aggregator): isProjectPoolItem accepts impossible/non-ISO updatedAt — pool items carry rolled dates into momentum and board-recency math #5202

Closed

Description

@dezren39

pm-stack(aggregator): isProjectPoolItem accepts impossible/non-ISO updatedAt — pool items carry rolled dates into momentum and board-recency math

Evidence

pm-stack/aggregator/src/projects.ts at origin/main 9380bf6d7:

  • isProjectPoolItem (line 272) gates the pool item's only timestamp with a bare type check: (p.updatedAt === undefined || typeof p.updatedAt === "string"). Any string passes — impossible calendar dates, non-ISO spellings, and outright garbage. This predicate is the whole feed-side gate: projectPoolSectionProblem in feed.ts delegates per-item validation to it, and the collector parses against it too.
  • poolItemToGhItem (projects.ts:282) copies the stamp through verbatim: updatedAt: p.updatedAt ?? "".
  • Consumers do arithmetic on it with Date.parse, which rolls impossible days forward and parses non-ISO spellings timezone-dependently:
    • derive.ts:815 — the weekly "accomplished" list for project momentum is (state === "merged" || "closed") && Date.parse(i.updatedAt) >= weekAgo;
    • derive.ts:820 — recent = Date.parse(i.updatedAt) >= twoDaysAgo feeds the momentum state itself (moving vs stalled, derive.ts:824);
    • derive.ts:786 — board ordering sorts on the raw string (localeCompare), so non-ISO spellings also misorder.
  • Sibling gates in the same codebase refuse exactly these stamps: the tier-item delegation parser ISO-gates its updatedAt (tier-items.ts:179, via the local isIso), isSessionRecord ISO-gates lastSeenAt/startedAt (registry.ts, pm-stack(aggregator): isSessionRecord accepts impossible and non-ISO lastSeenAt/startedAt — a non-ISO stamp wins merge recency forever, and impossible dates roll in registryActivityMs #5078), and isSubscriptionRow ISO-gates renewsAt with isIsoDate (feed.ts, validate.ts:116). The pool item is the remaining typeof-only stamp.

Verified (laptop probe, this run)

Probe at origin/main 9380bf6d7 (laptop ~/git/fleet/probe-2026-11-03-laneB2-poolupd/probe.ts, importing the real projects.ts; now fixed at 2026-03-01T00:00:00Z for the momentum predicate):

{"updatedAt":"2026-02-30T00:00:00Z","gate":true,"parsed":1772409600000,"countsAsThisWeek":true}   ← rolls to Mar 2 — a future day that never existed counts as this week's activity
{"updatedAt":"2026-04-31T00:00:00Z","gate":true,"parsed":1777593600000,"countsAsThisWeek":true}   ← rolls to May 1
{"updatedAt":"March 2, 2026","gate":true,"parsed":1772431200000,"countsAsThisWeek":true}          ← non-ISO, parsed timezone-dependently
{"updatedAt":"not-a-date","gate":true,"parsed":null,"countsAsThisWeek":false}                     ← garbage passes the gate (only the downstream NaN comparison happens to exclude it)
{"updatedAt":"2026-02-25T00:00:00Z","gate":true,"parsed":1771977600000,"countsAsThisWeek":true}   ← valid control

Why it matters

Project momentum is a headline dashboard signal: it decides whether a project reads as "moving" or "stalled" and which merged/closed items are listed as this week's accomplishments. One pool item carrying an impossible stamp (a collector glitch, a hand-edited feed, a future producer that formats dates loosely) silently fabricates recent activity — Feb 30 becomes Mar 2, Apr 31 becomes May 1 — and a project with no real activity in weeks can read as moving. Every other timestamp the feed gate owns has already been moved to the isIsoDate rule for this exact failure class; this one was missed.

One nuance the fix must preserve: the collector itself emits updatedAt: c.updatedAt ?? "" (projects.ts:163), so a missing GraphQL stamp arrives as "". Items must not start dropping solely for a missing stamp — treat "" as absent (or have the collector omit the field) rather than requiring a date on every item.

Acceptance criteria

  • isProjectPoolItem refuses a present, non-empty updatedAt that is not a real ISO calendar date (isIsoDate, validate.ts:116): 2026-02-30…, 2026-04-31…, March 2, 2026, and not-a-date all fail the gate and the item drops individually, as with the other feed gates.
  • A pool item with updatedAt absent — including the collector's current "" spelling for a missing GraphQL stamp — still passes, so no legitimate item is dropped for lacking a stamp.
  • Tests in the aggregator suite cover the refused cases, the ""/absent case, and a valid ISO control; existing projects/feed/derive tests still pass.
  • Existing aggregator tests still pass.

Filed by new-issue-creator-code-b (Lane B), verified this run at origin/main 9380bf6d7. Dedup: searches for isProjectPoolItem, "pool item updatedAt", and "ProjectPoolItem date" surface only the closed number/labels/truncation filings (#3514, #2418, #2453, #2459) — none covers the updatedAt stamp.

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
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Nov 3, 2026
  2. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: filed

    • Agent: new-issue-creator job (new-issue-creator-code-b)
    • Session / ID: cron new-issue-creator-code-b, run 2026-11-03 16:50 CST
    • Found via: filed this run
    • Task: Filed this issue — isProjectPoolItem (projects.ts:272) gates the pool item's updatedAt with a bare typeof-string check, so impossible/non-ISO stamps pass the feed gate and poolItemToGhItem carries them into derive.ts momentum math (Date.parse at :815/:820 rolls Feb-30 to Mar 2 and Apr-31 to May 1, fabricating this-week activity). Verified on origin/main 9380bf6 with a laptop bun probe importing the real projects.ts (probe ~/git/fleet/probe-2026-11-03-laneB2-poolupd): 2026-02-30, 2026-04-31, "March 2, 2026", and "not-a-date" all pass the gate; valid ISO control passes. Fix nuance: the collector emits updatedAt "" for a missing GraphQL stamp (projects.ts:163), so "" must keep counting as absent.
    • Expectation: effort s — gate a present non-empty updatedAt with isIsoDate (validate.ts:116), matching the sibling gates (tier-items.ts:179, isSessionRecord, isSubscriptionRow); done when aggregator tests cover the refused cases, the ""/absent case, and a valid control, with the existing suite green.
    • Links: queue packet enqueued to repo-health-code-pilot this run
  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 4, 2026
  4. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  5. 28 remaining items

  6. added
    epic/pm-stackReprioritization program epic (2026-11-12)
    work/assignedQueue worker lifecycle state
    queue/claimedQueue 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
    queue/blockedQueue or user escalation state
    queue/claimedQueue worker lifecycle state
    on Nov 12, 2026
  7. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · implemented, PR opened

  8. added a commit that references this issue on Nov 12, 2026
  9. 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 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/pm-stackpm-stack (Pad/Grist) in developing-today/codeepic/pm-stackReprioritization program epic (2026-11-12)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/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