Repository navigation
fix(workspace): disable the unsafe pymarkdown fixers (md029/md031/md046) - #1579
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements action 1 of #1574 — the scaffold-level mitigation — plus one rule
the issue's list did not cover, and turns action 3 ("do not treat a pin bump
as the fix") into a test rather than a note.
The rule set is md029 + md031 + md046, not md029 + md046
All three reproducers from the issue were re-run here against the pinned
pymarkdown0.9.23 before writing anything:md029+md046offmd029+md031+md046offrc=1,BadPluginFixErrorrc=3, corruptedrc=3, corrupted byte-for-byte the samepymlpragma ignored byfixrc=3, renumberedDisabling
md029+md046alone clears the crash but leaves bug 2 — theexits-0, semantics-changing rewrite, the one that actually survives an
inattentive re-commit — fully live.
md031is the corrupter, so it joins thelist.
md004stays enabled and is documented as a known hazard instead: thetrigger (a wrapped prose line starting with a plus and a space) is narrow, and
marker consistency is real lint value. Confirmed the class while testing — such
a line set "consistent" style and the fixer rewrote a genuine
-list to+.Changes
.pymarkdown(+ the syncedassets/workspace/copy) —md029,md031,md046disabled.pymarkdown.config.md— a per-rule table of exactly what each fixer does,the pragma gap, the upstream issue links, and a "re-enable these if you run
scan" note;md004recorded as a related hazard that stays onnix/hooks.nix— the fix-mode trap recorded next to the comment whose"tolerates unfixable violations" contract bug 1 violates
docs/MIGRATION.md— adoption note:.pymarkdownis a preserved file(seeded once, never overwritten), so a repo scaffolded before this keeps its
own copy and must add the three entries by hand
tests/test_pymarkdown_fix_safety.py— new; the three reproducers runthrough the hook's exact
-c .pymarkdown fixcommand, plus a config-contenttest that pins the intent in lanes without
pymarkdownon PATHCHANGELOG.md— FixedThe reproducers are inline strings, not fixture
.mdfiles, on purpose: therepo's own
pymarkdownhook lints every tracked markdown file, so a committedreproducer would feed the crash straight back into the hook being gated.
Why a test rather than a note
Action 3 says a pin bump is not the fix and the reproducers must be re-run
before trusting one.
tests/test_pymarkdown_fix_safety.pyruns them againstwhatever version the flake pins, so a future bump that still carries
jackdewinter/pymarkdown#1672 / #1673 / #1674 — or a re-enabled rule — fails CI
instead of relying on someone remembering.
Verification
BadPluginFixError,the byte-level corruption, the renumbered list, the un-disabled rules), then
passed after the config change — RED → GREEN
uv run pytest tests/test_pymarkdown_fix_safety.py tests/test_flake_hooks.py tests/test_transforms.py tests/test_scaffold_drift.py tests/test_scaffold_lint.py— 162 passedjust precommit— full suite green (thepymarkdownhook now runs over thisPR's own markdown with the three rules off)
Refs: #1574