Cluster-ablation splicer for leave-one-cluster-out#5
Merged
Conversation
Splices per-dataset blocks out of the expert harmonization monolith, producing an executable copy that harmonizes only the remaining datasets. Cells are keyed on `idx = N`; requiring each hold-out to map to a real block auto-rejects REF_IDX (0) and the excluded datasets, no coupling to cv_folds.yaml. Includes pytest + doctests with a synthetic fixture. Refs #4 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
cmungall
added a commit
that referenced
this pull request
Jun 30, 2026
- Fix repo_root default-arg bug: Option default None, resolve in body (was Path.cwd() evaluated at import time) [#6] - Audit the LS tool (path) [#8]; check Grep/Glob 'glob'/'pattern' for path-bearing patterns [#7] - Flag 'cd' into an answer location (answer key / real gold/processed), so a single-component read after it isn't missed [#1] - Remove dead '&& ||' token guard [#3] - --show-bash prints full multi-line commands instead of just the first line [#5] - Tests: LS, Grep glob, cd-into-answer-key, multi-cd chain, ~ expansion 53 tests green; real fold_ds07 trace still CLEAN. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cluster-ablation splicer for leave-one-cluster-out
Implements the splicer designed in #4. Given a hold-out set of datasets, it
produces an executable copy of the expert monolith
(
data/gold/expert_code/harmonize_ess-dive_soilmoisture_data.py) with thosedatasets' blocks removed, so the held-out cluster is absent from the agent's
exemplar context and any regenerated exemplar outputs.
How it works
The monolith is a series of
# %%cells; the 19 per-dataset blocks are eachexactly one cell anchored by a single
idx = N. The splice drops whole cellswhose
idxis held out and keeps everything else verbatim (config, sharedhelpers, the
REF_IDX = 0reference reads, and the location-dedup footer), sothe result stays runnable.
--holdoutaccepts integer indices ordataset_identifiers(resolved via the gold mapping JSON). No coupling to
cv_folds.yaml.block automatically rejects
REF_IDX(0) and the excluded datasets(11–14, 19–22), which carry no block — a clear
ValueErrorotherwise..pyto--output(or stdout).Example
Tests
keeps the suite independent of the full corpus; additional cases run against
the real gold file when present (19 blocks; cluster ablation stays
ast.parse-able withREF_IDX/footer preserved; rejects 0/11/19).Deferred
Per the discussion in #4, verifying the ablated script runs end-to-end is
gated on staging the raw inputs (separate work). This PR validates the splice
(correct blocks removed, output parses, scaffold preserved); the run-to-verify
step follows once
~/ess-dive_wfsfa_soil_datasets/is populated.Refs #4
🤖 Generated with Claude Code