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(snapshots): append-usage-snapshots --by with no value silently discards every derived record — exit 0, 'no records derived' · Issue #3295 · developing-today/code

aggregator(snapshots): append-usage-snapshots --by with no value silently discards every derived record — exit 0, 'no records derived' #3295

New issue
Copy link
New issue
Copy link
Closed
#3920
Closed
aggregator(snapshots): append-usage-snapshots --by with no value silently discards every derived record — exit 0, 'no records derived'#3295
#3920
Copy link
Assignees
dezren39
Labels
app/aggregatorPackage/app: aggregator (pm-stack in this repo)effort/sSmall: expected under 2 hours 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 jobsource/design-architectFiled by the repo design architect jobtask/triageQueue packet kind: verify, reproduce, and route this item

Description

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

aggregator(snapshots): append-usage-snapshots --by with no value silently discards every derived record — exit 0, "no records derived"

Evidence (verified this run, main fdfb377c)

pm-stack/aggregator/scripts/append-usage-snapshots.ts:54-62 reads the observer name with the bare index-of pattern, in both modes:

const byArg = process.argv.indexOf("--by");
const observedBy = byArg >= 0 ? process.argv[byArg + 1] : "check-usage";        // --from-provider-usage mode (:57)
const observedBy = byArg >= 0 ? process.argv[byArg + 1] : "stewardship-cycle";  // default mode (:61)

When --by is the last argument, process.argv[byArg + 1] is undefined; with --by "" it is the empty string. There is no validation of the value. Every derived record then carries that observedBy, and the script's own filter drops all of them: isSnapshotRecord requires a non-empty string observer (pm-stack/aggregator/src/snapshots.ts:310, !isNonEmptyString(r.observedBy) → false). The script then reaches the empty-result branch (append-usage-snapshots.ts:71-80) and prints the misleading no records derived; outbox untouched — and exits 0.

Probe (laptop, real script run from the laptop clone; script sha256 e2612f0f… and src/snapshots.ts c6685035… identical on both clones; fixture provider-usage.json = {"generated_at":"2026-10-31T12:00:00.000Z","sessions":[{},{}]}, which derives exactly one record; probe dir ~/git/fleet/probe-2026-10-31-laneA-appendby/):

run result
control: --from-provider-usage --by tester appended 1 record(s); outbox holds the sessions-listed record with "observedBy":"tester"; exit 0
--from-provider-usage --by (trailing, no value) no records derived; outbox untouched; no outbox file created; exit 0
--from-provider-usage --by "" same: no records derived; outbox untouched; no outbox file; exit 0

Why it matters

This script is a snapshot writer (hub design §4): stewardship / check-usage runs append the dated quota observations that become the fleet's measured usage history. A typo'd or wrapper-generated trailing --by — one missing value — silently throws away the whole run's records while reporting a routine "nothing to do" outcome and success. Nothing downstream alarms, because the outbox legitimately stays empty on genuinely-empty runs too; the two cases are indistinguishable in the output. The sibling script in the same folder already shows the house pattern for this: compact-usage-snapshots.ts:28-31 validates its --months value and exits 2 naming the bad value.

Acceptance criteria

  • append-usage-snapshots.ts --by with no following value, an empty value, or a value that is itself a flag (starts with --) exits 2 with a clear invalid --by usage error, before reading inputs or touching the outbox — in both the default and --from-provider-usage modes.
  • --by <name> and a missing --by (defaults check-usage / stewardship-cycle) behave exactly as today: the probe control above still appends 1 record with the given observer.
  • The "no records derived" message is only reachable when records were actually derived-and-filtered for content reasons; a test (or script-level check) pins the trailing---by refusal so the silent-discard path cannot return.
  • Existing aggregator snapshot tests still pass.

Dedup: searched open + closed issues for append-usage-snapshots and observedBy — neighbours are #3285 (compact --months 0, same folder, different script/guard), #2568 / #2571 (percent range checks), #2941 (__proto__ grouping) and #1205 (writer-health epic); none covers the --by value going unvalidated and voiding the run.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 1, 2026
  2. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator (new-issue-creator-code-a)
    • Session / ID: cron job new-issue-creator-code-a, run 2026-10-31 21:05 CDT (2026-11-01T02:19Z)
    • Found via: filed this run
    • Task: Filed a verified silent-discard edge: append-usage-snapshots.ts reads --by by bare index-of with no value validation (scripts/append-usage-snapshots.ts:54-62, both modes), so a trailing or empty --by gives every derived record an undefined/empty observedBy, isSnapshotRecord (src/snapshots.ts:310) filters them all out, and the script exits 0 saying "no records derived" with the outbox untouched. Verified with a laptop Bun probe running the real sha-matched script against a fixture provider-usage snapshot (control --by tester appends 1 record; trailing --by and --by "" append nothing, exit 0).
    • Expectation: effort/s — triage confirms the trailing/empty --by case against main, then the fix validates the --by value (missing/empty/flag-like → exit 2, mirroring compact-usage-snapshots' --months guard) and pins it with a test.
    • Links: probe (laptop) ~/git/fleet/probe-2026-10-31-laneA-appendby/ · related aggregator(snapshots): compact-usage-snapshots accepts --months 0 — --apply compacts the in-progress month, deleting its raw file and leaving only min/max/last #3285 (same folder, compact --months guard pattern), Usage snapshots: move ingestion out of the aggregator read path and report writer health #1205 (writer-health epic)
  3. github-actions
    assigned
    dezren39
    on Nov 1, 2026
  4. dezren39
    added
    source/design-architectFiled by the repo design architect job
    on Nov 1, 2026
  5. dezren39
    added a parent issue on Nov 1, 2026
    • Design: unknown means stop — one strict argument contract for the repo's operator scripts #3352
  6. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    Adopted as Phase 2 of design #3352 (corollary 3: present-but-valueless is not absent — an empty observer value is a usage error, not a silently discarded run). The design records the contract this issue's fix must follow: every argument is accounted for before any side effect; unknown/typo'd arguments are a usage error naming the argument (exit non-zero, 2 where no usage code is established) before any subprocess/network/file/lock/deploy step. Triage: do NOT re-file, re-scope or split this issue — record the phase structure and verdict, and keep this issue's own acceptance criteria as the phase's acceptance. Design doc: files/designs/code-operator-argument-contract.md (keep-the-four-repos-healthy goal workspace).

  7. dezren39
    added
    work/assignedQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    on Nov 1, 2026
  8. 6 remaining items

  9. dezren39
    added
    queue/queuedHas a queued queue task
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
  10. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done (triaged)

    • Agent: repo-worker-code, OpenChamber scheduled lane
    • Queue task: 4871 (repo-health-code-pilot)
    • Verdict: confirmed on current origin/main 33aefa7. --by is read without validation in both modes; empty observedBy is rejected, producing a successful no-op. No matching open PR found. Earlier real-script probe is cited on this issue; this pass did not rerun it.
    • Follow-up: fix task 5873 queued as repo-health:v1:fix:developing-today/code:issue:3295; labels now reflect queued follow-up.
    • Tests: no code tests run (triage-only).
    • Links: aggregator(snapshots): append-usage-snapshots --by with no value silently discards every derived record — exit 0, 'no records derived' #3295
  11. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    queue/queuedHas a queued queue task
    on Nov 1, 2026
  12. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: repo-worker-code, lane B scheduled shift
    • Queue task: task 5873 (repo-health-code-pilot)
    • Found via: atomic queue claim
    • Task: fix the --by silent-discard defect in append-usage-snapshots — validate missing/empty/flag-like --by values before any snapshot write, in both modes.
    • Fresh state: issue aggregator(snapshots): append-usage-snapshots --by with no value silently discards every derived record — exit 0, 'no records derived' #3295 OPEN, no hard-stop labels, no open PR for this work. Triage task 4871 confirmed the defect on origin/main 33aefa7.
    • Next: laptop worktree, implement validation + pinning test, open PR, complete task 5873.
  13. dezren39
    added a commit that references this issue on Nov 1, 2026

    Merge pull request #3920 from developing-today/queue/5873-3295-by-val…

    32e9df3
  14. dezren39
    closed this as completedin #3920on Nov 1, 2026
  15. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
  16. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: repo-worker-code, lane B scheduled shift
    • Queue task: task 5873 (repo-health-code-pilot) — complete, outcome fixed_merged
    • Fix: PR fix(aggregator): reject missing or empty --by in append-usage-snapshots (#3295) #3920 merged (merge commit 32e9df3). append-usage-snapshots now validates --by before any file read/write in both modes: missing, empty/whitespace, or flag-like values exit 2 with a clear usage error and leave the outbox untouched; valid names and the absent---by defaults are unchanged.
    • Tests: new pinning test test/append-usage-snapshots-by-3295.test.ts; on the laptop bun test over the new test + snapshot-writers + snapshot-retention — 30 pass, 0 fail. Codex review clean at head b57f6c2 (no findings).
    • Issue: aggregator(snapshots): append-usage-snapshots --by with no value silently discards every derived record — exit 0, 'no records derived' #3295 closed by the merge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/aggregatorPackage/app: aggregator (pm-stack in this repo)effort/sSmall: expected under 2 hours 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 jobsource/design-architectFiled by the repo design architect 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

    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.