Repository navigation
Refine legacy test-first into complete base-aware package checks - #183
Conversation
There was a problem hiding this comment.
AI code review — 💬 Comment
Risk tier: lite · 0 critical · 1 warnings · 1 suggestions
Reviewers: security 1 · code-quality 0 · performance 0 · documentation 1
1. ⚠️ Warning — Incomplete package discovery can suppress the legacy whole check
📍 runs/contextful-gate.ts:56-59
'splitTestFirst' is enabled whenever base-aware discovery returns 'test-first.validate', without verifying that all required 'test-first.*' parts were discovered. A partial or malformed successful discovery can therefore omit 'test-first' from the merged stages and bypass the legacy whole-package check. Require the complete expected part set (or otherwise prove the whole check is safely replaced) before filtering the base stage.
2. 💡 Suggestion — Comment overstates which checks are refined
The comment says that “complete base-aware parts” refine their legacy whole check, but the implementation only removes the legacy 'test-first' stage under a specific 'test-first.validate' condition. Update the comment to describe this exact behavior, or broaden the implementation if other package parts are intended to follow the documented rule.
The Contextful gate runs one test-first check per changed package instead of repeating the legacy grouped check after complete discovery against the pull request's base. The grouped check otherwise repeats every package inside one command and can exhaust its wall clock despite the package checks succeeding.
The discovery result carries whether the exact base-aware command succeeded. Only that provenance, together with the split validation marker, refines the base's whole
test-firstcheck. Compatibility fallback retains the whole check. Unrelated base-only checks and split package names remain required; malformed or failed discovery dispatches no children and fails the parent. Validate-only discovery supports changes with no Rust source differences.The canonical producer enumerates the changed source and test packages against that exact base, including source deletions inside retained packages. An unresolvable deleted package fails discovery. Stage parsing rejects oversized output, truncation breadcrumbs and empty lists; arbitrary stage names cannot supply base-aware provenance.
Validation: 2,468 tests pass with one existing skip across 185 files; typecheck and lint pass. Dispatcher and substrate Worker dry-runs compile without upload. The 14 recipe regressions cover refinement, fallback, base-only coverage, empty-change coverage and discovery refusal.