Skip to content

Check docs conflict markers - #599

Merged
azimafroozeh merged 2 commits into
ModernRelay:mainfrom
azimafroozeh:check-docs-conflict-markers
Sep 1, 2026
Merged

Check docs conflict markers#599
azimafroozeh merged 2 commits into
ModernRelay:mainfrom
azimafroozeh:check-docs-conflict-markers

Conversation

@azimafroozeh

@azimafroozeh azimafroozeh commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What & why

This PR makes CI fail on committed merge-conflict markers, in two layers.

  • Proven escape: rfc: add RFC 0040, the system column namespace #546 squash-merged literal conflict markers into docs/rfcs/README.md on main, where they shipped until docs(rfcs): remove committed merge-conflict markers from the registry #598 removed them. Markers in Rust die in compile; markers in Markdown, fixtures, and data files pass every existing PR check, because no PR gate reads those files.
  • Layer 1: scripts/check-docs.py gains a marker scan over every Markdown file it already checks, reporting exact file:line.
  • Layer 2: a step in the same job rejects any pull request whose own diff adds a conflict-marker line, in any file type, using git's built-in detector (git diff --check, which respects conflict-marker-size and also flags a lone ======= on added lines). It emits an inline ::error annotation per offending line plus a count, runs before the documentation checks, and never fails a pull request for markers already on the base branch.
  • Both ride the existing required Check AGENTS.md Links context, which runs on every PR including documentation-only ones: no new job, no branch-protection change.

Backing issue / RFC

Checklist

  • Change is focused (one scan in check-docs.py, one CI step, their mention in docs/dev/ci.md)
  • Tests added/updated for behavior changes (check-docs.py has no test harness; verified red-then-green locally, see Local verification)
  • Public docs updated if user-facing surface changed (developer-facing only; docs/dev/ci.md updated)
  • Reviewed against docs/dev/invariants.md — no Hard Invariant weakened, no deny-list item hit (docs tooling only, no engine surface)

Local verification

  • python3 scripts/check-docs.py: Documentation OK (121 Markdown files checked)
  • Red phase: same command with a probe file carrying rfc: add RFC 0040, the system column namespace #546-shaped markers (<<<<<<< HEAD>>>>>>> 463fd70e (review)) exits 1 with two exact file:line: committed merge-conflict marker errors; probe removed, green again
  • The CI step's script body, run verbatim over real history: on the rfc: add RFC 0040, the system column namespace #546 commit (the one that introduced the markers) it emits three ::error file=docs/rfcs/README.md,line=.. annotations plus a count and exits 1; on the docs(rfcs): remove committed merge-conflict markers from the registry #598 removal commit and on a clean multi-commit range it is silent with exit 0
  • Markdown-scan pattern battery: labeled/bare/tab-followed/8-wide markers and ||||||| matched as designed; ======= and marker-chars-then-text correctly not matched
  • Workflow file re-validated: YAML parses, scripts/check-workflow-action-pins.py green
  • bash scripts/check-agents-md.sh: AGENTS.md ↔ docs indexes OK (45 links, 43 docs)
  • cargo test: not run, no Rust touched

Notes for reviewers

  • The two layers complement each other: the script scans all Markdown and runs locally for anyone invoking check-docs.py; the diff gate covers every file type but judges only lines a pull request adds, via git's own detector — no hand-rolled second pattern to keep in sync.
  • There is no exemption, by design: an opt-out either dies at the other layer or silences whole files. A document that must quote a conflict block indents the markers one space (only column-0 markers match). The tree has zero marker lines today, so both layers start green.
  • A lone ======= line is deliberately not matched by the Markdown scan (it is a legal setext heading underline); the diff gate does flag one on added lines, where git's detector owns the ambiguity.
  • Scope choice: the diff gate deliberately does not scan the whole tree, so a marker landing on the base branch through a path that bypasses PRs would not turn other pull requests red; the Markdown scan still covers that case for docs.

Greptile Summary

This PR adds two complementary CI checks that reject committed merge-conflict markers and documents the new behavior.

  • Scans all checked Markdown files for column-zero conflict-marker lines.
  • Checks added lines across every file type using git diff --check.
  • Emits inline CI annotations and documents how legitimate conflict examples should be indented.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable correctness or security failures identified.

The Markdown scan and pull-request diff gate consistently enforce the intended conflict-marker policy while preserving existing required CI reporting behavior.

Important Files Changed

Filename Overview
.github/workflows/ci.yml Adds sufficient checkout depth and a pull-request-only diff check that annotates and rejects newly added conflict-marker lines.
scripts/check-docs.py Adds a focused regex scan over the existing Markdown file set and reports exact locations for committed conflict markers.
docs/dev/ci.md Accurately documents the two marker-detection layers, their scope, and the indentation convention for quoted examples.

Reviews (1): Last reviewed commit: "ci: reject committed merge-conflict mark..." | Re-trigger Greptile

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@azimafroozeh
azimafroozeh merged commit fce1b3f into ModernRelay:main Sep 1, 2026
21 checks passed
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