Skip to content

aggregator(alerts): mergeQuiet accepts any string as the quiet-hours timezone — an invalid tz is stored verbatim and inQuietHours then silently never suppresses #4281

Closed

Description

@dezren39

Problem

pm-stack/aggregator/src/alerts.ts mergeQuiet (alerts.ts:88-99) accepts any non-empty string as the quiet-hours timezone:

if (typeof q.tz === "string" && q.tz.trim()) out.tz = q.tz.trim();

There is no validity check. The value is persisted via validateNewSubscription → upsertSubscription, and the only consumer, inQuietHours (alerts.ts:108-132), builds an Intl.DateTimeFormat with that zone inside a try/catch whose catch returns false — "unknown tz — do not suppress". So a subscription stored with tz: "Not/AZone" or tz: "banana" has quiet hours that silently never apply, forever: dashboard-class notifications are never suppressed, at any hour, with no error anywhere. That is the opposite failure direction from a typo'd time, and it contradicts this parser's own established contract — every other malformed field in mergeQuiet falls back to the default instead of being stored verbatim.

Evidence (verified this run)

Laptop probe importing the real alerts.ts at main fa28f499 (md5 933468e2…, identical in both clones; probe dir ~/git/fleet/probe-2026-11-02-laneB-quiettz/, log probe.log):

  • Control: inQuietHours(mergeQuiet({}), 2026-01-15T06:00Z = 00:00 CST) → true; at 18:00Z = 12:00 CST → false — default prefs behave correctly.
  • mergeQuiet({ tz: "Not/AZone" }) → stored verbatim: { start: "23:00", end: "07:00", tz: "Not/AZone", enabled: true }
  • Same prefs at 00:00 CST (deep inside the 23:00–07:00 window) → inQuietHours returns false — quiet hours never apply.
  • mergeQuiet({ tz: "banana" }) → tz: "banana" stored; at midnight CST → false.

Why it matters

Quiet prefs are user-supplied subscription input. A client bug or hand-edited payload that emits a bad zone name is silently stored and then silently disables suppression for that subscription — the user believes they have quiet hours and gets woken at 03:00 anyway, and nothing in the ledger or logs says why. The fix follows the parser's own precedent: validate and fall back to the default, don't store garbage.

Acceptance criteria

  • mergeQuiet accepts a tz only if it is a real IANA zone name (e.g. constructing Intl.DateTimeFormat with it does not throw); anything else ("Not/AZone", "banana") falls back to the default America/Chicago, like other malformed fields do today.
  • Regression tests pin: invalid zones fall back to the default; a valid non-default zone (UTC, Europe/London) is accepted and honoured by inQuietHours; existing quiet-window tests still pass.
  • No other mergeQuiet / inQuietHours behaviour changes (the inQuietHours catch may stay as defence in depth for rows already stored with a bad zone).

Distinct from: #3686 (open — same function, but only the start/end time ranges; its acceptance criteria say nothing about tz), #3676 (the alert throat itself).

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
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    effort/sSmall: expected under 2 hours of work
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Nov 2, 2026
  2. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (new-issue-creator-code-b)
    • Session / ID: cron new-issue-creator-code-b run 2026-11-02 02:20 CST (2026-11-02T08:26Z)
    • Found via: filed this run
    • Task: Triage mergeQuiet's unvalidated timezone — any non-empty string is stored as the quiet-hours tz, Intl throws inside inQuietHours, the catch returns false, and quiet hours silently never apply for that subscription
    • Expectation: effort/s; done = invalid tz falls back to the default America/Chicago at merge time (valid zones still honoured), with regression tests for invalid/valid zones
    • Links: laptop probe ~/git/fleet/probe-2026-11-02-laneB-quiettz/ (verbatim aggregator src @fa28f499, alerts.ts md5 933468e2; probe: tz Not/AZone and banana stored verbatim, inQuietHours=false at 00:00 CST inside the window; default-prefs control correct)
  3. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 2, 2026
  5. 65 remaining items

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

    @dezren39
    MemberAuthor

    agent-note:v1 — state: parked (task 6155, OpenChamber scheduled lane)\n- Agent: repo-worker-code.\n- Fresh metadata-only evidence: #4281 OPEN; canonical PR #4283 OPEN and Drew-authored. No PR contents, diff, branch, worktree, checks, reviews, or source inspected.\n- Disposition: parked 30 minutes; no work touched. Parked labels restored; work/assigned remains. Ending this launch as saved progress requires.\n- Resume: after explicit handoff/release; then revalidate issue, PR, checks and reviews fresh.\n

  8. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — holder: repo-worker-code, since 2026-11-02T12:00:28Z (picked up queue task 6155; resumed from its saved checkpoint and performed metadata-only revalidation).

  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — holder: released by repo-worker-code at 2026-11-02T12:03:08Z, reason: task 6155 parked for 30 minutes after fresh metadata-only checks showed #4281 OPEN and assigned to Drew and canonical PR #4283 OPEN and Drew-authored; prior checkpoint forbids inspecting PR contents until explicit handoff/release. Resume only after handoff/release, then revalidate.

  10. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 2, 2026
  11. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  12. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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

Metadata

Metadata

Assignees

Labels

app/aggregatorPackage/app: aggregator (pm-stack in this repo)app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/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 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