Skip to content

Rectify: Architectural Constraint Catalog Discovery Immunity#3370

Merged
Trecek merged 4 commits into
developfrom
resolve-review-architectural-constraint-catalog-missing-ment/3331
May 31, 2026
Merged

Rectify: Architectural Constraint Catalog Discovery Immunity#3370
Trecek merged 4 commits into
developfrom
resolve-review-architectural-constraint-catalog-missing-ment/3331

Conversation

@Trecek
Copy link
Copy Markdown
Collaborator

@Trecek Trecek commented May 31, 2026

Summary

The resolve-review skill's Architectural Constraint Catalog is a manually curated table in SKILL.md that lists pytest-enforced constraints. Its staleness guard (test_catalog_reverse_coverage) uses a hardcoded file set and only searches tests/arch/ and tests/recipe/. This means new constraint tests added to any other directory (e.g., tests/workspace/, tests/server/, tests/execution/) silently go uncatalogued. The @-mention guard (test_no_hardcoded_username_mentions_in_skill_mds in tests/workspace/test_skills.py) is the immediate victim, but the pattern failure is broader: 52 structural/architectural guard tests exist across 7 directories (expanding to 56 tests across 9 directories after docstring normalization), the catalog lists only 13, and the staleness guard can only ever see tests in 2 of those directories.

The architectural solution: replace the manually curated catalog and its manually curated staleness guard with docstring-convention-based automatic discovery. The codebase already has a strong convention — most constraint tests use one of a small set of docstring prefixes. A discovery test can find all constraint tests by convention, validate the catalog covers them, and fail immediately when a new constraint test is added anywhere without a catalog entry.

Closes #3331

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/remediation-20260530-174543-571962/.autoskillit/temp/rectify/rectify_arch_constraint_catalog_discovery_2026-05-30_175800.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step Model count uncached output cache_read peak_ctx turns cache_write time
rectify* opus[1m] 1 80 26.3k 3.0M 125.7k 375 117.0k 30m 20s
review_approach* sonnet 1 62 7.4k 242.8k 53.7k 91 41.5k 5m 41s
dry_walkthrough* opus 1 58 20.1k 1.2M 65.0k 125 48.8k 9m 44s
implement* sonnet 1 1.6k 29.6k 1.9M 85.7k 104 70.5k 8m 18s
audit_impl* sonnet 1 70 12.1k 234.5k 40.9k 45 38.0k 6m 21s
prepare_pr* sonnet 1 195.7k 3.8k 355.6k 27.6k 31 15.8k 1m 55s
compose_pr* sonnet 1 57.8k 1.6k 162.5k 27.6k 16 15.5k 49s
review_pr* sonnet 3 684 150.9k 5.6M 108.9k 222 344.8k 40m 51s
resolve_review* opus 2 113 24.3k 2.3M 78.5k 105 160.0k 20m 11s
Total 256.2k 276.0k 15.0M 125.7k 851.8k 2h 4m

* Step used a non-Anthropic provider; caching behavior may differ.

Token Efficiency

Step LoC Changed cache_read/LoC cache_write/LoC output/LoC
rectify 0
review_approach 0
dry_walkthrough 0
implement 244 7868.1 289.0 121.3
audit_impl 0
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 67 34472.4 2387.4 363.1
Total 311 48129.9 2739.0 887.6

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
opus[1m] 1 80 26.3k 3.0M 117.0k 30m 20s
sonnet 6 256.0k 205.3k 8.5M 526.1k 1h 3m
opus 2 171 44.4k 3.5M 208.7k 29m 56s

@Trecek Trecek force-pushed the resolve-review-architectural-constraint-catalog-missing-ment/3331 branch from ddae1c0 to 7edb636 Compare May 31, 2026 02:27
Comment thread tests/skills/test_resolve_review_arch_constraint_awareness.py
f"Catalog references {ref} but it does not exist anywhere in tests/"
)


Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[warning] defense: catalog_section is extracted with a hardcoded 6000-character slice (skill_text[catalog_idx : catalog_idx + 6000]). The catalog section has grown significantly (20+ new rows added in this PR). If it exceeds 6000 chars, test filenames beyond that boundary will be silently missed, producing false-negative passes. The same pattern appears in test_catalog_forward_references_valid and test_catalog_completeness_via_discovery — all three occurrences need the same fix: use a section-delimiter approach instead of a magic constant.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged — minor suggestion noted. Already addressed in 7edb636 (section-delimiter extraction replaces hardcoded 6000-char slice).

Comment thread tests/_arch_constraint_discovery.py
Comment thread tests/_arch_constraint_discovery.py
Comment thread src/autoskillit/skills_extended/resolve-review/SKILL.md
Copy link
Copy Markdown
Collaborator Author

@Trecek Trecek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AutoSkillit review: blocking issues found. See inline comments.

⚠️ Outside Diff Range

These findings target lines not in the diff and could not be posted as inline comments:

tests/skills/test_resolve_review_arch_constraint_awareness.py

  • L176 [warning/defense]: catalog_section is extracted with a hardcoded 6000-character slice in test_catalog_forward_references_valid. Same fix needed as L195 — use section-delimiter extraction instead of a magic constant.

Trecek added 4 commits May 30, 2026 20:06
…onvention discovery

Adds `tests/_arch_constraint_discovery.py` which scans the full `tests/`
tree for test files whose module docstring starts with a recognized prefix
(Structural guard, AST guard, Architectural invariant, etc.).

Rewrites the two hardcoded staleness guards in
`test_resolve_review_arch_constraint_awareness.py`:
- `test_catalog_reverse_coverage`: now calls `discover_constraint_tests()`
  and asserts all non-excluded constraint tests appear in the SKILL.md catalog
- `test_catalog_forward_references_valid`: now uses `rglob("test_*.py")`
  from the full tests/ tree instead of hard-coded `tests/arch/` + `tests/recipe/`

Adds two new tests:
- `test_discovery_finds_known_constraints`: self-test confirming cross-directory
  discovery works (arch/, workspace/, recipe/)
- `test_catalog_completeness_via_discovery`: bidirectional completeness guard

Normalizes four non-conforming constraint test docstrings to the recognized
prefix convention so discovery finds them:
- `test_skills.py`: "Tests for..." → "Structural guard: ..."
- `test_clone_timeouts.py`: "Static analysis: ..." → "Structural guard: ..."
- `test_no_path_cwd_in_tools.py`: "Regression guard: ..." → "Structural guard: ..."
- `test_anti_pattern_guards.py`: "Guards against..." → "Structural guard: ..."

Expands the SKILL.md Architectural Constraint Catalog from 13 rows (covering
only tests/arch/ and tests/recipe/) to 38 rows covering all 31 discoverable
constraint tests that can be violated by reviewer suggestions. Adds the
originally-missing @-mention guard entry (`test_skills.py`) plus 24 others.

Updates supporting artifacts: `tests/_test_filter.py` BUCKET_A_PATTERNS,
`tests/CLAUDE.md` helper listing, `tests/skills/CLAUDE.md` description.
@Trecek Trecek force-pushed the resolve-review-architectural-constraint-catalog-missing-ment/3331 branch from 7edb636 to c29a46d Compare May 31, 2026 03:06
@Trecek Trecek added this pull request to the merge queue May 31, 2026
Merged via the queue into develop with commit 8d13b10 May 31, 2026
3 checks passed
@Trecek Trecek deleted the resolve-review-architectural-constraint-catalog-missing-ment/3331 branch May 31, 2026 03:17
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.

1 participant