Skip to content

v26 remaining P1s: templates + interval + MCP debug + P0 regression test#44

Merged
lucapinello merged 1 commit intomainfrom
fix/2026-04-23-v26-remaining-p1s
Apr 24, 2026
Merged

v26 remaining P1s: templates + interval + MCP debug + P0 regression test#44
lucapinello merged 1 commit intomainfrom
fix/2026-04-23-v26-remaining-p1s

Conversation

@lucapinello
Copy link
Copy Markdown
Contributor

Summary

Closes the 4 remaining v26 items (3 P1s + 1 regression test) that didn't land in the parallel 96fc28d commit. That commit picked up the track-ID _validate_assay_ids override + INFO→DEBUG demotion — great. These 5 files are the rest.

Answer to "so all good?": not quite — these 4 remaining items are real and worth one more small PR.

P1 #12 — subprocess templates raised bare Exception

Both predict_template.py files had raise Exception(f"Some assay IDs not found in metadata: {args['assay_ids']}"). The env-runner wraps subprocess failures in RuntimeError, so users saw a generic traceback instead of a recognisable type. Now raises ValueError with:

  • A specific list of missing IDs (vs dumping the whole assay_ids arg)
  • A get_track_info() pointer consistent with the direct-load path

P1 #13chorus/core/interval.py bare Exception('')

CIGAR parser fallback at line 673 raised an empty Exception('') — if a user ever hit it they'd get no information. Replaced with IntervalException naming the bad CIGAR symbol and the valid set '=MIDX'.

P1 #18 — MCP _safe_tool hides traceback

The decorator returns {"error", "error_type", "tool"} dicts on failure. MCP clients debugging a failing tool can't see which line raised. Opt-in via CHORUS_MCP_DEBUG=1 env var now includes a "traceback" field in the error payload. Default behaviour unchanged.

P0 regression test

96fc28d added EnformerOracle._validate_assay_ids but shipped no regression test. Added test_unknown_track_id_gives_actionable_error that exercises the override with a stubbed metadata (no TF needed in the base chorus env). Covers:

  • Unknown ENCFF… ID → InvalidAssayError naming list_tracks / search_tracks
  • Unknown description → same
  • None/[] input → no-op, doesn't raise

Test plan

  • pytest tests/ --ignore=tests/test_smoke_predict.py -q340 passed / 1 skipped (+1 from 339, the new regression test)
  • Manual: oracle.predict(..., ['ENCFF999BADID']) via env-runner → error contains get_track_info() + list of missing IDs
  • grep "raise Exception('')" chorus/ → 0 matches (was 1)
  • grep "raise Exception(f\"Some assay" chorus/ → 0 matches (was 2)
  • CHORUS_MCP_DEBUG=1 includes traceback in MCP error payload; unset omits it

🤖 Generated with Claude Code

…egression test

Picks up the parts of v26 my PR #43 fixed that didn't land in the
parallel 96fc28d commit. 96fc28d landed the track-ID _validate_assay_ids
override + INFO→DEBUG demotion (4 files). These 5 files close the
remaining items from v26's list.

## P1 #12 — subprocess templates raise bare Exception

enformer_source/templates/predict_template.py and
borzoi_source/templates/predict_template.py had

  raise Exception(f"Some assay IDs not found in metadata: {...}")

The env-runner wraps subprocess failures in RuntimeError, so the
user saw a generic traceback prefix instead of a recognisable
exception type. Upgraded to ValueError with a `get_track_info()`
pointer and a specific missing-IDs list (vs dumping the whole
assay_ids arg).

## P1 #13 — interval.py bare Exception('')

CIGAR parser fallback at interval.py:673 raised an empty Exception('')
— meaningless if a user ever hit it. Replaced with IntervalException
naming the bad symbol + valid set ('=MIDX').

## P1 #18 — MCP _safe_tool hides traceback

The decorator returns {"error", "error_type", "tool"} dicts — MCP
clients debugging a failing tool couldn't see which line raised.

Opt-in: CHORUS_MCP_DEBUG=1 includes a "traceback" field in the error
payload. Default behaviour unchanged.

## P0 #9 regression test

tests/test_prediction_methods.py::test_unknown_track_id_gives_actionable_error
exercises the EnformerOracle._validate_assay_ids path (96fc28d added
this override, but no regression test for it landed). Covers:
- unknown ENCFF ID → InvalidAssayError naming list_tracks/search_tracks
- bad description → same
- None/[] input → no-op (doesn't raise)

Stubs enformer_metadata.get_metadata so the test runs in the base
chorus env without TF.

## Tests

340 passed / 1 skipped in 9m 17s (+1 regression test from 339).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lucapinello lucapinello merged commit 27f728d into main Apr 24, 2026
1 check passed
@lucapinello lucapinello deleted the fix/2026-04-23-v26-remaining-p1s branch April 24, 2026 10:31
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