Skip to content

feat(check_dataset_allowlist): cover simulate_if_needed call sites - #329

Merged
Jammy2211 merged 2 commits into
mainfrom
claude/pyautoarray-simulate-helper-yuqd16
Nov 1, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
claude/pyautoarray-simulate-helper-yuqd16

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Phase 2 of PyAutoLabs/PyAutoArray#669.

Summary

Leg 2 of the dataset-allowlist guard scans the code for should_simulate(...) call sites, to prove a capped run cannot rmtree committed dataset files. PyAutoArray's new one-line wrapper simulate_if_needed(dataset_path, simulator) reaches the same rmtree, so scripts swept onto it must stay covered.

  • Adds DELETING_CALLS = ("should_simulate", "simulate_if_needed"). should_simulate_sites matches both names.
  • The dataset path is taken from the first positional argument, or else from the dataset_path= keyword. A call with neither is ignored, as before.
  • The guard's pass/fail messages and docstrings mention both functions.

This works with or without the PyAutoArray release: it only parses source text.

Testing

New tests in tests/test_dataset_allowlist_capped_deletion.py:

  • The old 8-line should_simulate + subprocess.run block and the swept one-liner give the same (line, path) call site.
  • The dataset_path= keyword form resolves.
  • A simulate_if_needed() call with no path is ignored.
  • End to end: a swept script that would delete tracked files without a releasing __Env__ token still fails the gate.

Full suite: 559 passed, 10 failed. The same 10 failures (test_add_notebook_quotes, test_generate_validates_project, test_strip_env_declarations) occur on main without this change.

Merge mode: human /prm.


Generated by Claude Code

Leg 2 of the dataset-allowlist guard AST-scans for should_simulate(...)
call sites to prove a capped run cannot rmtree committed files.
PyAutoArray's new one-line wrapper simulate_if_needed(dataset_path,
simulator) reaches the same rmtree, so scripts swept onto it must stay
covered. The scan now matches both names (DELETING_CALLS), taking the
first positional argument or the dataset_path= keyword.

Tests show the old 8-line block and the swept one-liner resolve to the
same call-site path, the keyword form resolves, and a swept script that
reaches tracked files still fails the gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016nhQ8NyQo2s3YUk8eUrrB3
@Jammy2211
Jammy2211 merged commit 70f87b4 into main Nov 1, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the claude/pyautoarray-simulate-helper-yuqd16 branch November 1, 2026 15:59
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.

2 participants