Split pr-explain/lib.sh by concern #221
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools#221
Loading…
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?
Split
pr-explain/lib.sh, a 2566-line file of 58 functions with no section boundaries, into one file per concern, so a change to a report validator stops rendering as a change to asset emission and a reader can find a function by what it is for.Primary goals:
pr-explain/lib/, sourced in a fixed order bylib.shor byexplain.pr_explain_*function keeps its name, soexplainand the tests are unchanged apart from where they source from.tests/pr-explain/runs green before and after, with no test edited.explainis looked at, not split — it is 1306 lines with a 450-linepr_explainfunction; whether its passes want their own files is decided after the library split makes the seam visible.Current state and specifics
The function list groups itself. Asset resolution and emission are
pr-explain/lib.sh:7-46(pr_explain_asset_dir,pr_explain_resolve_forge, thepr_explain_emit_*family). Fragment validation is:58-231(pr_explain_validate_outline,pr_explain_check_front_fragment,pr_explain_check_section_fragment,pr_explain_check_quiz_fragmentand their helpers). The report validators are:320-1775: about thirtypr_explain_*_are_well_formed,pr_explain_*_are_canonicalandpr_explain_check_*functions, each a self-contained predicate over the assembled report. The report driver is:1775-1857(pr_explain_extract_asset,pr_explain_strip_quoted_code,pr_explain_report_tags,pr_explain_validate_report). Shared primitives such aspr_explain_html_escape,pr_explain_validation_errorandpr_explain_count_regex(:239-260) are used across groups and belong in a small common file sourced first.explainsourceslib.shonce (pr-explain/explain, onelib.shreference), so the cheapest shape keepslib.shas a thin file that sources the parts in order, and nothing outsidepr-explain/changes. The tests undertests/pr-explain/(command.shalone is 1393 lines) exercise the public functions and are the gate; shellcheck over every new file is the second.Scope
In scope: the split, the sourcing order, and shellcheck over the result.
Explicitly not in scope: changing what any validator accepts or emits, and splitting
explainitself, which is a follow-up decided on the seam this exposes.