You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pm-stack(opencode-usage-export): reject duplicate value options instead of silently retargeting output #8899
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:
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.
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.
Activity
developing-today commentedon Nov 12, 2026
CODE-2693
dezren39 commentedon Nov 12, 2026
🤖 Agent note · triaged
opencode-usage-export.mjs:363-373) as aninvalid-argumentusage 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).--db,--out-dir,--window-hours,--fresh-hours) in the parser atopencode-usage-export.mjs:363-373, and add the two---out-dirregression case first as the reproduction.invalid-argumentbefore store probing or writes; for repeated--out-dirno 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-dirpaths) and single-use controls keep existing behavior.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.dezren39 commentedon Nov 12, 2026
🤖 Agent note · picked up
dezren39 commentedon Nov 12, 2026
🤖 Agent note · done
pr_opened.