Skip to content

Commit 847477f

Browse files
Jammy2211claude
authored andcommitted
fix: genericise tenant repo names to clear the firewall gate
The tenant-firewall gate failed on all three legs: generic organ code must not carry instance facts (satellite repo names) outside the declared config surfaces. Six tokens across three files. Refactored, not allowlisted, per the recorded doctrine ("derivable or arbitrary -> refactor; genuine branded fact -> declare the surface"; a comments/docstrings exemption was considered and rejected). None of these were load-bearing: the illustrative workspace shapes are described structurally (`dataset/<section>/<generated>/`) and the issue references live in the PR and commit trail, which is not organ code. The allowlist does not grow. Behaviour unchanged — comments, docstrings and test prose only. Suite still 370 passed, and reverting the originating workspace to its pre-fix state still reproduces the failure with the exact file, line and resolved path. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F11sMzmaVWfU6NCz1PKVVb
1 parent a8fb3f6 commit 847477f

3 files changed

Lines changed: 19 additions & 18 deletions

File tree

autohands/check_dataset_allowlist.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
(Group B, PyAutoBuild#126) — the guard skips it with a notice rather than
1818
failing, until that repo opts in.
1919
20-
Leg 2 (PyAutoArray#470) — the mirror-image failure. The check above asserts that
20+
Leg 2 — the mirror-image failure. The check above asserts that
2121
nothing *generated* got committed. This one asserts that nothing *committed* gets
2222
deleted: `should_simulate()` ends in `shutil.rmtree`, so a script that reaches an
2323
allowlisted dataset directory while `PYAUTO_SMALL_DATASETS=1` is still in force
@@ -247,11 +247,12 @@ def check_capped_deletion(prefixes, tracked) -> int:
247247

248248
# The invariant is NOT "the path sits under an allowlist prefix" -- it is
249249
# "rmtree(path) would delete committed files". Those differ, and the prefix
250-
# form over-reports: autocti_workspace commits five doc images directly in
251-
# `dataset/overview/` while its overview scripts regenerate
252-
# `dataset/overview/imaging_ci/uniform` and `dataset/overview/dataset_1d`,
253-
# which hold nothing tracked. Deleting those destroys nothing. Prefix
254-
# matching flagged all six as release-blocking failures.
250+
# form over-reports. The shape that exposed it: a workspace commits a handful
251+
# of documentation images directly in `dataset/<section>/`, while its scripts
252+
# regenerate sibling subdirectories `dataset/<section>/<generated>/` that hold
253+
# nothing tracked. Deleting those destroys nothing, but every one of them sits
254+
# under the allowlist prefix, so prefix matching reported them all as
255+
# release-blocking failures.
255256
def deletes_tracked(resolved: str) -> bool:
256257
return any(f == resolved or f.startswith(resolved + "/") for f in tracked)
257258

@@ -293,7 +294,7 @@ def deletes_tracked(resolved: str) -> bool:
293294
"git-tracked files kept by design (they carry an `!dataset/...` allowlist "
294295
"line). Under PYAUTO_SMALL_DATASETS=1 those files are deleted and replaced "
295296
"with capped-simulator output. Add a releasing token to the script's "
296-
"`__Env__` section (`ENV: full_datasets ...`) — see PyAutoArray#470.",
297+
"`__Env__` section (`ENV: full_datasets ...`).",
297298
file=sys.stderr,
298299
)
299300
return 1

autohands/env_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
# once. When auditing "which scripts still run capped / on NumPy / in test mode",
6161
# a script declaring `real_output` is already released on every one of them.
6262
# Treating the map as four single-var tokens under-counts the released set and
63-
# reports such a script as an offender; that mis-read cost real time during the
64-
# PyAutoArray#470 sweep. Derive membership from this map rather than hardcoding
63+
# reports such a script as an offender; that mis-read cost real time during a
64+
# cross-workspace audit. Derive membership from this map rather than hardcoding
6565
# a token list -- see `check_dataset_allowlist._releasing_tokens`.
6666
ENV_DECLARATION_TOKENS: Dict[str, tuple] = {
6767
"jax": ("PYAUTO_DISABLE_JAX",),

tests/test_dataset_allowlist_capped_deletion.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Regression tests for leg 2 of the dataset-allowlist guard (PyAutoArray#470).
1+
"""Regression tests for leg 2 of the dataset-allowlist guard.
22
33
Leg 1 asserts nothing *generated* got committed. Leg 2 asserts nothing
44
*committed* gets deleted: ``should_simulate`` ends in ``shutil.rmtree``, so a
@@ -10,7 +10,7 @@
1010
- **No false positives.** This runs in ``pre_build``; a spurious failure blocks a
1111
release. The predicate is "rmtree would delete tracked files", NOT "the path
1212
sits under an allowlist prefix" — those differ, and the prefix form flagged six
13-
safe autocti_workspace call sites.
13+
safe call sites in a real workspace (see the regression test below).
1414
- **No silent under-reporting.** An argument the resolver cannot evaluate is
1515
reported and skipped, never guessed.
1616
"""
@@ -45,8 +45,8 @@ def _resolve_call_arg(src: str):
4545
def test_resolves_multi_argument_path():
4646
"""`Path("dataset", "multi_galaxy", name)` is the dominant workspace idiom.
4747
48-
Handling only the single-argument form left ~31% of autolens_workspace call
49-
sites unresolved.
48+
Handling only the single-argument form left ~31% of the call sites in the
49+
largest workspace unresolved.
5050
"""
5151
src = (
5252
'from pathlib import Path\n'
@@ -146,9 +146,9 @@ def _run_check(tmp_path, monkeypatch, script_src, tracked, capsys):
146146
def test_sibling_dir_holding_no_tracked_files_is_not_a_violation(
147147
tmp_path, monkeypatch, capsys
148148
):
149-
"""The autocti_workspace shape: five doc images committed directly in
150-
`dataset/overview/`, while the overview scripts regenerate
151-
`dataset/overview/imaging_ci/uniform` — which holds nothing tracked.
149+
"""The real shape that exposed the bad predicate: a workspace commits doc
150+
images directly in `dataset/<section>/`, while its scripts regenerate a
151+
sibling `dataset/<section>/<generated>/` that holds nothing tracked.
152152
153153
Deleting that destroys nothing. Prefix matching against the allowlist called
154154
all six such call sites release-blocking failures; containment does not.
@@ -169,7 +169,7 @@ def test_sibling_dir_holding_no_tracked_files_is_not_a_violation(
169169
def test_path_holding_tracked_files_without_a_releasing_token_fails(
170170
tmp_path, monkeypatch, capsys
171171
):
172-
"""The PyAutoArray#470 shape itself."""
172+
"""The originating bug's shape: the resolved path itself holds tracked files."""
173173
src = (
174174
'"""\n__Env__\n\nENV: real_plots\n"""\n'
175175
'from pathlib import Path\n'
@@ -188,7 +188,7 @@ def test_path_holding_tracked_files_without_a_releasing_token_fails(
188188
def test_releasing_token_exempts_an_otherwise_failing_call_site(
189189
tmp_path, monkeypatch, capsys
190190
):
191-
"""Same script, plus `full_datasets` — the fix shipped for #470."""
191+
"""Same script, plus `full_datasets` — the shape of the shipped fix."""
192192
src = (
193193
'"""\n__Env__\n\nENV: full_datasets real_plots\n"""\n'
194194
'from pathlib import Path\n'

0 commit comments

Comments
 (0)