fix(ci): the docs auto-merge gate stops treating lessons as documentation - #1868
Conversation
…tion
`auto-merge-docs.yml` merges external contributors' docs-only PRs straight to main, where `docs.yml`
publishes them. Its docs-only test was `f.filename.endsWith('.md') || f.filename.endsWith('.txt') || …`
— true for **any** `.md` anywhere, `lessons/**` included, directly under a comment that says
"`lessons/` is deliberately NOT docs-only" because unreviewed lesson content is a poisoning vector.
That hole was armed, not theoretical:
* `.github/labeler.yml` gives `area:docs` to every `**/*.md`, so external lesson PRs satisfy the job's
label condition — #1746 and #1750 carry `area:docs` + `area:lessons` + `lessons-only` +
`needs-human-review`, and both are still open;
* the job also runs on `synchronize` and `ready_for_review`, so a lesson PR that is pushed again or
comes out of draft *after* the label lands reaches `gh pr merge --auto` with `docs-only: true`
(#1841 did exactly that at 15:17, label applied 08:51);
* the only thing that stopped all of them was `needs-dco` — a check about commit trailers, not review.
The rule is now one named function (`isDocsFile`), stricter than before: a path qualifies only if it
is under `docs/` or is one of the four named files, and `lessons/` is never documentation. That also
drops `*.md`/`*.txt` from anywhere else (`scripts/README.md`, a stray `fork-error.txt` at the root),
which the old rule accepted. The job condition additionally refuses PRs labelled `lessons-only` or
`needs-human-review` — belt and braces, since the label that lets a PR in is applied automatically.
`tests/test_auto_merge_docs.py` *runs* the real function (extracted from the workflow between two
markers) over a table of 14 paths, and checks the two label refusals structurally. Node executes it
because the rule runs inside Actions; where node is absent the behavioural half skips rather than
passing vacuously.
Signed-off-by: Ikalus1988 <136884451+Ikalus1988@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
misakanet-web | e2e26cf | Commit Preview URL Branch Preview URL |
Sep 19 2026, 12:17 PM |
PR Genius Analysis
Checklist
Anti-Patterns Detected
Suggestions
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
🧾 Audit Report — PR #1868 (e2e26cf)📊 Quality Score🔏 DCO Audit✅ All commits signed-off. 📏 PR Size
🔐 Secret Scan✅ No hardcoded secrets detected. 📦 Dependency Audit⏭️ Skipped; no Python/JS dependency files changed. 🧪 Test Suite✅ PASS — 54% coverage 📋 Lesson Schema✅ All lessons valid. ⚖️ Verdict✅ All gates passed. Ready for merge. Scope: |
🎉 Merged — Thank you!Your contribution has been merged into main. PR: #1868 — fix(ci): the docs auto-merge gate stops treating lessons as documentation What's next:
Welcome to the MisakaNet contributor community! 🧠 |
|
✅ Merged! Thanks again, @Ikalus1988. fix(ci): the docs auto-merge gate stops treating lessons as documentation (+137 lines, 2 files) Quick question — did any MisakaNet lesson help you this time? No need to reply if nothing comes to mind. ⚡ |
PR Code Suggestions ✨Explore these optional code suggestions:
|
User description
Found while answering "what does it cost to loosen
auto-merge-docsso it actually gets used?" — theanswer turned out to be "first fix this, or what you loosen is lesson content".
The hole
auto-merge-docs.ymlmerges external docs-only PRs to main, wheredocs.ymlpublishes them. Itsdocs-only test was:
any .mdincludeslessons/**— directly under a comment stating thatlessons/is deliberatelynot docs-only, because lesson content is read and acted on by agents.
It was armed
area:docsis applied automatically to every*.md.github/labeler.yml:area:docs←**/*.mdarea:docs+area:lessons+lessons-only+needs-human-reviewsynchronize/ready_for_review, i.e. after the label landsready_for_reviewat 15:17needs-dcoSo an external lesson PR that is pushed again, or leaves draft, after the label appears reaches
gh pr merge --autowithdocs-only: true.The fix
docs/**or one ofCONTRIBUTING.md/README.md/JOIN.md/CHANGELOG.md, and neverlessons/. Stray.md/.txtanywhere else(
scripts/README.md,fork-error.txtat the root) no longer qualifies either;lessons-onlyorneeds-human-review;tests/test_auto_merge_docs.pyruns the real function over 14 paths — includinglessons/contrib/x.md→ false — and asserts the label refusals structurally.This is deliberately the stricter direction. Note it separately means the gate still cannot fire on
the legitimately docs-only external PRs it was built for (#1842, #1801): they never re-trigger after
the label is applied, which is a trigger question, not a rule question — tracked in the issue comment
that prompted this.
PR Type
Bug fix, tests
Description
Fix CI docs auto-merge gate excluding lessons
Add
isDocsFilerule with explicitlessons/exclusionRefuse PRs labelled
lessons-onlyorneeds-human-reviewAdd regression test running the real workflow function
Diagram Walkthrough
File Walkthrough
auto-merge-docs.yml
Tighten docs auto-merge rule to exclude lessons.github/workflows/auto-merge-docs.yml
endsWith('.md')docs-only check with namedisDocsFile()function
!path.startsWith('lessons/')guard with explanatorynote
lessons-onlyandneeds-human-reviewlabels
docs/,CONTRIBUTING.md,README.md,JOIN.md,CHANGELOG.mdtest_auto_merge_docs.py
Add regression test for docs auto-merge gatetests/test_auto_merge_docs.py
are present
node -enodeis unavailable