Skip to content

fix(interpolator): add missing test for empty-instances guard; clear two stale NEEDS_FIX markers #1411

Closed

Description

@Jammy2211

Summary

Two NEEDS_FIX markers filed 2026-04-10 blame an IndexError in
InstanceInterpolator.__getitem__ when querying a between-samples time (1.5).
Both markers are stale. The underlying library bug was fixed by
PyAutoFit c8511b553 (2026-04-12) — two days after the markers were filed —
which added the empty-instances guard in autofit/interpolator/abstract.py.

Reproduction on clean main (2026-07-22)

All three repos clean and on main, with output/ moved aside so nothing was
served from cache:

Run Result
autofit_workspace scripts/features/interpolate.py, real, fresh output/ exit 0
same script under PYAUTO_TEST_MODE=1, no output/ at all exit 0
HowToFit chapter_1_introduction/tutorial_5_results_and_samples.py, real exit 0

Corrections to the original diagnosis

  • It is not a bracketing / off-by-one bug. t == 1.5 interpolation always
    worked — test_interpolator.py already exercises between-samples queries at
    1.5 in four places. The real failure was an empty instances list reaching
    self.instances[0], as the workspace marker's own text said ("value_map
    lookup falls through to empty instances list").
  • HowToFit tutorial_5 contains no interpolator code at all. The "likely
    related to InstanceInterpolator" text in that marker was a misattribution.

Residual gap

c8511b553 shipped the guard with no test. That is the only code change
left to make.

Plan (high level)

  1. Add the missing regression test for the empty-instances guard in PyAutoFit.
  2. Remove the stale NEEDS_FIX marker from autofit_workspace no_run.yaml.
  3. Remove the stale NEEDS_FIX marker from HowToFit no_run.yaml.
  4. Record here that the fix was c8511b553 and that the HowToFit marker's
    stated cause was never correct.

Plan (detailed)

  • PyAutoFit/test_autofit/interpolator/test_interpolator.py — add
    test_empty_instances_raises: construct af.LinearInterpolator([]), query
    interpolator.t == 1.5, assert pytest.raises(IndexError, match="no instances").
    numpy-only, no JAX. Verify with pytest test_autofit/interpolator/.
  • autofit_workspace/config/build/no_run.yaml — delete the
    features/interpolate line.
  • HowToFit/config/build/no_run.yaml — delete the
    chapter_1_introduction/tutorial_5_results_and_samples line.
  • No notebook regeneration — config-only change in both workspaces.

Branch: feature/interpolator-stale-needs-fix

Out of scope (to be filed separately)

Two exit-0 correctness smells noticed while reproducing, unrelated to the
IndexError:

  • HowToFit tutorial_5: the section printing "only the Gaussian normalization
    and sigma" emits 5 values instead of 2.
  • autofit_workspace features/interpolate: the aggregator block prints a
    different t=2 centre than the in-memory block (49.96 vs 59.73 in one run).

Activity

  1. Jammy2211 commented on Jul 22, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped — 2 PRs open

    Scope correction found during implementation

    The autofit_workspace half needed no change — the features/interpolate marker was already removed upstream by autofit_workspace PR #103 (7154e8a, "un-park features/interpolate (IndexError fixed)"). My initial grep hit a stale local main. Branch dropped, no PR for that repo.

    So of the three repos in the original prompt, only two were actually in play, and neither needed a behavioural fix — the library bug was fixed 2026-04-12.

    Notes

    • HowToFit's no_run.yaml now has zero entries. Both PyAutoHands loaders (run.py:53, run_python.py:46) do no_run_data or [], so the resulting None parse is handled — no build regression.
    • Two unrelated exit-0 correctness smells noticed while reproducing are recorded in the issue body under "Out of scope"; not filed as prompts yet.
  2. Jammy2211 commented on Jul 22, 2026

    @Jammy2211
    CollaboratorAuthor

    CLOSED — all 4 PRs merged

    PR Change
    #1412 test_no_instances regression test
    PyAutoLabs/HowToFit#24 Un-park tutorial_5 NEEDS_FIX
    PyAutoLabs/HowToFit#25 Stale filtering prose
    PyAutoLabs/autofit_workspace#104 Select instances by time, not position

    All green on Python 3.12 + 3.13 before merge.

    Net result: the IndexError this issue was filed for did not exist — fixed by c8511b553 on 2026-04-12, two days after the markers were parked. What the task actually produced was the missing regression test for that fix, removal of two stale NEEDS_FIX markers, and two genuine tutorial-correctness bugs found while reproducing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions