[FEATURE] Add Content-Aware Cascade Downgrade for Additive-Only Changes#2130
Merged
Trecek merged 5 commits intoMay 7, 2026
Merged
Conversation
…o _type_enums
Add _is_additive_only() that inspects the diff to detect removed definitions
(class/function/UPPER_CASE constants). When a universal core module has an
exclusion entry (_CORE_UNIVERSAL_EXCLUSIONS) and its diff is additive-only,
the cascade excludes the safe-to-skip directories instead of running all 17.
Implementation:
- Add _BREAKING_DEF_RE regex to detect removed definitions
- Add _CORE_UNIVERSAL_EXCLUSIONS dict mapping _type_enums → {"hooks", "skills"}
- Add _is_additive_only() function following the existing content-aware pattern
(git merge-base + git diff --unified=0, fail-open on error)
- Update classification path (Site 1): initial changed-files loop
- Update classification path (Site 2): re-export closure expansion
Tests:
- TestIsAdditiveOnly: 12 unit tests covering additions, removals, renames,
mixed diffs, empty diffs, git errors, invalid SHA, indented removals
- TestBuildTestScopeUniversalExclusions: 6 integration tests covering
narrowed cascade, full cascade fallback scenarios
- TestCoreUniversalExclusions: 6 contract tests for _CORE_UNIVERSAL_EXCLUSIONS
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The tests previously used exact set equality but build_test_scope in conservative mode adds always-run dirs (arch, contracts) and unconditional individual files (infra, hooks structural tests). Switch to presence/absence assertions matching the pattern in test_test_filter_core_cascade.py.
…on guard - Widen _BREAKING_DEF_RE from [A-Z_]+ to [A-Z_][A-Z0-9_]* to detect digit-containing constants (e.g., ENUM_V1); use \s* instead of literal space to also catch type-annotated forms (FOO: int = 1). - Add absolute-path guard to _is_additive_only: return False immediately if filepath is absolute to prevent vacuously-additive results from empty git diff output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add mock_run.assert_not_called() to test_universal_without_exclusion_entry to document that io.py (universal but no exclusion entry) takes the full cascade path without calling _is_additive_only. - Renumber section labels (T1→T3, T2→T4, T3→T5) to avoid collision with pre-existing (T1) for TestCheckBucketAContentAware; update module docstring. - Remove hardcoded '17-dir cascade' count from docstring (stale-prone). - Remove test_reexport_closure_universal_additive_uses_narrowed: the test did not exercise the closure path (source files absent from tmp_path made _expand_reexport_closure no-op), making it functionally identical to the direct additive-only test. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Trecek
added a commit
that referenced
this pull request
May 8, 2026
…es (#2130) ## Summary Add content-aware diff inspection to the test filter's core module classification path. When a file in `_CORE_UNIVERSAL_MODULES` has additive-only changes (no removed definitions), subtract a per-stem exclusion set from the cascade instead of triggering the full 17-directory cascade. For non-additive changes (removals, renames), preserve the full cascade as a fail-safe. Currently, `_type_enums` triggers all 17 cascade directories on any change. With this feature, additive-only changes to `_type_enums` will exclude `{"hooks", "skills"}`, reducing the cascade to 15 directories. The pattern is extensible to other universal modules. The design follows the established content-aware pattern (`_is_only_version_changes_in_diff` / `check_bucket_a_content_aware`) — same `git merge-base` + `git diff --unified=0` subprocess calls, same fail-open error handling, same `cwd`/`base_ref` gating. ## Requirements - REQ-CONTENT-001: Add `_CORE_UNIVERSAL_EXCLUSIONS` dict mapping stems to excludable test directories - REQ-CONTENT-002: Implement `_is_additive_only()` using git diff against the existing `base_sha` - REQ-CONTENT-003: Integrate into the classification path at `tests/_test_filter.py` ~line 1131 — when a universal module file has additive-only changes, subtract exclusions from the cascade - REQ-CONTENT-004: For non-additive changes, preserve the full cascade (fail-safe) - REQ-CONTENT-005: Add tests for the content-aware detection: additive diffs, removal diffs, rename diffs, mixed diffs - REQ-CONTENT-006: Follows the existing content-aware pattern (`check_bucket_a_content_aware`) — the `base_ref` plumbing already exists - REQ-CONTENT-007: All existing tests must continue to pass Closes #2039 ## Implementation Plan Plan file: `/home/talon/projects/autoskillit-runs/impl-20260506-224108-709752/.autoskillit/temp/make-plan/add_content_aware_cascade_downgrade_plan_2026-05-06_224600.md` 🤖 Generated with [Claude Code](https://claude.com/claude-code) via AutoSkillit <!-- autoskillit:pipeline-signature steps=prepare_pr,run_arch_lenses,compose_pr,annotate_pr_diff,review_pr --> ## Token Usage Summary | Step | Model | count | uncached | output | cache_read | peak_ctx | turns | cache_write | time | |------|-------|-------|----------|--------|------------|----------|-------|-------------|------| | plan | claude-opus-4-6 | 1 | 2.8k | 16.8k | 818.9k | 71.0k | 63 | 62.6k | 8m 39s | | verify | claude-opus-4-6 | 1 | 58 | 10.6k | 955.0k | 60.2k | 108 | 47.2k | 6m 30s | | implement* | MiniMax-M2.7-highspeed | 1 | 859.0k | 12.4k | 1.3M | 58.9k | 87 | 47.6k | 5m 50s | | fix | claude-opus-4-6 | 1 | 59 | 16.5k | 1.7M | 76.9k | 60 | 64.1k | 7m 13s | | prepare_pr* | MiniMax-M2.7-highspeed | 1 | 103.2k | 4.2k | 255.5k | 28.7k | 28 | 15.3k | 1m 34s | | compose_pr* | MiniMax-M2.7-highspeed | 1 | 67.2k | 1.7k | 255.5k | 28.7k | 19 | 15.0k | 58s | | **Total** | | | 1.0M | 62.2k | 5.3M | 76.9k | | 251.7k | 30m 47s | \* *Step used a non-Anthropic provider; caching behavior may differ.* ## Token Efficiency | Step | LoC Changed | cache_read/LoC | cache_write/LoC | output/LoC | |------|-------------|----------------|-----------------|------------| | plan | 0 | — | — | — | | verify | 0 | — | — | — | | implement | 527 | 2457.9 | 90.3 | 23.6 | | fix | 135 | 12476.5 | 474.6 | 121.9 | | prepare_pr | 0 | — | — | — | | compose_pr | 0 | — | — | — | | **Total** | **662** | 7952.4 | 380.2 | 94.0 | ## Model Usage Breakdown | Model | steps | uncached | output | cache_read | cache_write | time | |-------|-------|----------|--------|------------|-------------|------| | claude-opus-4-6 | 3 | 2.9k | 43.9k | 3.5M | 173.8k | 22m 24s | | MiniMax-M2.7-highspeed | 3 | 1.0M | 18.3k | 1.8M | 77.9k | 8m 22s | --------- Co-authored-by: Claude Opus 4.7 <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.
Summary
Add content-aware diff inspection to the test filter's core module classification path. When a file in
_CORE_UNIVERSAL_MODULEShas additive-only changes (no removed definitions), subtract a per-stem exclusion set from the cascade instead of triggering the full 17-directory cascade. For non-additive changes (removals, renames), preserve the full cascade as a fail-safe.Currently,
_type_enumstriggers all 17 cascade directories on any change. With this feature, additive-only changes to_type_enumswill exclude{"hooks", "skills"}, reducing the cascade to 15 directories. The pattern is extensible to other universal modules.The design follows the established content-aware pattern (
_is_only_version_changes_in_diff/check_bucket_a_content_aware) — samegit merge-base+git diff --unified=0subprocess calls, same fail-open error handling, samecwd/base_refgating.Requirements
_CORE_UNIVERSAL_EXCLUSIONSdict mapping stems to excludable test directories_is_additive_only()using git diff against the existingbase_shatests/_test_filter.py~line 1131 — when a universal module file has additive-only changes, subtract exclusions from the cascadecheck_bucket_a_content_aware) — thebase_refplumbing already existsCloses #2039
Implementation Plan
Plan file:
/home/talon/projects/autoskillit-runs/impl-20260506-224108-709752/.autoskillit/temp/make-plan/add_content_aware_cascade_downgrade_plan_2026-05-06_224600.md🤖 Generated with Claude Code via AutoSkillit
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown