Skip to content

fix(workspace): disable the unsafe pymarkdown fixers (md029/md031/md046) - #1579

Merged
c-vigo merged 3 commits into
devfrom
bugfix/1574-pymarkdown-fix-mode-hazards
Aug 31, 2026
Merged

c-vigo merged 3 commits into
devfrom
bugfix/1574-pymarkdown-fix-mode-hazards

Conversation

@c-vigo

@c-vigo c-vigo commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

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
pymarkdown 0.9.23 before writing anything:

Reproducer current config md029+md046 off md029+md031+md046 off
Bug 1 — list resuming after a heading rc=1, BadPluginFixError fixed (rc=3, benign) rc=0, unchanged
Bug 2 — two consecutive in-list fences rc=3, corrupted rc=3, corrupted byte-for-byte the same rc=0, unchanged
Bug 3 — pyml pragma ignored by fix rc=3, renumbered not applicable (md029 off) rc=0, unchanged

Disabling md029+md046 alone clears the crash but leaves bug 2 — the
exits-0, semantics-changing rewrite, the one that actually survives an
inattentive re-commit — fully live. md031 is the corrupter, so it joins the
list.

md004 stays enabled and is documented as a known hazard instead: the
trigger (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 synced assets/workspace/ copy) — md029, md031,
    md046 disabled
  • .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; md004 recorded as a related hazard that stays on
  • nix/hooks.nix — the fix-mode trap recorded next to the comment whose
    "tolerates unfixable violations" contract bug 1 violates
  • docs/MIGRATION.md — adoption note: .pymarkdown is 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 run
    through the hook's exact -c .pymarkdown fix command, plus a config-content
    test that pins the intent in lanes without pymarkdown on PATH
  • CHANGELOG.md — Fixed

The reproducers are inline strings, not fixture .md files, on purpose: the
repo's own pymarkdown hook lints every tracked markdown file, so a committed
reproducer 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.py runs them against
whatever 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

  • All four new tests failed first for the right reasons (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 passed
  • just precommit — full suite green (the pymarkdown hook now runs over this
    PR's own markdown with the three rules off)

Refs: #1574

@c-vigo
c-vigo enabled auto-merge August 31, 2026 05:29
@c-vigo
c-vigo merged commit df69464 into dev Aug 31, 2026
14 checks passed
@c-vigo
c-vigo deleted the bugfix/1574-pymarkdown-fix-mode-hazards branch August 31, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant