Skip to content

feat(clean_slate): write-site dataset provenance, orphan reporting, gc phase, tests - #170

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/clean-slate-write-site
Jul 27, 2026
Merged

feat(clean_slate): write-site dataset provenance, orphan reporting, gc phase, tests#170
Jammy2211 merged 1 commit into
mainfrom
feature/clean-slate-write-site

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Final leg of the PyAutoMind dataset-bulk series: the wake_up cleanup now actually reclaims regenerated dataset bulk — safely, everywhere it runs, with tests. Closes #169.

The #167 rule (name+type literals in a simulator* file) missed every dataset written by a non-simulator script: the HowTo repos were a 100% miss and start_here.py-written dirs survived every sweep. The replacement judges by write site, never name mention:

  • New bin/dataset_provenance.py — stdlib AST analyzer, order-sensitive: it tracks which dataset path each variable holds at each point and whether that variable reaches a write call (output_to_fits, json.dump, open(..., "w"), or a same-repo helper whose body writes the parameter — one level of interprocedural resolution for the simulators/util.py idiom). Verdicts: REGENERABLE (deleted), DOWNLOADED (network-binding files blanket-protect their datasets — real cached data, kept silently), ORPHAN (no writer — kept and reported for a human call). Deletion requires positive evidence; reads cannot launder into writes (derivations are followed only through path-shaped expressions — the sdp81 start_here.py binds the real dataset it reads three lines from the simulated one it writes, and the analyzer keeps them apart). aplt.fits_array is deliberately not a write: dropping one auxiliary product into a real dataset folder is not generating the dataset (this exact case would have condemned cosmos_web_ring, real JWST data).
  • clean_slate.sh phase 1b delegates to the helper and hard-fails if it errors (no fallback — guessing provenance is what this replaces); prunes emptied dataset dirs; size warnings aggregate per dataset dir; new untracked-.ipynb_checkpoints sweep (__pycache__ deliberately kept — import cache); new per-repo git gc --auto phase (the HowTo repos had 42 MB of never-packed loose objects before this week's one-off gc).
  • wake_up.md guardrail wording made honest: clean-slate deletes untracked regenerable datasets (recreated on demand); it is recoverable-by-regeneration, not "reversible".

Validation

  • Tests 2 → 14 for clean_slate (phases 1/1b/2/3 previously had zero coverage): never-delete-tracked, simulator + start_here writers deleted, sdp81 read-vs-write doctrine case, download protection, orphan reported-not-deleted, per-dir size warning, empty-dir pruning, checkpoints swept / pycache kept, dry-run inertness, helper hard-fail aborts the sweep, unparseable-script tolerance. Full suite 178 passed.
  • Real-workspace DRY_RUN=1 acceptance: newly catches simulated_lens/simulated_galaxy/csv_api_example/start_here_example/howtolens/howtogalaxy (~8 MB across repos today); reports dataset/imaging/tutorial as orphan; none of the never-touch set (smacs0723, a2744, weak/a2744_pyrrg, multi/rxj1131, sdp81, uv_wavelengths) classifies as regenerable.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AcPSpRG8YqseMwRdJEK28m

…c phase, tests (#169)

- new bin/dataset_provenance.py: AST, order-sensitive write-site classifier
  (REGENERABLE / DOWNLOADED / ORPHAN) — deletion requires positive write
  evidence; name mentions never classify; reads cannot launder into writes
  (path-shaped derivation guard); one-level interprocedural resolution for the
  simulators/util.py idiom; network-binding files blanket-protect their datasets
- clean_slate phase 1b delegates to the helper (hard-fail, no fallback),
  reports orphans (kept), prunes emptied dataset dirs
- size warning aggregated per dataset dir (apparent-size), one line per dir
- new phases: untracked .ipynb_checkpoints sweep (__pycache__ deliberately
  kept — import-speed cache) and per-repo git gc --auto (skipped in dry-run)
- wake_up.md guardrail wording made honest: clean-slate deletes untracked
  regenerable datasets; orphans are reported for a human call
- tests: 12 new (14 total) covering never-delete-tracked, start_here writers,
  the sdp81 read-vs-write doctrine case, download protection, orphan reporting,
  per-dir warnings, empty-dir pruning, checkpoints/pycache, dry-run, helper
  hard-fail, unparseable-script tolerance

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AcPSpRG8YqseMwRdJEK28m
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.

feat(clean_slate): write-site dataset provenance, tests, gc phase, honest wake_up claim

1 participant