Skip to content

feat(contract): test_count_baseline post-commit guard (#1584)#1619

Merged
nextlevelshit merged 2 commits into
mainfrom
feat/test-count-baseline-contract
Apr 30, 2026
Merged

feat(contract): test_count_baseline post-commit guard (#1584)#1619
nextlevelshit merged 2 commits into
mainfrom
feat/test-count-baseline-contract

Conversation

@nextlevelshit
Copy link
Copy Markdown
Collaborator

Closes #1584. Third sibling to #1582 (llm_judge) + #1583 (test_diff).

What

Post-commit test_count_baseline contract. Compares committed tree counts of test declarations: HEAD vs BaseRef (default HEAD~1). Catches deletions that slip past per-diff inspection (file moves, force-pushes within session, multi-commit sequences).

Language-agnostic

Shares TestFilePattern + TestFuncPattern with test_diff so a project configures patterns once. Defaults match Go.

- type: test_count_baseline
  base_ref: HEAD~1
  on_failure: rework

wave.yaml

Adds explicit Go patterns under project: so non-Go projects see the knobs:

project:
  test_file_pattern:
    - "*_test.go"
  test_func_pattern: '(?m)^[ \t]*func[ \t]+(Test|Example|Benchmark|Fuzz)[A-Za-z0-9_]*\b'

Tests

8 cases: no-change, addition, deletion fails, file move nets zero, higher tolerance, no base ref / no git silent pass, Python config detects deletion. All green locally.

Validation

No smoke pipeline yet — covered by internal/contract/test_count_baseline_test.go Go tests. Wiring into impl-issue.yaml after commit step is a separate small PR (mirrors test_diff plan).

Closes #1584. Defense-in-depth alongside test_diff (#1583) + llm_judge
(#1582). Compares COMMITTED tree counts of test declarations: HEAD vs
BaseRef (default HEAD~1). Catches deletions slipping past diff
inspection — file moves, force-pushes, multi-commit sequences.

Language-agnostic: shares TestFilePattern + TestFuncPattern with
test_diff. wave.yaml documents the Go defaults explicitly so non-Go
projects know the knobs.

Tests cover: no-change, addition, deletion, file-move, tolerance
config, no-base-ref / no-git silent pass, Python config.
Without these fields the wave.yaml entries from the same PR fail YAML
unmarshal in TestLoadWaveYAML_PersonaPermissions. Mirrors the contract
fields added in internal/contract/contract.go.
@nextlevelshit nextlevelshit merged commit e3d5eed into main Apr 30, 2026
10 checks passed
@nextlevelshit nextlevelshit deleted the feat/test-count-baseline-contract branch April 30, 2026 11:09
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.

impl-issue contract: post-commit Test-count baseline check

1 participant