mirror of
https://github.com/Comfy-Org/github-workflows.git
synced 2026-11-05 00:17:37 +00:00
[GH-ISSUE #245] [groom] grade-targets.sh is a script and a library at once, and the seam leaks into collect-pr-inputs.sh #4
Labels
No labels
cursor-review-catalog-drift
groom
groom
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/github-workflows#4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Originally created by @cloud-code-bot[bot] on GitHub (Aug 28, 2026).
Original GitHub issue: https://github.com/Comfy-Org/github-workflows/issues/245
Groom auto-builder — Comfy-Org/github-workflows: this CONFIRMED finding could not be auto-built (patch modifies a CI-privileged path (per .github/groom/patch_policy.py — workflow/action defs, lockfiles, or build/test config that executes in pre-review CI) — a human must author these changes), so it is filed for a human. · run
Verified facts
scripts/pr-derisk/collect-pr-inputs.sh:77sources the 619-linescripts/pr-risk/grade-targets.shfor exactly three helpers -resolve_base_ref,fetch_override,retry_read- as its own comment at:72-76states. Making that safe cost two workarounds, both properties of the file boundary rather than of the logic:scripts/pr-risk/grade-targets.sh:114-132- a GT_DIRECT flag plus lazyinit_scratch, added (per its own comment) because at file scope the EXIT trap replaced the SOURCING shell's trap, so a suite that sourced these helpers silently lost its sandbox cleanup and leaked both the sandbox and the temp files.scripts/pr-derisk/collect-pr-inputs.sh:50-63and:78-86-log/warn/diedefined TWICE, before and after the source, becausegrade-targets.sh:111-112defines its ownlog/dieat file scope and captures them. The first copy carries ten lines of comment plus a shellcheck disable for SC2317 and SC2329 to keep two linter versions quiet.Both files are already WATCHED_EXEC entries of their fleets (
bump-pr-risk-callers.yml:181,bump-pr-derisk-callers.yml:219), andbump-pr-derisk-callers.yml:195-203already documents the sourcing relationship, so the coupling is known and load-bearing rather than accidental.Fix
Move the sourceable helpers -
enc,enc_path,init_scratch/gherr,retryable_err,retry_read,resolve_base_ref,fetch_override(grade-targets.sh:125-289) - into a newscripts/pr-risk/lib.shwith NO top-level side effects and PREFIXED diagnostic names (e.g. gt_log / gt_die) so they cannot capture a caller'slog/die. The precedent already exists here:scripts/area-label/lib.sh. Then:grade-targets.shsources it and keepsmain()and the per-target logic. With nothing else sourcing it, GT_DIRECT and its lazy-trap dance can go and the trap can be installed unconditionally.collect-pr-inputs.shsourceslib.shinstead; the duplicated log/warn/die block and both shellcheck suppressions disappear.Behaviour must be identical.
scripts/pr-risk/tests/test_grade_targets.shandscripts/pr-derisk/tests/test_plan_derisk.shmust stay green, and theshellcheck -xlist in.github/workflows/test-pr-risk.yml:51must gain the new file.Risk
Medium and concrete:
scripts/pr-risk/lib.shbecomes a run-time dependency of BOTH fleets, so WATCHED_EXEC inbump-pr-risk-callers.ymlANDbump-pr-derisk-callers.ymlmust gain it in the same commit - a missing entry could re-point pinned callers at a SHA where the file is absent, which is exactly what those lists exist to prevent. Scope the move to the helpers listed above; do not opportunistically moveparse_targets,settle_grade,process_targetormain.Steelman
The current arrangement works, is documented in painful detail and is pinned by tests; a lib.sh adds a third file to a two-file relationship and one more WATCHED_EXEC entry a caller breaks without. If the sourcing were a one-off it would not be worth touching. The counter is that the file is now maintained under two contradictory contracts at once, and every future helper added to it inherits both hazards - the trap one already bit.
@mattmillerai commented on GitHub (Sep 18, 2026):
Triage: every claim still holds. Leaving this open, tracked internally.
Verified against
origin/main@cf7b8d9c2614ad9f8ee41acf245381ad76fcdc8b. Most of the line numbers are still exact — these files have not moved.collect-pr-inputs.sh:77still sourcesgrade-targets.sh, with the comment at:72-76naming the three helpers. (Two are called directly —resolve_base_refat:93,fetch_overrideat:95/:97;retry_readis a transitive dependency of both. "Exactly three helpers" is the transitive set, not the call set.)grade-targets.shis still 619 lines.grade-targets.sh:114-132— the comment block,GT_DIRECT, the lazyinit_scratchand the conditional trap install at:130.collect-pr-inputs.sh:50-63and:78-86, with bothSC2317andSC2329suppressions still present, on two separate lines.scripts/pr-risk/lib.shdoes not exist; the onlylib.shin these trees is thescripts/area-label/lib.shprecedent you cite, whose header states exactly the pattern proposed here.shellcheck -xlist is still at.github/workflows/test-pr-risk.yml:51and has nolib.sh.1567edf, human risk overrides, which touched neither), and no open PR overlaps — all nine open PRs were checked.Two line numbers have shifted: the WATCHED_EXEC entries are now
bump-pr-risk-callers.yml:186(body says:181) andbump-pr-derisk-callers.yml:221/:224(body says:219); the documenting comment cited at:195-203is now at:197-213.One constraint the body does not mention, and it is the biggest one on this refactor.
scripts/pr-risk/tests/test_grade_targets.sh:405-413is "phase 21: sourcing the script has NO side effects" — it spawns a subshell with its own EXIT trap, sources the file, and asserts both that the trap survived and that zero scratch files were created. It targetsgrade-targets.shitself, not a futurelib.sh. So after the extractiongrade-targets.shmust still pass it:lib.shhas to be genuinely side-effect-free, and ifGT_DIRECTgoes, the direct-invocation cleanup has to move intomain()rather than back to file scope. Worth reasoning about explicitly before writing the diff.A scoping detail:
parse_targets(:198-215) sits inside the:125-289range but is not in your extraction list, and it callsdie/log— so the cut is not contiguous and needs an explicit skip.And a gap worth confirming:
collect-pr-inputs.shis not in thetest-pr-risk.ymlshellcheck list at all (it lives underscripts/pr-derisk). Check the pr-derisk side has its own lint job before assuming those two suppressions are load-bearing for a job that actually runs.Your risk note is right and I confirmed the mechanic behind it:
.github/bump-callers/tests/test_preflight.shhas decommission-warning tests keyed ongrade-targets.sh(:1097,:1106,:1146,:1157), so "absent file →::warning::→ fleet no-ops" is real and tested. Both fleets'WATCHED_EXECmust gainlib.shin the same commit.Reopen or comment if anything here reads wrong.
Created by Claude Code