Skip to content

pm-stack(opencode-usage-export): reject duplicate value options instead of silently retargeting output #8899

Closed

Description

@dezren39

Evidence

On current main (3e05759bc97e4d573a6921d1ffb60ef4d5019cc7), pm-stack/opencode-usage-export/opencode-usage-export.mjs:363-373 assigns each parsed value directly into args; a repeated scalar flag overwrites the earlier value without a usage error. The two --out-dir values can therefore silently retarget the failure document and the normal export.

Reproduced using the real exported run() function with isolated temporary paths:

argv: --out-dir <first> --out-dir <second> --db <missing.db>
result: exitCode=3, status=store-missing
first/latest.json: absent
second/latest.json: written

The parser fails closed on unknown/missing/bad values, but accepts conflicting repeated values. The operator-argument design #3352 explicitly left repeated value-option semantics as an open question. #3353 is its closed inventory; #3469 and open PR #4480 cover opt() defects in meta/cloudflare/supabase exporters, not this separate exporter or duplicate flags. Fresh all-state issue/PR searches for this exporter and duplicate value options found no specific item.

Why it matters

A duplicated --out-dir can route the tick or its failure artifact somewhere other than the operator's intended first destination, leaving the expected export looking stale. Last-value-wins is undocumented here and can conceal a duplicated argument in a timer or manual invocation.

Acceptance criteria

  • Reject repeated scalar value options (--db, --out-dir, --window-hours, --fresh-hours) as an invalid-argument usage failure before store probing or export writes.
  • For repeated --out-dir, do not write an artifact to either conflicting destination; report the duplicate flag and exit non-zero (2).
  • Add regression tests for duplicate options, especially two distinct --out-dir paths, and retain controls showing each option works once with existing behavior.

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/normalOrdinary priority (the default)
    effort/xsTrivial: expected under 30 minutes of work
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Nov 12, 2026
  2. developing-today commented on Nov 12, 2026

    @developing-today
    Contributor
  3. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 12, 2026
  4. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged

    • Agent: triage-step
    • State: triaged
    • Verdict: task/small-fix — reject repeated scalar value options in pm-stack/opencode-usage-export's parser (opencode-usage-export.mjs:363-373) as an invalid-argument usage failure before any store probing or export writes, instead of silently overwriting with the last value. priority/normal stands, per Drew's priorities brief line 5 ("Everything else by usefulness, not by age alone") — a bounded exporter correctness bug; nothing fleet-stalling under line 1 and not in the ID design-track expedite set under line 2. effort/xs stands, kind/bug (already on the issue).
    • First step: add duplicate detection for the scalar value options (--db, --out-dir, --window-hours, --fresh-hours) in the parser at opencode-usage-export.mjs:363-373, and add the two---out-dir regression case first as the reproduction.
    • Acceptance check: repeated scalar value options are rejected as invalid-argument before store probing or writes; for repeated --out-dir no artifact is written to either destination, the duplicate flag is reported, and the exit is non-zero (2); regression tests cover duplicates (especially two distinct --out-dir paths) and single-use controls keep existing behavior.
    • Fix packet: fleet queue task 15100 in repo-health-code-pilot (dedupe repo-health:v1:fix:developing-today/code:issue:8899, priority 40, small_fix), validated and enqueued by triage-step; no live task existed for this issue at triage time.
  5. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: repo-worker-code / any-n
    • State: in-progress
    • Task: queue task 15100; claimed atomically from the one queue.
    • Next: revalidate ownership, implement duplicate scalar-option rejection, and run focused tests.
  6. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    • Agent: repo-worker-code / any-n
    • State: pr-opened
    • Task: queue task 15100 completed with outcome pr_opened.
    • PR: fix(pm-stack): reject duplicate export options #8901 (open; CI pending).
    • Verification: focused suite 18/18 passed; diff check passed. Backlog/sweep bookkeeping deferred to fleet reconciliation per OpenChamber lane policy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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