Skip to content

fix(mcp): rule-docs embed + windows-11-arm runner - #259

Merged
aram-devdocs merged 2 commits into
mainfrom
fix/embed-rule-docs-in-mcp-crate
May 7, 2026
Merged

fix(mcp): rule-docs embed + windows-11-arm runner#259
aram-devdocs merged 2 commits into
mainfrom
fix/embed-rule-docs-in-mcp-crate

Conversation

@aram-devdocs

@aram-devdocs aram-devdocs commented May 7, 2026

Copy link
Copy Markdown
Owner

Summary

Two more fixes blocking the v0.0.5 release pipeline (after #248, #251, #253, #255, #257).

1. `include_str!` outside crate breaks cargo publish

`plumb-mcp/src/explain.rs` did `include_str!("../../../docs/src/rules/.md")`. `cargo publish` doesn't traverse outside the crate dir, so the v0.0.5 publish died with:

```
error: couldn't read `src/../../../docs/src/rules/a11y-touch-target.md`:
No such file or directory (os error 2)
```

(release-please.yml run 25488993683.)

Fix: move all 16 rule-doc files to `crates/plumb-mcp/rule-docs/` (canonical), and replace the old location with relative symlinks so mdBook still resolves them under `docs/src/rules/.md`. `include_str!` paths now resolve to a sibling directory inside the crate.

2. aarch64-pc-windows-msvc cross-compile fails

cargo-dist scheduled the ARM64 Windows build on a x86_64 `windows-latest` runner, which lacks the ARM64 cross-compile toolchain:

```
help: no idea how to cross-compile from x86_64-pc-windows-msvc
to windows with architecture aarch64
```

(release.yml run 25489026809.)

Fix: switch to native `windows-11-arm` runner.

Verified

  • `cargo nextest run -p plumb-mcp` ✅ 30/30
  • `cargo xtask sync-rules-index` ✅ "16 built-in rule(s); all have docs pages"
  • `mdbook build docs/` ✅

🤖 Generated with Claude Code

…them

`plumb-mcp/src/explain.rs` does `include_str!("../../../docs/src/rules/<rule>.md")`.
`cargo publish` doesn't traverse outside the crate dir when packaging,
so the v0.0.5 publish died with:

  error: couldn't read `src/../../../docs/src/rules/a11y-touch-target.md`:
         No such file or directory (os error 2)

(release-please.yml run 25488993683.)

Move the canonical files into `crates/plumb-mcp/rule-docs/` and replace
their old location with relative symlinks so mdBook still finds them
under `docs/src/rules/`. `include_str!` paths now resolve to a sibling
directory inside the crate, which `cargo publish` packages correctly.
xtask sync-rules-index + mdBook build both verified locally.
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

I have enough context for a complete review. Here is the full assessment.


PR 259: fix(release): rule-docs embed + windows-11-arm runner

Scope

Bucket Files
plumb-mcp src/explain.rs, rule-docs/*.md (×16)
docs docs/src/rules/*.md (×16, converted to symlinks)
ci .github/workflows/release.yml (+1/-1)

1. Determinism — PASS

RULE_DOCS is a const slice. Sorted alphabetically by rule_id; verified: a11y < baseline < color < edge < opacity < radius < shadow < sibling < spacing < type < z. No wall-clock. No HashMap in any output path. No env reads. All good.

2. Workspace layering — PASS

Change is entirely within plumb-mcp and docs. No new crate dependencies. #![forbid(unsafe_code)] is untouched. No println!/eprintln! introduced.

3. Error handling — PASS

lookup() returns Option<&'static RuleDoc> — callers map None to a JSON-RPC error as required. No unwrap/expect in new code.

4. Test coverage — PASS

include_str! paths are verified at compile time — a wrong path is a compile error, not a runtime regression. The existing every_builtin_rule_has_doc_entry test in mcp_protocol.rs guards table-vs-engine drift. All 16 rule-docs are present in crates/plumb-mcp/rule-docs/ and all 16 include_str! entries in explain.rs map to real files.

5. Documentation accuracy — ISSUES

crates/plumb-mcp/src/explain.rs:5 and :26 — both the module-level doc and the RuleDoc.markdown field doc still name the old path:

markdown body of `docs/src/rules/<slug>.md`

The canonical source is now crates/plumb-mcp/rule-docs/<slug>.md. docs/src/rules/*.md are symlinks, not source files. The comments are stale.

crates/plumb-mcp/CLAUDE.md:59 — the anti-patterns section reads:

Embedding rule docs verbatim in explain_rule. Read from docs/src/rules/<slug>.md so the book and the MCP response stay in sync.

This is now exactly backwards. The PR intentionally moves to include_str!-from-within-the-crate because reading from docs/src/rules/<slug>.md at publish time is what broke cargo publish. Any future agent reading this CLAUDE.md will conclude the current explain.rs implementation is an anti-pattern and attempt to revert it. This is the highest-impact stale doc in the diff — CLAUDE.md is consumed by every AI session on this repo.

Required fixes:

  • crates/plumb-mcp/src/explain.rs:5,26 — update path reference from docs/src/rules/<slug>.mdrule-docs/<slug>.md.
  • crates/plumb-mcp/CLAUDE.md:59 — replace the anti-pattern entry. The new canonical pattern is: canonical source lives in crates/plumb-mcp/rule-docs/<slug>.md, embedded at compile time via include_str!; docs/src/rules/ symlinks keep mdBook in sync. The anti-pattern is referencing a path outside the crate root in include_str!.

6. CI change — PASS

windows-11-arm is the correct native runner for aarch64-pc-windows-msvc. The x86-64 windows-latest runner has no ARM64 cross-compile toolchain; this fix is precise and minimal.


Punch list

File Line Severity Issue
crates/plumb-mcp/CLAUDE.md 59 Warning Anti-pattern entry is inverted after this PR; future agents will misread the current implementation as wrong
crates/plumb-mcp/src/explain.rs 5 Nit Module doc references stale path docs/src/rules/<slug>.md
crates/plumb-mcp/src/explain.rs 26 Nit RuleDoc.markdown field doc references stale path docs/src/rules/<slug>.md

The CLAUDE.md item is the only one that could cause active harm (misleads AI agents running in future sessions). The explain.rs nits are cosmetic.

Verdict: REQUEST_CHANGES

The aarch64-pc-windows-msvc job was scheduled on the x86_64
windows-latest runner, which has no cross-compile toolchain for ARM64
Windows:

  help: no idea how to cross-compile from x86_64-pc-windows-msvc
        to windows with architecture aarch64
  Process completed with exit code 127

(release.yml run 25489026809 build-aarch64-pc-windows-msvc 74792046566.)

Switch to the native `windows-11-arm` runner so cargo build links
against the matching toolchain.
@aram-devdocs aram-devdocs changed the title fix(mcp): embed rule-docs in plumb-mcp crate for cargo publish fix(release): rule-docs embed + windows-11-arm runner May 7, 2026
@aram-devdocs aram-devdocs changed the title fix(release): rule-docs embed + windows-11-arm runner fix(mcp): rule-docs embed + windows-11-arm runner May 7, 2026
@aram-devdocs
aram-devdocs merged commit 35db074 into main May 7, 2026
28 of 36 checks passed
@aram-devdocs
aram-devdocs deleted the fix/embed-rule-docs-in-mcp-crate branch May 7, 2026 10:23
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