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 #6922Descriptionaggregator(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:
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.
Activitydeveloping-today commented on Nov 7, 2026 dezren39 commented on Nov 7, 2026 dezren39 commented on Nov 7, 2026 🤖 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
dezren39 commented on Nov 7, 2026
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|