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(collect-github-billing): the --by value is never validated — empty/whitespace fails the whole collection after the gh call, a flag token is recorded as the observer, and a trailing --by silently defaults · Issue #6922 · developing-today/code

aggregator(collect-github-billing): the --by value is never validated — empty/whitespace fails the whole collection after the gh call, a flag token is recorded as the observer, and a trailing --by silently defaults #6922

New issue
Copy link
New issue
Copy link
Closed
#6924
Closed
aggregator(collect-github-billing): the --by value is never validated — empty/whitespace fails the whole collection after the gh call, a flag token is recorded as the observer, and a trailing --by silently defaults#6922
#6924
Copy link
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 jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

@dezren39
dezren39
opened on Nov 7, 2026
Issue body actions

aggregator(collect-github-billing): the --by value is never validated — empty/whitespace fails the whole collection after the gh call, a flag token is recorded as the observer, and a trailing --by silently defaults

Evidence

pm-stack/aggregator/scripts/collect-github-billing.ts:

  • :39-42 — argValue(flag) returns the next argv token verbatim (or undefined).
  • :56-61 — explicitArg(flag) exists precisely to reject missing/flag-like values, and aggregator(collect-github-billing): --year/--month/--user values are never validated — NaN, month 13, month 0, fractional and flag-token values go straight into the billing API URL, and the failure is blamed on the gh token scope #3419 wired it for --year/--month/--user (:65, :74, :83).
  • :112 — observedBy still comes from the unguarded helper: const observedBy = argValue("--by") ?? "collect-github-billing";
  • :123-126 — records built with that observedBy are validated with isSnapshotRecord, and ANY invalid record throws, discarding the whole month's collection.

Verified this run on laptop main 5b4aae140e with the real script and a stub gh returning one valid billing item (probe ~/git/fleet/probe-billing-by):

  • control --print: exit 0, records carry observedBy: "collect-github-billing".
  • --by "" --print and --by " " --print: exit 1 — the gh call is made, records are derived, then the run throws … derived record(s) failed validation (empty/whitespace observedBy fails isSnapshotRecord). A usage mistake is reported as a data-validation failure and the month's collection is lost.
  • --by --print: exit 0 — the flag token is recorded verbatim as the observer ("observedBy":"--print" in the printed records) AND the token is consumed a second time as the --print flag itself (dry-run mode).
  • trailing --by (no value): exit 0 — silently falls back to the default observer and appends 3 records to the outbox, instead of the usage error every sibling flag produces.

The settled pattern already exists twice over: #3419 in this same file (explicitArg + exit 2 before any gh call) and #3295 in the sibling writer append-usage-snapshots.ts (resolveObservedBy: a missing, empty, or flag-like --by is a usage error, exit 2, outbox untouched). The shipped test test/collect-github-billing-args-3419.test.ts covers --year/--month/--user bad values but has no --by case; the suite passes 3/3 on current main.

Why it matters

observedBy is the provenance field on every snapshot record this collector writes. A flag token recorded as the observer corrupts provenance permanently in the snapshot store, and the empty-value path converts a one-character CLI typo into a lost month of billing collection with a misleading error (the same misreporting class #3419 fixed for the other flags).

Acceptance criteria

  • --by with a missing value, an empty/whitespace-only value, or a value that is another flag token is a usage error: exit 2, message naming --by, ZERO gh calls, outbox untouched — resolved before fetchUsageItems, consistent with explicitArg/resolveObservedBy (aggregator(snapshots): append-usage-snapshots --by with no value silently discards every derived record — exit 0, 'no records derived' #3295).
  • A valid --by <name> is recorded verbatim as observedBy on every derived record (control case).
  • Omitting --by keeps the existing default (collect-github-billing).
  • Extend test/collect-github-billing-args-3419.test.ts (or a sibling test file) with the --by bad-value cases (missing / empty / whitespace / flag token) asserting exit 2 + zero gh calls, plus a valid --by control asserting the recorded observedBy; the existing 3 tests keep passing.

Activity

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

    @developing-today
    developing-todayBot
    on Nov 7, 2026 – with developing.today
    Contributor
    More actions

    CODE-2177

  3. dezren39
    added
    status/needs-triageNot yet triaged; needs a first look
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    queue/queuedHas a queued queue task
    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 7, 2026
  4. dezren39 commented on Nov 7, 2026

    @dezren39
    dezren39
    on Nov 7, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator (creator-b lane)
    • Session / ID: new-issue-creator-code-b, run 2026-11-07 10:50 CST
    • Found via: filed this run
    • Task: Validate the --by value in collect-github-billing before any gh call (missing/empty/whitespace/flag-token = usage error, exit 2), mirroring aggregator(collect-github-billing): --year/--month/--user values are never validated — NaN, month 13, month 0, fractional and flag-token values go straight into the billing API URL, and the failure is blamed on the gh token scope #3419's explicitArg in the same file and aggregator(snapshots): append-usage-snapshots --by with no value silently discards every derived record — exit 0, 'no records derived' #3295's resolveObservedBy in the sibling writer.
    • Expectation: effort/s — one guarded resolver plus pinning tests in the existing args test file; done when the bad-value cases exit 2 with zero gh calls and the valid control records the given observer.
    • Links: probe ~/git/fleet/probe-billing-by (laptop; real script, stub gh)
  5. dezren39 commented on Nov 7, 2026

    @dezren39
    dezren39
    on Nov 7, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: new-issue-creator (creator-b lane)
    • Session / ID: new-issue-creator-code-b, run 2026-11-07 10:50 CST
    • Found via: self-assigned during new-issue-creator-code-b run (guarded self-solve, lifecycle protocol §4: filed this run, trivial, no safety labels)
    • Task: Implement the --by validation on branch creator-b/6922-billing-by-value in a laptop worktree, extend the pinning tests, open a PR, merge when verified.
    • Expectation: effort/s — done when the PR merges and the extended test suite passes on merged main.
    • Links: branch creator-b/6922-billing-by-value
  6. dezren39
    added
    work/self-assignedAn agent grabbed this item directly, outside the queue
    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 7, 2026
  7. dezren39
    added a commit that references this issue on Nov 7, 2026

    Merge pull request #6924 from developing-today/creator-b/6922-billing…

    61f7fed
  8. dezren39
    closed this as completedin #6924on Nov 7, 2026
  9. dezren39 commented on Nov 7, 2026

    @dezren39
    dezren39
    on Nov 7, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: new-issue-creator (creator-b lane)
    • Session / ID: new-issue-creator-code-b, run 2026-11-07 10:50 CST
    • Found via: self-assigned during new-issue-creator-code-b run (guarded self-solve, lifecycle protocol §4)
    • Task: Fixed — PR fix(aggregator): validate collect-github-billing --by value before any gh call (#6922) #6924 merged as 61f7fed: resolveObservedBy() (explicitArg + non-empty check, mirroring aggregator(snapshots): append-usage-snapshots --by with no value silently discards every derived record — exit 0, 'no records derived' #3295) replaces the unguarded argValue read; missing/empty/whitespace/flag-token --by now exits 2 before any gh call with the outbox untouched.
    • Expectation: met — extended suite 4/4 pass on the branch and on merged main (61f7fed); the three original failing cases re-probed post-fix: all exit 2 naming --by, no outbox write. Issue auto-closed by the PR's Fixes marker.
    • Links: PR fix(aggregator): validate collect-github-billing --by value before any gh call (#6922) #6924 (merged 61f7fed) · branch creator-b/6922-billing-by-value · probe ~/git/fleet/probe-billing-by
  10. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    work/self-assignedAn agent grabbed this item directly, outside the queue
    on Nov 7, 2026
  11. developing-today
    added
    status:done
    on Nov 7, 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)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 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

      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.