Skip to content

fix(report): one-line exit 2 for bad inputs, name the cause of an empty join - #42

Merged
joepetjr merged 1 commit into
mainfrom
fix/report-errors
Oct 24, 2026
Merged

joepetjr merged 1 commit into
mainfrom
fix/report-errors

Conversation

@joepetjr

Copy link
Copy Markdown
Contributor

What

seo-manager report now handles bad inputs and an empty join cleanly instead of crashing or printing an empty report with no explanation.

  • A missing or unreadable ledger or videos.yaml, a ledger line that is not valid JSON (or has no timestamp), unparseable YAML, a videos.yaml without a top-level videos list, an entry missing id/title/date, and a bad date each print one line naming the cause to stderr and exit 2. No traceback.
  • A join that matches nothing still exits 0, but the report and stderr now say why: no videos, no events, no video id in common, or no views measurement.
  • An unwritable --out path exits 2 with one line.
  • README documents the behaviour.

Why

Before this, a bad input gave a raw JSONDecodeError/KeyError/FileNotFoundError traceback, and an empty join produced a table of zeros with no hint whether the cause was the wrong file, a stale ledger, or a missing metric.

Evidence

Red on base: the new tests/unit/test_perf_report.py copied onto origin/main gives 11 failed, 11 passed (all 11 new CLI error/empty-join tests fail, for example FileNotFoundError traceback on an unwritable --out).

Green on this branch, full suite (python -m pytest, run through the slot gate):

Required test coverage of 66.0% reached. Total coverage: 88.73%
================= 1495 passed, 20 xfailed, 2 xpassed in 36.80s =================

0 failed. Lint with the CI-pinned ruff 0.15.22 (ci/tools-requirements.txt): ruff check . all checks passed; ruff format --check . 172 files already formatted.

Diff: 4 files, 272 insertions, 28 deletions (300 total).

UI evidence: terminal-only change, no screenshots applicable.

@joepetjr
joepetjr merged commit 662cbe9 into main Oct 24, 2026
4 checks passed
@joepetjr
joepetjr deleted the fix/report-errors branch October 24, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant