Skip to content

v26 P2 #5: error-style consistency sweep#47

Merged
lucapinello merged 1 commit intomainfrom
fix/2026-04-24-error-style-sweep
Apr 24, 2026
Merged

v26 P2 #5: error-style consistency sweep#47
lucapinello merged 1 commit intomainfrom
fix/2026-04-24-error-style-sweep

Conversation

@lucapinello
Copy link
Copy Markdown
Contributor

Summary

Closes the final v26 audit item (P2 #5 — inconsistent error style). No behavioural changes; just uniform periods and actionable fix hints across the CLI and oracle surfaces.

CLI

  • logger.error(...) messages all end with a period; HF-token rejections point at https://huggingface.co/settings/tokens.
  • chorus remove --oracle, chorus genome download errors name the exact follow-up command.
  • _setup_prefetch.py return-tuple strings capitalised + period-terminated so the " - {err}" render under chorus setup reads uniformly.

Oracles

  • "Failed to load X model in environment" → names the conda env (chorus-X) + points at chorus health --oracle X, across Enformer / Borzoi / ChromBPNet / Sei / LegNet.
  • "Failed to load X model: {e}" now ends with a period; dropped redundant str(e).
  • ChromBPNet's 6 ValueError calls for bad assay/cell/fold become InvalidAssayError (matches Enformer/Borzoi/Sei/AlphaGenome). Dual ChorusError, ValueError inheritance keeps except ValueError callers working.
  • AlphaGenome HF-auth error message ends with a period.

Scope: 9 files, +97/−46.

Test plan

  • pytest tests/ --ignore=tests/test_smoke_predict.py -q → 340 passed, 1 skipped
  • chorus setup --oracle fakeoracle → clean period-terminated message with valid list
  • chorus remove --oracle fakeoracle → "Environment for 'fakeoracle' does not exist. Run `chorus list` to see installed oracles."

v26 status after this

All 16 v26 items closed. No outstanding audit findings.

🤖 Generated with Claude Code

Uniform treatment of user-facing error messages across the CLI and
oracle surfaces, closing the last v26 audit item. No behavioural
changes — just readability and actionability.

CLI (cli/_tokens.py, cli/main.py, cli/_setup_prefetch.py):
- All `logger.error(...)` messages now end with a period.
- HF-token-rejected errors point at
  https://huggingface.co/settings/tokens (retry hint).
- `chorus remove --oracle`, `chorus genome download`, `chorus setup`
  errors include the exact follow-up command to try.
- `_setup_prefetch.py` return-tuple error strings are capitalised
  and period-terminated for uniform rendering under main.py's
  `"  - {err}"` loop.

Oracles (oracles/*.py, not _source/):
- All "Failed to load X model in environment" errors now name the
  conda env (`chorus-X`) and point at `chorus health --oracle X`.
- All "Failed to load X model: {e}" errors end with a period
  (dropping superfluous `str(e)` since f-string formatting handles
  __str__ automatically).
- ChromBPNet's 6 `ValueError` calls for bad assay/cell/fold combos
  become `InvalidAssayError`, matching how Enformer / Borzoi / SEI /
  AlphaGenome handle the same class of user error. Dual
  `ChorusError, ValueError` inheritance (from v26 P2 #19) means
  `except ValueError` still works.
- AlphaGenome's HF-auth error message ends with a period.

Tests: 340 passed, 1 skipped on fast suite.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lucapinello lucapinello merged commit 41916af into main Apr 24, 2026
1 check passed
@lucapinello lucapinello deleted the fix/2026-04-24-error-style-sweep branch April 24, 2026 22:18
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