Skip to content

bug: should_simulate rmtree's committed, gitignore-allowlisted datasets under PYAUTO_SMALL_DATASETS=1 #470

Description

@Jammy2211

Overview

should_simulate deletes tracked, version-controlled data and replaces it with capped-simulator output. This is independent of the stale-dataset bug it was found alongside, and no variant of that fix addresses it.

autoarray/util/dataset_util.py, small-datasets branch:

if os.environ.get("PYAUTO_SMALL_DATASETS") == "1":
    if Path(dataset_path).exists():
        shutil.rmtree(dataset_path)

The rmtree is unconditional. It does not ask whether the directory holds generated data or committed data.

The live case

In autolens_workspace_test:

  • .gitignore:13 reads !dataset/point_source/simple/** — an explicit allowlist exception, i.e. this directory is deliberately committed. git ls-files confirms three tracked JSON files under it (point_dataset_positions_only.json, point_dataset_with_fluxes_and_time_delays.json, tracer.json). The allowlist comments describe this class as real/external data that must never be purged.
  • scripts/point_source/visualization/visualization.py:39 calls should_simulate("dataset/point_source/simple"), and the script declares only ENV: real_plots (line 22), so it keeps PYAUTO_SMALL_DATASETS=1 under the smoke profile defaults.

So an ordinary smoke run deletes committed data. It is then re-simulated through PointSolver.solve, which under the cap short-circuits to a fixed position pair (PyAutoLens autolens/point/solver/point_solver.py:119) — so the replacement content is not merely lower-resolution, it is degenerate.

Seven full-regime scripts then read that same directory, one of them in smoke_tests.txt.

Severity

The deletion is recoverable (git checkout -- dataset/point_source/simple) and shows up as a dirty working tree, so this is not data loss in the unrecoverable sense. But:

  • it silently violates the invariant the .gitignore allowlist exists to express;
  • it leaves developers with an unexplained dirty tree after a routine smoke run;
  • combined with the seven full-regime readers, it is the same mixed-regime collision class as feat: add title_prefix support to subplot_imaging_dataset #260, in a dataset family the shape-based fix is structurally blind to (JSON, no FITS).

Suggested direction

Make the destructive branch respect committed data rather than assuming every dataset directory is disposable. Options worth weighing:

  1. Skip rmtree for tracked paths — cheap to check, but puts a git dependency in a library utility, which is the wrong layer.
  2. Have the workspace declare the exception — give point_source/visualization/visualization.py a full_datasets-style profile entry so it never enters the small regime against committed data. Narrowest fix, but leaves the general footgun armed for the next allowlisted dataset.
  3. Regime path separation — capped runs write to a separate path so the two regimes never share a directory. This removes the collision rather than detecting it, and would also close feat: add title_prefix support to subplot_imaging_dataset #260's remaining gaps, but needs a path-rewrite layer in the IO with real sharp edges (committed read-only inputs like uv_wavelengths/sma.fits need read-fallback, plot outputs, absolute paths).

(2) unblocks the immediate case; (3) is the architecturally correct shape if this class of bug keeps recurring.

Context

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