← Back to Pull requests

Fix fetch_exomol rejecting string isotopes, add CO_p to EXOMOL_MOLECULES #1047

Merged
IshanAhu merged 3 files (78 lines) on Oct 26, 2026 09:43 UTC
View on GitHub
IshanAhu IshanAhu commented on Oct 20, 2026 21:32 UTC
Author

Description

Fixes #1045

Since 0.17, fetch_exomol rejects its own default isotope="1" and any string isotope: 75456cd (#949) replaced the int(isotope) conversion with an isinstance check.

Fix: accept only integers (int, np.integer, but not bool) and digit strings such as "1", converted to a plain int. Anything else ("1,2", "all", None, 1.7, True, Decimal("1.7")) raises a ValueError that shows the value it got.

Tests: test_fetch_exomol_valid_isotope and test_fetch_exomol_invalid_isotope (fast, offline, parametrized; monkeypatch stops the call before any download). The default call, 1, "1" and np.int64(1) must reach the lookup as int 1; "1,2", "abc", None, 1.5, 1.0, True, Decimal("1.7") and Fraction(3, 2) must raise. On develop, the default and "1" cases fail with the error from #1045.

CO_p (second commit): ExoMol added CO⁺ (CO_p), so test_ExoMol_molecules_list fails on develop and in the fast CI job. This adds it to EXOMOL_MOLECULES; ExoMol marks its CO⁺ line list as provisional.

Tested on Windows: the new test, test_ExoMol_molecules_list and CI's fast test selection pass, and pre-commit run --all-files is clean.

I used Claude code while working on this

Diff: 78 lines (+75 / -3) across 3 files Reviewer: prathamhole14 Review duration: 7931m
All Vouch review confidence checks passed
Residual risk 0.07 = Change Risk (0.32) × (1 − Review Confidence (0.80)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.32 · 78 lines diff across 3 files
0.32
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.70 · 2 substantive comment(s)
0.70
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
79%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.261
Real PR Conversation Timeline
6 items
codecov[bot] codecov[bot] commented on Oct 21, 2026 17:54 UTC
Bot

Codecov Report


:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 66.34%. Comparing base (3f5c86b) to head (55905d6).
:warning: Report is 28 commits behind head on develop.

<details><summary>Additional details and impacted files</summary>

@@             Coverage Diff             @@
##           develop    #1047      +/-   ##
===========================================
- Coverage    70.01%   66.34%   -3.68%     
===========================================
  Files           99       92       -7     
  Lines        19467    18191    -1276     
===========================================
- Hits         13630    12068    -1562     
- Misses        5837     6123     +286     

</details>
<details><summary> :rocket: New features to boost your workflow: </summary>

  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  • </details>

    prathamhole14 prathamhole14 commented on Oct 24, 2026 19:40 UTC
    Reviewer

    Fix looks good, thanks! A few small non-blocking suggestions:

    1. Accepting only ints and digit strings would be shorter and catch edge cases like Decimal("1.7") or Fraction(3, 2), which currently both become 1:

    if isinstance(isotope, str) and isotope.strip().isdecimal():
        isotope = int(isotope)
    elif isinstance(isotope, (int, np.integer)) and not isinstance(isotope, bool):
        isotope = int(isotope)
    else:
        raise ValueError(
            f"In fetch_exomol, ``isotope`` must be an integer or a digit string such as '1'. "
            f"Got {isotope!r}. Only one isotope can be queried at a time."
        )
    

    2. {isotope!r} in the error shows '1' instead of 1, and the message is missing a . before "Only one isotope".
    3. pytest.mark.parametrize would show which input failed.

    IshanAhu IshanAhu commented on Oct 25, 2026 14:09 UTC
    Author

    Thanks! All three applied in 55905d6:

    1. The check now accepts only ints and digit strings, so Decimal("1.7") and Fraction(3, 2) are rejected; both are added to the tests.
    2. The error message uses {isotope!r} and has the missing period.
    3. The tests are parametrized: test_fetch_exomol_valid_isotope (4 cases) and test_fetch_exomol_invalid_isotope (8 cases), so each input shows up separately, e.g. test_fetch_exomol_invalid_isotope[Decimal('1.7')].

    prathamhole14 prathamhole14 approved these changes on Oct 25, 2026 18:00 UTC
    Approved Reviewer

    LGTM

    minouHub minouHub approved these changes on Oct 26, 2026 09:17 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    IshanAhu IshanAhu
    Labels
    risk: low confidence: 79.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 32.1% (LOW) · Higher = larger blast radius
    32.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 79.7% · Lower = rushed or shallow review
    79.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 6.5% · Safe to merge
    6.5%
    Repository