Refactor flake-status to process repos in parallel #72
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "agent/parallel-flake-status"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #61
Refactor
flake-statusto process repos in parallel instead of serially.Changes
_parallel_forbounded concurrency loop usingwait -n, controlled byFLAKE_STATUS_JOBSenv var (default 4)_collect_namedand_collect_allfunctions that write results to indexed temp files_LS_REMOTE_CACHEassociative array with_resolve_all_upstreamswhich deduplicates URLs viasort -uand resolves each unique URL in parallelValidation
tests/flake-status.shtests passflake-status,flake-status <input>, and both--upstreammodes produce identical output to the serial versionFLAKE_STATUS_JOBSoverrides the default parallelism bound6e7a681222to55c863602bReview findings (subagent)
Numbered by severity. Fixes incoming for the legitimate ones.
Fix (real bugs)
Regex injection in grep (line 444) —
grep -m1 "^${name}"$'\t'injects$nameraw into a regex. If an input name contained.or*it could match wrong entries. Should useawkwith string equality instead.No validation of
FLAKE_STATUS_JOBS— Non-integer values cause an arithmetic error and confusing exit. Add a guard.Fragile glob when
urls/is empty (line 186) —cat "$_PTMP"/urls/*with no matching files relies on error suppression to work. Use explicit nullglob guard for clarity.Not fixing (reviewer errors)
Trap single-quote evaluation — Reviewer claims single quotes cause
$_PTMPto be evaluated at registration time. This is backwards: single quotes defer evaluation to trap execution time. The code is correct as written.wait -nportability — Reviewer says bash 5.1+;wait -nwas actually added in bash 4.3 (2014). NixOS ships bash 5.x. Not a concern for this codebase.wait(no args) exit status — Reviewer worries this triggersset -e. Per the bash manual,waitwithout arguments returns 0. Not an issue.