chore: unwrap Markdown prose - #85
Conversation
PR Summary by QodoAutomate Markdown prose unwrapping in files and PR bodies
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1.
|
0e6e66f to
4771153
Compare
9d3d24e to
3ae46e1
Compare
Adopts michen00/markdown-prose-hooks, which needed no porting: the hooks ship as a pre-commit repository and the PR-body halves as reusable workflows, so this consumes them rather than vendoring a copy that would then drift. Localization came to the two checks its README asks for, and both already held. markdownlint's `line-length` is `false` here and prettier's `proseWrap` is unset, so nothing wraps the prose back -- a rule that wraps and a hook that unwraps would each undo the other on every run. The `-py` mirror, not `-rs`: a `language: rust` hook builds from source, so pre-commit would install a Rust toolchain before checking the first commit, and nothing here needs cargo otherwise. The two PR-body workflows take different trigger types on purpose. Sharing an event fires both, and the report then describes a body the rewrite is about to replace. Both are held in bot-automerge's actions-major list, re-derived as that file asks. prose-body-write.yml runs from the default branch under `pull_request_target`, and prose-body.yml fires only on `synchronize` and `edited`, so neither is exercised by the pull request proposing its own bump. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
3ae46e1 to
ae9477c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #85 +/- ##
=======================================
Coverage 47.93% 47.93%
=======================================
Files 31 31
Lines 1863 1863
=======================================
Hits 893 893
Misses 970 970
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A fork's token is read-only whatever the caller's `permissions:` block asks for, so under `pull_request` the report's comment was refused for every outside contributor -- the people least likely to know this repository's prose convention, and the ones the report is for. Not a failure, and the report was not lost: the reusable workflow falls back to the job summary and does not fail the check. But a summary has to be opened to be read, and a comment does not. Safe here because that workflow checks out nothing -- it carries no `actions/checkout` step at all, reading the body from the event payload and posting a comment. The usual `pull_request_target` hazard is a writable token handed to unreviewed code, and there is no code here for it to attach to. Upstream accepts either trigger and names this one for fork coverage. The cost matches the write half: the workflow is read from the default branch, so a pull request cannot test a change to it. Reported by Qodo on #85. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Stacked on #84 — its base is
ci/release-pr-worthiness-gate, because both branches touchCONTRIBUTING.mdand basing this onmainwould conflict. Merge #84 first.There is nothing to port
markdown-prose-hooks publishes the hooks as a pre-commit repository and both PR-body halves as reusable workflows, so this consumes them. Vendoring a copy would have created a fork to keep in sync with no upside.
Localization came to the two checks its README asks for, and both already held here:
line-lengthfalsein.markdownlint.ymlproseWrap.prettierrc, sopreserveThat mattered more than it sounds: a rule that wraps prose and a hook that unwraps it undo each other on every run.
What changed
The hook.
unwrap-markdown-prose-py, placed before prettier — this rewrites prose and prettier is what normalizes the result. The-pymirror rather than-rsbecause alanguage: rusthook builds from source, so pre-commit would install a whole Rust toolchain before checking the first commit, and nothing here needs cargo otherwise.The repo's prose. Smaller than expected —
README.mdand everything under.github/were already unwrapped. Only two files carried manual breaks:CONTRIBUTING.mdCLAUDE.mdThe three blocks #84 itself writes are unwrapped in #84, so it no longer introduces prose this PR has to clean up afterwards. Those were spliced by hand and then checked byte-for-byte against the hook's own output, so the two branches agree on what unwrapped means rather than merely looking similar.
The PR-body pair.
prose-body.ymlreports,prose-body-write.ymlrewrites. They take different trigger types deliberately: sharing an event fires both at once and the report then describes a body the rewrite is about to replace. The report is narrowed tosynchronizeandedited, dropping theopenedandreopenedthe upstream example carries, which belong to the write half.prose-body-write.ymltakes effect only once it is onmain—pull_request_targetreads the workflow from the default branch, which is exactly why a pull request cannot try it out.What I did not take
The fork-safe file pair (
unwrap-propose.yml+unwrap-comment.yml). pre-commit.ci already runs the hook on every pull request here, forks included, and autofixes. Taking the pair as well would mean two bots reporting the same defect on the same pull request and two comments to read before either is actionable — that is the cost, not that the gain is small. If pre-commit.ci is ever dropped, this is the replacement.One consequence worth knowing
Both new workflows are added to
bot-automerge.yml's actions-major hold list, re-derived as that file explicitly asks when triggers change. Neither is exercised by the pull request proposing its own bump:prose-body-write.ymlruns from the default branch underpull_request_target, andprose-body.ymlfires only onsynchronizeandedited, neither of which a freshly opened bot pull request produces. So a green check would say nothing about the new version, and a major bump of either now waits for a human.Test plan
unwrap-markdown-prose-py --all-filesrun through pre-commit; re-running is a no-op, so the result is a fixed point.CONTRIBUTING.mdare identical before and after (21 headings, 22 list items, 4 fences, 7 ordered items), and no tables exist in either file to disturb.actionlintclean on both new workflows and on the editedbot-automerge.yml.make checkgreen.🤖 Generated with Claude Code