Add Markdown format gate and prebuilt mdtablefix install - #257
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueWarning Your free Security trial is over. An organization admin can upgrade to Advanced for continuous pull request security review or dismiss this notice. Comment |
Reviewer's GuideThis PR introduces a fail-safe, non-mutating Markdown formatting gate over Git-tracked files, provisions mdtablefix 0.5.1 in CI exclusively from a pinned prebuilt archive with version-aware caching, aligns shared-action revisions, and documents and tests the resulting workflow. Sequence diagram for CI mdtablefix installationsequenceDiagram
participant CI
participant Cache
participant Installer as SharedInstallAction
participant Release as PrebuiltReleaseArchive
participant Path as LocalBin
CI->>Cache: Restore mdtablefix-${runner.os}-${runner.arch}-${MDTABLEFIX_VERSION}
CI->>Installer: install-mdtablefix(version=MDTABLEFIX_VERSION)
Installer->>Release: Resolve matching 0.5.1 platform archive
Release-->>Installer: Release metadata and archive
alt Supported archive metadata
Installer->>Path: Install prebuilt mdtablefix
Installer-->>CI: Add ~/.local/bin to PATH
else Missing or invalid archive
Installer-->>CI: Fail without compiling
end
Flow diagram for the tracked Markdown format gateflowchart TD
A[make check-fmt] --> B[git ls-files -z -- *.md]
B --> C{Git index enumerated?}
C -- No --> F[Fail closed]
C -- Yes --> D[Skip deleted worktree paths]
D --> E[scripts/check-markdown-format.sh]
E --> G[Copy files to temporary staging]
G --> H[mdtablefix --in-place canonical formatting]
H --> I[Compare LF and CRLF candidates with sources]
I --> J{All files match?}
J -- Yes --> K[Pass without changing worktree]
J -- No --> L[Report unformatted paths and fail]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Import the Markdown check-fmt gate from leynos/netsuke (45174acf560d7810f87eb584c535986abbce5216), hardened with the large-file and discovery coverage from leynos/cuprum. mdtablefix has no check-only mode, so scripts/check-markdown-format.sh stages every supplied file into a temporary directory, formats the whole batch with the canonical flags, and compares each result against its source. The worktree is never handed to the formatter and never modified. Exact LF and CRLF renderings both pass; mixed line endings fail. The CRLF candidate is materialised into a file before cmp because piping the conversion into a short-lived consumer turns large documents into spurious Broken pipe failures under pipefail. markdownlint --fix is deliberately not replayed: make markdownlint already rejects violations, and comparing against mdtablefix alone surfaces documents the two tools would fight over. make check-fmt discovers files through Git's tracked-file index (git ls-files -z -- '*.md'), keeps paths NUL-delimited end to end, skips tracked paths deleted from the worktree, and fails closed when Git cannot enumerate the index. A test-markdown-format target runs the process-boundary tests, which use a controlled formatter fixture and a small shared repository helper in scripts/tests/. Format the complete tracked Markdown baseline with mdtablefix and refresh typos.toml so the new gate passes immediately. Adopt the tmp-file-path snapshot placeholder from the ambrleaks repair so the snapshots stay machine-independent. Validated with make check-fmt, make test-markdown-format, make test, make typecheck, make lint, make markdownlint, and make nixie.
Adopt leynos/shared-actions/.github/actions/install-mdtablefix (c5a54701c8603a0fa756a6b34c49bc2af75a6c11) so CI installs the formatter from its prebuilt release archive instead of any local source build. The action accepts only releases with correct multi-platform metadata and fails closed when the runner has no supported archive; it never compiles mdtablefix. CI pins the version once through MDTABLEFIX_VERSION (0.5.1) and caches the action's ~/.local/bin install path, keyed on the runner OS, architecture, and the formatter version so a bump invalidates the cached executable. Lading has no Rust build, so no project or formatter Rust toolchain variable is introduced. Advance every leynos/shared-actions reference to the same revision: the install action here plus the upload-codescene-coverage action and the dependabot-automerge and mutation-mutmut reusable workflows. A new workflow-contract test module pins the installer step's exact action reference, version input, cache key dimensions, and the absence of any local run fallback, and keeps the primary Rust toolchain unchanged. Validated with make check-fmt, make test, make typecheck, make lint, and the focused workflow-contract tests.
The Windows publish dry-run debugging plan landed on main before the check-fmt Markdown gate existed, so its header metadata predates the canonical reflow. Reformat it with the canonical mdtablefix flags so the gate passes without weakening its rules. Validated with make check-fmt, make test, make typecheck, make lint, make markdownlint, and make nixie.
22c6080 to
d54718a
Compare
There was a problem hiding this comment.
Gates Failed
New code is healthy
(1 new file with code health below 10.00)
Enforce critical code health rules
(1 file with Bumpy Road Ahead, Deep, Nested Complexity)
Enforce advisory code health rules
(1 file with Complex Method)
Our agent can fix these. Install it.
Gates Passed
3 Quality Gates Passed
Reason for failure
| New code is healthy | Violations | Code Health Impact | |
|---|---|---|---|
| test_mdtablefix_installer.py | 3 rules | 8.93 | Suppress |
| Enforce critical code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| test_mdtablefix_installer.py | 2 critical rules | 8.93 | Suppress |
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| test_mdtablefix_installer.py | 1 advisory rule | 8.93 | Suppress |
Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
Summary
This branch checks the formatting of every tracked Markdown file in
make check-fmtand installsmdtablefixin CI from its prebuilt release archive rather than a local source build. The formatter had become a silent dependency:make fmtreflowed Markdown throughmdtablefix, but no gate verified that committed documents stayed canonical, so drift could reachmainunnoticed.mdtablefixhas no check-only mode, so scripts/check-markdown-format.sh stages copies of each supplied file into a temporary directory, formats the whole batch with the canonical flags, and compares each result against its source. The worktree is never handed to the formatter and never modified. Exact LF and CRLF renderings both pass; mixed line endings fail.make check-fmtdiscovers files through Git's tracked-file index with NUL-delimited paths, skips tracked paths deleted from the worktree, and fails closed when Git cannot enumerate the index.CI now pins
MDTABLEFIX_VERSIONto 0.5.1 once and installs the formatter throughleynos/shared-actions/.github/actions/install-mdtablefix, which accepts only releases with correct multi-platform metadata and never compiles anything. Everyleynos/shared-actionsreference on the branch is pinned to the same revision.No roadmap task or open issue tracks this work, and the branch does not carry an execplan.
Review walkthrough
cmpto avoid broken-pipe failures underpipefail.MD_FILES_FINDdiscovery and Makefile for thecheck-fmtandtest-markdown-formattargets.cargo binstallrecipe and the documentation contract.Validation
make check-fmt: exit 0, 160 files already formatted.make test-markdown-format: 10 passed.make test: 791 passed, 76 snapshots passed.make typecheck: all checks passed.make lint: exit 0 (pylint-pypy and df12 lints at 10.00/10, ambrleaks clean).make markdownlint: 0 errors across 22 files.make nixie: all diagrams validated.make check-fmtwith the offending path reported, and the worktree was left untouched.Notes
Cargo.tomlis a committed fixture), so "no project Rust toolchain variable" is asserted structurally by the contract tests rather than exercised by a build.mdtablefixused to format the baseline is 0.5.0; CI installs the pinned 0.5.1 prebuilt. The prose baseline is canonical under both, and the CI contract tests assert the pinned version.<tmp-file-path>placeholder from the repository's own ambrleaks repair, keeping the snapshots machine-independent somake lintandmake testpass on this branch.Summary by Sourcery
Enforce canonical formatting for tracked Markdown and replace CI source builds with a pinned prebuilt mdtablefix installation.
New Features:
make check-fmtwithout modifying the worktree.Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: