Skip to content

fix(readme-generator): warn about mistyped and missing section markers - #708

Merged
Jamie-BitFlight merged 7 commits into
mainfrom
claude/marker-warnings
Sep 29, 2026
Merged

Jamie-BitFlight merged 7 commits into
mainfrom
claude/marker-warnings

Conversation

@Jamie-BitFlight

@Jamie-BitFlight Jamie-BitFlight commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

A marker whose name misses a section by a letter (#644), and a README with no section markers at all (#641), both gave a successful run that generated nothing. The only log of the reason was at debug level. Unpaired and ambiguous markers already warn, since #704.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Related Issues

Changes Made

  • diagnoseMarkers(source, sections) in src/markers.ts returns one warning per problem. ReadmeGenerator.generate() logs each warning before any section is written.
  • A marker whose name is within two edits of a section name, ignoring case, gets a warning that suggests the section. For example, <!-- start input --> gets "Did you mean 'inputs'?".
  • A name far from every section gets no warning. This differs from the groomed criterion on A section whose markers are missing or misspelled is skipped without warning #644, which asked for a warning on every unknown name. That would warn on the [.github/ghadocs/examples/] marker in README.example.md, which nothing fills, and on other tools' markers that use the same comment syntax.
  • Markers inside code are examples, and get no warning.
  • A README with no marker for any section gets one warning that names the marker syntax and points to README.example.md.
  • The exit code does not change.

Testing

  • All existing tests pass (vp test, vp check, bundled-binary test)
  • Added new tests for new functionality: diagnoseMarkers cases for a missing letter, a different case and a transposition. Also a far name, a typo inside code, a README with no markers, and an unpaired-only README. Two generate() tests: one README warns, one does not.
  • Manually tested the changes:
    • The built CLI warns on <!-- start input --> and on a README with no markers.
    • The CLI gives no warnings on this repo's README or on either integration target. setup-cosmocc carries the [.github/ghadocs/examples/] marker.

Additional Notes

The pre-commit generate-docs run also changed two generated files:

  • README.md now uses the v2.0.1 tag.
  • .github/ghadocs/branding.svg has its attributes reordered. The image is unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • README generation now reports warnings for section markers that are misspelled, including suggestions for close matches.
    • A warning is shown when a README has no section markers. Markers inside code blocks and unrelated names are handled without unnecessary suggestions or warnings.
  • Documentation

    • Updated the README usage example to reference version 2.0.1 of the action.

A marker whose name misses a section by a letter, and a README with no
section markers at all, both produced a successful run that generated
nothing, with the reason logged at debug level only.

Before any section is written, generate now warns about a marker whose
name is within two edits of a section name, suggesting that section, and
about a README with no marker for any section, pointing at
README.example.md. A name far from every section is left alone: the
template's own [.github/ghadocs/examples/] marker and other tools'
markers use the same syntax. Markers inside code are examples and are
not reported. The exit code is unchanged.

Fixes #644
Fixes #641

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: bitflight-devops/github-action-readme-generator/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6a4f2d10-d847-4c1b-b8d1-54f96787186f

📥 Commits

Reviewing files that changed from the base of the PR and between 6a789cd and f9b50e3.

📒 Files selected for processing (4)
  • __tests__/markers.test.ts
  • __tests__/readme-generator.test.ts
  • src/markers.ts
  • src/readme-generator.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: bitflight-devops/github-action-readme-generator/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 7bf9971f-4628-4343-9693-b4926351a489

📥 Commits

Reviewing files that changed from the base of the PR and between d0435a8 and 6a789cd.

⛔ Files ignored due to path filters (1)
  • .github/ghadocs/branding.svg is excluded by !**/*.svg
📒 Files selected for processing (5)
  • README.md
  • __tests__/markers.test.ts
  • __tests__/readme-generator.test.ts
  • src/markers.ts
  • src/readme-generator.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The generator now diagnoses missing or misspelled README section markers and logs warnings before updating sections. The README usage example also references version v2.0.1.

Changes

Marker diagnostics

Layer / File(s) Summary
Marker matching and diagnostics
src/markers.ts, __tests__/markers.test.ts
diagnoseMarkers matches section names case-insensitively within two edits. It reports close-name mismatches and a warning when all known sections are missing. Tests cover unrelated names, unclosed fences, code examples, and unpaired markers.
Generator warning integration
src/readme-generator.ts, __tests__/readme-generator.test.ts
generate diagnoses the current README against README_SECTIONS and logs each warning before updating sections. Tests check marker-free and marker-bearing README content.

README usage example

Layer / File(s) Summary
Update the action version in the usage example
README.md
The action reference changes from v2.0.0 to v2.0.1.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant ReadmeGenerator
  participant diagnoseMarkers
  participant logger
  ReadmeGenerator->>diagnoseMarkers: README content and README_SECTIONS
  diagnoseMarkers-->>ReadmeGenerator: warning messages
  ReadmeGenerator->>logger: log each warning
Loading

Suggested reviewers: bitflight-devops

Merge Risk: ⚪ Minimal · up to 6a789

No blocking issue was identified in the marker diagnostics, generator integration, or usage example; the change is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 6a789

The change primarily adds warnings. It does not appear to grant new access or change where README content is written, but a diagnostic failure could now stop generation before updates begin.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The newly reachable path is limited to parsing the current README and emitting warnings before the existing generation path. The inspected path does not add authority over another asset or service.

Trust Boundaries and Controls

  • observed — README-derived marker names must match a known section or be within two edits of one to produce a near-miss warning; warning output uses the existing logger.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The README change updates the usage version from github-action-readme-generator@v2.0.0 to @v2.0.1. This change does not implement marker diagnostics for #644 or #641. The reported SVG change is ex… Remove the unrelated README version update from this pull request. Keep generated artifact changes only when they are required by the marker-warning implementation; otherwise move them to a separate pull request.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: warnings for mistyped and missing section markers.
Linked Issues check ✅ Passed The changes satisfy the coding requirements in #644 and #641. diagnoseMarkers detects nearby marker-name typos case-insensitively, returns suggestions, and ReadmeGenerator.generate logs the warnin…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (1 skipped: 1 …
Full details: Out of Scope Changes check

Explanation

The README change updates the usage version from github-action-readme-generator@v2.0.0 to @v2.0.1. This change does not implement marker diagnostics for #644 or #641. The reported SVG change is excluded from review, so its content cannot be assessed.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 92.13% 1008 / 1094
🔵 Statements 92.29% 1030 / 1116
🔵 Functions 95% 152 / 160
🔵 Branches 85.86% 553 / 644
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/markers.ts 100% 88.75% 100% 100%
src/readme-generator.ts 100% 100% 100% 100%
Generated in workflow #1048 for commit f9b50e3 by the Vitest Coverage Report Action

@Jamie-BitFlight
Jamie-BitFlight marked this pull request as ready for review September 26, 2026 23:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T11:00:56.267374Z f9b50e3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc18fda49c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/markers.ts Outdated
The mistyped-marker check set aside every marker inside code, so a
single mistyped pair after an unclosed generated fence went unreported.
It now follows locateSection's rule: a single pair counts wherever it
sits, and code only sets aside markers that are not one pair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2124cb477b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/markers.ts Outdated
A typo on one side splits a pair across two names, so the pair rule saw
neither side as a pair and set the typo aside when it sat after an
unclosed fence. Markers are now grouped by their section, or the section
a near-miss name was meant to be, before the pair rule is applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a789cda3b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/readme-generator.ts
Comment thread src/markers.ts Outdated
The mistyped-marker check used the single-pair rule as a stand-in for
"the markers sit after an unclosed fence", and each edge case of that
stand-in produced a missed or false warning. It now asks the real
question: a marker inside closed code is an example, and a marker
inside a fence that nothing closes is reported.

The missing-markers warning now checks the sections being generated,
so --sections=inputs against a README with only a title pair warns, and
an empty selection does not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39e6ee2ffb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/markers.ts Outdated
The unclosed-fence check read a code range's kind from its text, so inline
code opened by triple backticks, or an indented block whose first line is
backticks, was taken for a fence that nothing closes, and a mistyped
example inside it was reported. The parser's node kind now decides: only
a fenced code block, whose node starts at its fence, can be unclosed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
Only fenced code blocks reach isUnclosedFence, and a fenced block's node
starts at its fence, so the branch for a missing opener could not run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
@Jamie-BitFlight
Jamie-BitFlight merged commit 7d6c536 into main Sep 29, 2026
11 checks passed
@Jamie-BitFlight
Jamie-BitFlight deleted the claude/marker-warnings branch September 29, 2026 10:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9b50e38a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/markers.ts
Comment on lines +250 to +252
const examples = codeRanges(source).filter(
([from, to, fenced]) => !fenced || !isUnclosedFence(source.slice(from, to)),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep lone typos inside unclosed fences as examples

When an unclosed fenced example contains only one near-miss marker, such as a lone <!-- start input -->, this filter removes the entire code range from examples and emits a typo warning. Because this is not a complete start/end pair, locateSection would still set the marker aside as code; only a complete inferred pair should bypass code filtering. Otherwise valid third-party READMEs receive false warnings for documented examples.

AGENTS.md reference: AGENTS.md:L14-L19

Useful? React with 👍 / 👎.

Jamie-BitFlight pushed a commit that referenced this pull request Sep 29, 2026
## [2.0.3](v2.0.2...v2.0.3) (2026-09-29)

### Bug Fixes

* **markers:** never pair a marker with an example in closed code ([#712](#712)) ([44f4da7](44f4da7))
* **readme-generator:** warn about mistyped and missing section markers ([#708](#708)) ([7d6c536](7d6c536))
* **sections:** keep fenced code blocks in a description intact ([#709](#709)) ([47728d4](47728d4))
@Jamie-BitFlight

Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 2.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Jamie-BitFlight Jamie-BitFlight added the released This issue/pull request has been released. label Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released This issue/pull request has been released.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A section whose markers are missing or misspelled is skipped without warning A README with no section markers is silently left unchanged

2 participants