Skip to content

T5-P5-A13-WP1 Make JSON Contract Card Staleness Detectable#4104

Merged
Trecek merged 3 commits into
developfrom
t5-p5-a13-wp1-make-json-contract-card-staleness-detectable-i/4032
Jun 13, 2026
Merged

T5-P5-A13-WP1 Make JSON Contract Card Staleness Detectable#4104
Trecek merged 3 commits into
developfrom
t5-p5-a13-wp1-make-json-contract-card-staleness-detectable-i/4032

Conversation

@Trecek

@Trecek Trecek commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Create tests/arch/test_recipe_contract_freshness.py — a parametrized architectural test that enforces JSON contract card freshness at CI time. The test discovers all .yaml contract cards under builtin_recipes_dir() / "contracts", verifies each has a matching .json companion with content parity, guards against collection count rot (>= 15), and detects orphan JSON files. This makes contract card staleness merge-blocking alongside the existing diagram staleness enforcement in test_recipe_diagram_freshness.py.

Basename note: A file tests/hooks/test_recipe_contract_freshness.py already exists — it tests the pre-commit hook script (scripts/recipe_contract_freshness.py) and carries layer("hooks"). The new arch-layer file tests a different concern (CI-time JSON card parity) and the basename collision is benign: different directories, different markers, different imports, different purpose. The cascade map entry at tests/_test_filter.py:741 correctly references the hooks file; the arch file needs no cascade entry because arch/ is in ALWAYS_RUN_* sets.

Closes #4032

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/impl-20260613-005940-568369/.autoskillit/temp/make-plan/t5_p5_a13_wp1_json_contract_card_freshness_plan_2026-06-13_010600.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step Model count uncached output cache_read peak_ctx turns cache_write time
plan* opus[1m] 1 69 18.8k 1.5M 94.9k 59 77.3k 13m 41s
verify* sonnet 1 2.8k 11.6k 324.7k 53.5k 25 32.6k 5m 20s
implement* MiniMax-M3 1 1.7M 8.2k 0 0 73 0 4m 20s
fix* sonnet 1 134 3.8k 727.1k 55.8k 35 35.1k 3m 0s
audit_impl* sonnet 1 1.7k 7.6k 163.6k 39.0k 11 26.7k 3m 37s
prepare_pr* MiniMax-M3 1 190.4k 2.2k 0 0 11 0 53s
compose_pr* MiniMax-M3 1 177.2k 1.2k 0 0 12 0 46s
review_pr* sonnet 2 258 24.0k 1.4M 59.5k 70 73.4k 7m 5s
resolve_review* sonnet 1 275 13.6k 2.0M 77.8k 78 56.8k 13m 33s
Total 2.0M 91.1k 6.1M 94.9k 302.0k 52m 19s

* 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 69 0.0 0.0 119.2
fix 5 145425.8 7030.0 765.4
audit_impl 0
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 9 220712.1 6313.4 1510.0
Total 83 74010.3 3638.0 1097.5

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
opus[1m] 1 69 18.8k 1.5M 77.3k 13m 41s
sonnet 5 5.2k 60.7k 4.6M 224.7k 32m 38s
MiniMax-M3 3 2.0M 11.6k 0 0 6m 0s

Trecek and others added 3 commits June 13, 2026 01:21
Adds tests/arch/test_recipe_contract_freshness.py — parametrized arch test
that enforces JSON contract card freshness at CI time. Mirrors the existing
diagram staleness enforcement in test_recipe_diagram_freshness.py.

Tests:
- test_json_card_exists: every .yaml contract must have a .json companion
- test_json_card_content_parity: yaml.safe_load == json.loads
- test_collection_count_rot_guard: >= 15 stems (silent deletion detector)
- test_no_orphan_json_cards: no .json without matching .yaml

The basename collision with tests/hooks/test_recipe_contract_freshness.py
is benign — different directories, different markers, different purposes.
The arch file needs no cascade entry (arch/ is in ALWAYS_RUN_* sets).
Fixes two ruff violations in test_recipe_contract_freshness.py:
- F401: `pathlib.Path` imported but unused
- TID251: `yaml.safe_load` banned; use `load_yaml()` from autoskillit.core.io

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…MINIMUM_CONTRACT_COUNT

Addresses two reviewer warnings:
1. Add test_contracts_dir_exists() to provide direct diagnostic failure when
   _CONTRACTS_DIR doesn't resolve — clearer than relying solely on the count guard.
2. Add inline comment to MINIMUM_CONTRACT_COUNT explaining it is a shrinkage floor
   set below current count (17 at creation time).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Trecek Trecek added this pull request to the merge queue Jun 13, 2026
Merged via the queue into develop with commit 2f62a6a Jun 13, 2026
3 checks passed
@Trecek Trecek deleted the t5-p5-a13-wp1-make-json-contract-card-staleness-detectable-i/4032 branch June 13, 2026 09:05
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