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 — fix(opencode-usage-export): validate --window-hours/--fresh-hours (#4739) by developing-today[bot] · Pull Request #6810 · developing-today/code

Conversation

@developing-today

@developing-today developing-today Bot commented Nov 7, 2026 •
edited by blacksmith-sh Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Fixes #4739.

opencode-usage-export parsed --window-hours / --fresh-hours with a bare Number(...) and never checked the result: --window-hours banana published a zero-filled status: "ok" document (breaking the module's fail-closed contract), --window-hours Infinity included every session, and --fresh-hours banana exited store-stale with a misleading "the live store may have moved" diagnosis for a healthy store.

Change

  • New parseHourFlag in opencode-usage-export.mjs: a missing, non-numeric, NaN, infinite, zero, or negative value throws ExportError("invalid-argument", exit 2) naming the flag — before any store read. The error carries the partially parsed args so the failure document still routes to --out-dir when one was given.
  • run() now routes argument errors through the same failure-document path as store errors instead of an uncaught throw (unknown flags get the same treatment).
  • Valid positive finite values behave exactly as before; a success document can no longer carry a non-finite or non-positive windowHours (it can only be built from a validated value or the defaults).

Tests

5 new cases in opencode-usage-export.test.mjs (junk window, missing window value, negative window, junk freshness — each asserting no ok document and a detail naming the bad argument — plus a valid-value control). Laptop run, node --test pm-stack/opencode-usage-export/opencode-usage-export.test.mjs: 9/9 pass (4 pre-existing + 5 new). The directory form (node --test pm-stack/opencode-usage-export/) fails identically on clean main — pre-existing, untouched by this PR. Full suite verification is CI's.

🤖 Queue worker lane F (fallback mode, queue backend down — code#6619).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
repo-worker-code-g
fix(opencode-usage-export): validate --window-hours/--fresh-hours (#4739
761c60f
)

A bare Number(...) with no check let a junk window publish a
zero-filled status:ok document (NaN window -> 0 sessions; Infinity ->
every session) and a junk freshness report a fresh store as moved
(store-stale). Both flags now go through parseHourFlag: missing,
non-numeric, NaN, infinite, zero, or negative values throw an
ExportError(invalid-argument, exit 2) naming the flag, before any
store read. run() routes argument errors to a failure document
(written to --out-dir when it was parsed) instead of an uncaught
throw. Valid positive finite values behave exactly as before.

Tests: 5 new cases in opencode-usage-export.test.mjs (junk window,
missing window value, negative window, junk freshness, valid-value
control) - 9/9 pass on the laptop, node --test file form. (The
directory form of node --test fails identically on clean main;
pre-existing, untouched.)
@developing-today
developing-today Bot requested review from a team and dezren39 as code owners November 7, 2026 05:32
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f42ab9cb-f2c0-4319-8945-69912b2a6672

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@developing-today developing-today Bot mentioned this pull request Nov 7, 2026
opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739
Closed
4 tasks
@dezren39 dezren39 mentioned this pull request Nov 7, 2026
opencode-usage-export: --db/--out-dir values are never validated — a trailing or empty --db silently exports the default store, a trailing --out-dir silently writes the default out dir, and a flag-like value crashes run() with no failure document #6934
Closed
4 tasks
@dezren39

dezren39 commented Nov 7, 2026

Copy link
Copy Markdown
Member

Cross-link from #6934 (filed this run): the residual --db/--out-dir door of #4739 that this PR does not cover — trailing/empty --db silently exports the default store, trailing --out-dir silently writes the default out dir, verified on current main (def55caf48, probe on the laptop). #6934 is queued as a small-fix to land after (or folded into) this PR; its acceptance criteria include not regressing this PR's parse-error failure-document restructure.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

repo-worker-code-g
Merge remote-tracking branch 'origin/main' into HEAD
5fe8e2c
# Conflicts:
#	pm-stack/opencode-usage-export/opencode-usage-export.test.mjs
@dezren39
dezren39 merged commit 4113bf0 into main Nov 8, 2026
2 of 5 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 deleted the queue/4739-usage-export-arg-validation branch November 8, 2026 00:00
@dezren39 dezren39 mentioned this pull request Nov 8, 2026
Fleet path Nix-build state: deployed fleet lags pkgs/fleet HEAD; remaining non-Nix pieces #5760
Open
@dezren39

dezren39 commented Nov 9, 2026

Copy link
Copy Markdown
Member

🤖 Agent note · pairwise salvage comparison (task 14162) — nothing unique in PR #4790 or PR #6107

  • Agent: repo queue worker, lane code-h (repo-worker-code)
  • Canonical: this PR (fix(opencode-usage-export): validate --window-hours/--fresh-hours (#4739) #6810, commit 761c60f) landed the opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739 fix on main: parseHourFlag rejects missing, non-numeric/NaN, infinite, zero, and negative hour values as a positive-finite check, and the error carries the partially parsed args so the failure document still routes to the selected --out-dir (line: err?.args?.outDir).
  • PR fix(usage-export): validate hours flags (#4739) #4790 diffed against canonical: its four tests (invalid --window-hours / --fresh-hours fail closed with exit 2 naming the flag; rejection before any store read; valid values retain behavior) map one-to-one onto behaviors + tests on main (junk/missing/negative window, junk fresh diagnosed invalid-argument not store-stale, valid positive behave as before). Its one distinctive behavior — preserving the selected output directory on usage errors — is the canonical's err.args mechanism above. Nothing unique.
  • PR Fix #4739: validate usage exporter hour options #6107 diffed against canonical: its tests (per-option invalid value rejected before store read; missing value before the next option; positive-finite preserves behavior) are the same behaviors; a flag-shaped value is Number("--fresh-hours") = NaN, rejected by the same canonical path the junk-value tests cover. Nothing unique.
  • Evidence: targeted suite on current main — node --test pm-stack/opencode-usage-export/opencode-usage-export.test.mjs → 12 pass, 0 fail. Issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739 is CLOSED (completed, 2026-11-08). Both duplicates are CONFLICTING with main and are being closed as superseded by task 14162; no branches deleted.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 9, 2026
fix(usage-export): validate hours flags (#4739) #4790
Closed
Fix #4739: validate usage exporter hour options #6107
Closed
Unowned PR batch from branch disposition (2026-11-07) #7297
Open
Closure audit: every closed issue/PR verified; unmerged branches + unpushed worktrees inventoried #7079
Open
fix(opencode-usage-export): validate --db/--out-dir values (#6934) #8695
Merged
@dezren39 dezren39 added the audit:complete PR fully implemented spawning issue label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@dezren39 dezren39 Awaiting requested review from dezren39

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

audit:complete PR fully implemented spawning issue

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.