April 12, 2026
1 pull request merged across 1 repo
bahdotsh/wrkflw
Finish the module split started in earlier commits: lift the watcher's
main loop + git-state cache into dedicated modules, extract the CLI's
Run/Watch arms into sibling command modules, and collapse a copy-pasted
pull_request + no base-branch rejection into a single shared helper.
While at it, fix a silent-skip hole where persistent workflow-rescan
failures were logged at debug level — a non-verbose user would never
see their new workflow being ignored session-long. Bumped to warning.
Watcher crate
- New
git_state.rs—CachedGitState+GitStateCacheowning the TTL-bounded(branch, tag)mutex. - New
reactor.rs— liftedrun_loop,evaluate_and_execute,refresh_trigger_cache_async,canonicalize_changed_pathsout ofWorkflowWatcheras private free functions. WorkflowWatcher::runis now a 3-line forward toreactor::run_loop.cached_git_statekept as a#[cfg(test)]method shim (two staleness tests pin through it).watcher.rs: 2071 → 1218 lines (~300 non-test).
wrkflw binary
- New
prefilter.rs—PrefilterDecision,PrefilterRequest,run_trigger_prefilter,build_event_context,apply_base_branch,effective_strict_filter, all 7prefilter_tests. - New
validate_event_requires_base_branchhelper shared between the run and watch commands — previously each had its own inline copy of the rejection/warning text. - New
run_workflow_cmd.rs/watch_cmd.rs— Run and Watch arm bodies moved into sibling modules withRunCtx/WatchCtxstructs. main.rs: 2039 → 937 lines.
Bug fix
- Escalated persistent workflow-rescan failures from
debug→warning(was silent-skip against a stale workflow-files snapshot, directly under a comment calling out the hazard).
Test plan
-
cargo test --workspace— 46/46 watcher tests pass, 7/7 prefilter tests pass, everything else green -
cargo clippy --workspace -- -D warnings— clean -
cargo fmt --all --check— clean - Public API unchanged (
WorkflowWatcher,WatcherConfig,WatchEvent,ShutdownSignal,DEFAULT_MAX_CONCURRENT_EXECUTIONSre-exports preserved) - Manual smoke:
cargo run -- run .github/workflows/build.yml --event push --diff - Manual smoke:
cargo run -- watch --event pull_request --base-branch main - Manual smoke: trigger a rescan failure (
chmod 000 .github/workflowsmid-session) and confirm the new warning surfaces