Skip to content

fix: test-mode bypass never writes .completed, so bypassed fits are not resumable #1387

Closed

Description

@Jammy2211

Overview

_fit_bypass_test_mode (the PYAUTO_TEST_MODE=2/3 sampler bypass) writes samples, summary and results but returns without self.paths.completed() — unlike start_resume_fit. A bypass-"completed" search is therefore never seen as complete, so re-running the same script re-bypasses every stage instead of taking result_via_completed_fit. This defeats the resume-representative purpose of PYAUTO_TEST_MODE_SAMPLES (#1378/#1381) and was found by the SLaM resume profiler (autolens_profiling#70), which carries a runtime stopgap.

Plan

  • Call self.paths.completed() before the return in _fit_bypass_test_mode (mirrors start_resume_fit; NullPaths/DatabasePaths no-op safely).
  • Unit test: after a bypassed fit(), paths.is_complete is true and a second fit() routes through result_via_completed_fit.
  • Rider (deferred): remove the stopgap block in autolens_profiling/pipeline_resume/slam_resume.py once the repo's current claim frees — the stopgap is a harmless no-op after this fix.
Detailed implementation plan

Work Classification

Library (PyAutoFit)

Branch Survey

Repository Current Branch Dirty?
./PyAutoFit main clean

Suggested branch: feature/test-mode-bypass-completed

Implementation Steps

  1. autofit/non_linear/search/abstract_search.py::_fit_bypass_test_mode — add self.paths.completed() immediately before return result (after model.unfreeze()).
  2. Test in test_autofit/non_linear/ near existing test-mode bypass coverage: run a bypassed fit with DirectoryPaths into tmp, assert paths.is_complete; call fit() again and assert the completed-fit path is taken (e.g. monkeypatch start_resume_fit to raise / spy on result_via_completed_fit).
  3. Full test_autofit/ suite.

Key Files

  • autofit/non_linear/search/abstract_search.py
  • test_autofit/non_linear/ (bypass tests)

Original Prompt

Click to expand starting prompt

Found during slam-resume-profiling (autolens_profiling#70, the test-mode epic's phase 3): in
@PyAutoFit autofit/non_linear/search/abstract_search.py, _fit_bypass_test_mode (the
PYAUTO_TEST_MODE=2/3 path) writes samples, summary and results but returns without calling
self.paths.completed() — unlike start_resume_fit, which marks completion before returning.

Consequence: a bypass-"completed" search is never seen as complete (paths.is_complete false), so
re-running the same script re-bypasses every stage instead of taking result_via_completed_fit.
This defeats the resume-representative purpose of PYAUTO_TEST_MODE_SAMPLES (PyAutoFit#1378/#1381):
the docstring promises "downstream code sees a complete result folder", and .completed is part of
a complete result folder.

Fix is one line — call self.paths.completed() before the return in _fit_bypass_test_mode
(NullPaths/DatabasePaths already no-op safely, matching the surrounding save calls). Add a unit test
asserting paths.is_complete after a bypassed fit, and that a second fit() routes through
result_via_completed_fit.

The autolens_profiling harness (pipeline_resume/slam_resume.py, _install_resume_timers) carries a
runtime patch applying exactly this marker as a stopgap — remove that patch block when this ships.

Activity

  1. added a commit that references this issue on Jul 17, 2026
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