Skip to content

aggregator(post-alert): unknown/misspelled flags are silently ignored — a typo'd --severty posts a warning incident as critical, a typo'd --bodi drops the body, exit 0 #7289

Closed

Description

@developing-today

Problem

pm-stack/aggregator/scripts/post-alert.ts — the one CLI every sentinel uses to post to the alert throat (#3676) — reads each flag with a bare process.argv.indexOf lookup (arg(), scripts/post-alert.ts:40-41) and never scans argv for anything else. Unknown, misspelled, joined (--flag=value), duplicated, and stray positional arguments are silently ignored:

  • --severity falls back to "critical" when the flag is not found verbatim (scripts/post-alert.ts:55), so a typo'd flag name silently escalates the incident.
  • An unrecognized token and its value are consumed by nothing and reported by nothing; the post proceeds with exit 0.

This is the one aggregator script left out of the settled unknown-args class: append-usage-snapshots.ts (#6961), compact-usage-snapshots.ts (#6967), backfill-usage-snapshots.ts (#6973), generate-digest.ts (#7097), and collect-github-billing.ts (#7254) all gained rejectUnknownArgs() (usage error, exit 2, before any I/O). post-alert.ts got the flag-as-value guard in #3723 but never the unknown-args scan, and it has no positional-argument contract at all.

Evidence (verified this run)

Probe on the laptop, ~/git/fleet/probe-post-alert-unknown-args (probe.test.ts): the real script run verbatim as a subprocess (current main a23b3ce454, md5 de4a732f8cdf4c51e7452a30ef564198) against a stub intake server (Bun.serve) and a stub bws, in the exact style of the shipped test/post-alert-args-3723.test.ts. Oracle = the captured POST body + exit code.

Control passes: --source watch --key h1 --severity warning --title "host down" --body 503 → exit 0, posts {"severity":"warning",...,"body":"503"}.

With a misspelled / unknown / joined argument, the script posts anyway, exit 0:

  1. Typo'd flag name --severty warning → posts {"source":"watch","key":"h1","severity":"critical","title":"host down"} — a warning incident silently filed as critical (critical incidents push immediately to subscribed browsers and escalate when unacknowledged; warnings do not — src/alerts.ts / src/render.ts alert-throat behavior).
  2. Joined form --severity=warning → same result: posts severity:"critical", exit 0.
  3. Unknown flag --bogus x → silently ignored; the incident posts, exit 0.
  4. Typo'd optional flag --bodi 503 → posts {"severity":"info","title":"host down"} with no body field at all — the diagnostic body is silently dropped.
  5. Stray positional extra after the documented flags → silently ignored; the incident posts, exit 0.

Why it matters

post-alert is the fleet's single alert throat: every sentinel posts through it instead of inventing its own path. Its whole value is that the incident posted is the incident the caller named. A one-character typo in a sentinel's invocation today either (a) escalates a warning into a critical that pushes to browsers and pages on the ack window, training operators to ignore criticals, or (b) drops the diagnostic body that explains the incident — in both cases with exit 0, so the calling sentinel believes the alert was posted exactly as intended. The sibling scripts were fixed for precisely this failure shape; this CLI — the one whose output is an operator-facing alarm — is the remaining hole.

Acceptance criteria

Dedup: searched open + closed issues for "post-alert" titles — #3723 covers the flag-as-value guard in the same arg() (fixed, different defect); no issue covers unknown/misspelled/joined/duplicate arguments for post-alert. The sibling fixes (#6961, #6967, #6973, #7097, #7254) each cover a different script.

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/normalOrdinary priority (the default)
    work/self-assignedAn agent grabbed this item directly, outside the queue
    effort/xsTrivial: expected under 30 minutes of work
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    on Nov 8, 2026
  2. developing-today commented on Nov 8, 2026

    @developing-today
    ContributorAuthor

    🤖 Agent note · filed

  3. added a commit that references this issue on Nov 8, 2026
  4. developing-today commented on Nov 8, 2026

    @developing-today
    ContributorAuthor

    🤖 Agent note · fixed-merged (self-solved)

  5. added and removed
    work/self-assignedAn agent grabbed this item directly, outside the queue
    on Nov 8, 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/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/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