Split pr-explain/lib.sh by concern #223
No reviewers
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools!223
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/pr-explain-lib-split"
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?
pr-explain/lib.shis split into five files underpr-explain/lib/, one per concern, and nothing about the tool changes: every one of its 58 functions keeps its name and its exact body,lib.shstays as the thin file that sources the parts in order, andexplainand the tests are untouched. What proves it is a per-function body comparison before and after, shellcheck, and the three pr-explain suites green. If it is wrong, revert the one commit.What changed
pr-explain/lib/common.sh: the primitives every other part uses (HTML escaping, the validation error and warning arrays and their recorders, the regex counters, UTF-8 safety, runner display). Sourced first.pr-explain/lib/assets.sh: asset directory and forge resolution, and theemit_*family.pr-explain/lib/fragments.sh: outline validation and the front, section and quiz fragment checks.pr-explain/lib/report-validators.sh: the 26 well-formedness and canonical-form predicates over the assembled report, plus reading cost, layers, objectives, quiz and slop checks.pr-explain/lib/report.sh: the report driver (asset extraction, quoted-code stripping, tag reporting,validate_report).pr-explain/lib.shkeepsPR_EXPLAIN_LIB_DIRand sources the five in that order. Each new file opens with a paragraph on what it holds and depends on.Found on the way and filed separately, not fixed here: running the pr-explain suites leaves two self-referential symlinks in the source tree (allod/tools#222).
Risk
R2. Shell library split with no function edited; the failure modes are sourcing order (a top-level statement reading something defined in a later file) and a path computed from
BASH_SOURCEthat now names the part file. Both are exercised by the suites, which drive the library throughallod pr explain. Rollback is a straight revert.Validation
bash -nandshellcheck -xonlib.shand all five parts: clean.bash tests/pr-explain/components.sh,validation.sh,command.shfrom the worktree root, re-run by the integrator: 86, 104 and 704 tests passed. Theallodbinary resolves the library fromALLOD_TOOLS_DIRat run time, so the suites exercised this worktree's files without a Go rebuild.allod-parityflake check that wraps the same three suites, because it rebuilds the Go binary; the suites were run directly instead.gpt-5.6-terraon codex, high effort): three findings, all header paragraphs that omitted a dependency (dieandmake_temp_fileare caller-provided byexplain;report-validators.shcalls intoreport.shat run time;report.shcalls intoassets.sh), fixed in the second commit; the worker then found and fixed one more header of the same kind infragments.shin the third. No function moved or changed in either; re-verified by the same body extraction.Closes allod/tools#221