Skip to content

feat: add check-tree-quality.sh with tests#13

Merged
mpawliszyn merged 1 commit intomainfrom
task6-check-tree-quality
Feb 26, 2026
Merged

feat: add check-tree-quality.sh with tests#13
mpawliszyn merged 1 commit intomainfrom
task6-check-tree-quality

Conversation

@mpawliszyn
Copy link
Copy Markdown
Collaborator

Summary

Structural quality checker for review-tree.md. Fourth and final script in Phase 1.

Script interface

scripts/check-tree-quality.sh <tree-file> <file-list> [--max-top-level N]

Takes a tree file and a diff file list (one path per line). Runs 6 checks, outputs pass/fail per check.

Checks

# Check Severity
1 HEAD SHA present Fail
2 Revision field present Fail
3 Description Verification section exists Fail
4 Top-level nodes <= threshold (default 7) Fail
5 Every diff file mapped to a tree node Fail
6 Variation nodes have repeat children Warn

Tests (14)

Category Tests
Valid tree 2 (passes, file coverage complete)
File coverage 1 (unmapped file detected)
Top-level threshold 2 (exceeds default, configurable)
Missing sections 3 (HEAD, Revision, Desc Verification)
Variation structure 1 (warn on no repeat children)
Validation 3 (missing args, non-existent files)
Output format 1 (all checks listed)

180 total tests across all suites.

Phase 1 Complete

This completes all 4 Phase 1 shell scripts:

  • update-node-status.sh (Task 3)
  • add-comment.sh (Task 4)
  • coverage-report.sh (Task 5)
  • check-tree-quality.sh (Task 6)

Shell script to validate structural quality of a review-tree.md file.
Takes a tree file and a diff file list. Outputs pass/fail per check.

Checks: HEAD SHA, Revision, Description Verification section,
top-level node count (default 7, configurable), file coverage
(every diff file mapped), variation structure (warn if no repeats).

Fixes from review:
- C1: gensub() replaced with POSIX match()/RSTART for macOS awk
- C2: variation pattern matches {variation comment} not just {variation}
- I1: grep -qxF for exact file path matching (no substring false positives)
- BSD sed: all sed patterns use [[:space:]] not \s
- Indent calculation: wc -c newline offset corrected

21 bats tests covering:
- Valid tree passes, unmapped file detected, threshold (default +
  configurable + boundary at 7), missing HEAD/Revision/DescVerification,
  variation warn (no repeats, {variation comment}, exit 0 on warn),
  no warnings on valid sample, exact path matching, empty file list,
  multiple failures reported together

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mpawliszyn mpawliszyn force-pushed the task6-check-tree-quality branch from 228f882 to 517c3b0 Compare February 26, 2026 03:33
@mpawliszyn mpawliszyn merged commit 95cdfc2 into main Feb 26, 2026
4 checks passed
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