Skip to content

build(hooks): push docs changes from a Windows checkout - #147

Merged
zolotokrylin merged 1 commit into
mainfrom
claude/github-issue-legitimacy-921af3
Aug 7, 2026
Merged

build(hooks): push docs changes from a Windows checkout#147
zolotokrylin merged 1 commit into
mainfrom
claude/github-issue-legitimacy-921af3

Conversation

@zolotokrylin

@zolotokrylin zolotokrylin commented Aug 7, 2026

Copy link
Copy Markdown
Member

The rules audit parses frontmatter with /^---\n/. On a Windows checkout with core.autocrlf=true, the Windows default, the working tree holds CRLF while the committed content is LF. The pattern stops matching, every rule reports as missing frontmatter, and the pre-push hook refuses the push on files that are perfectly valid.

The reported case was holdex/partnerships, but this repo ships the same scripts/check-rules.mjs and carries the identical exposure.

What changed

  • .gitattributes pins the checkout to LF, so the working tree stays byte-identical to what is committed on every platform. This removes the root cause.
  • check-rules.mjs strips CR at read time via a readFileSync wrapper, which covers all seven read sites at once rather than patching each pattern. This keeps the audit correct on clones made before .gitattributes landed, which .gitattributes alone does not fix until a contributor re-normalizes.

Verification

Converting docs/**/*.md to CRLF in a scratch copy reproduces the reported failure exactly: the audit fails with 98 issues, every rule reported as missing frontmatter. With the script change in place the same CRLF tree passes. The normal LF tree passes before and after (35 rules, no issues).

For the reviewer

The Problem left the approach open between normalizing line endings and making the scripts agnostic. This does both, because they fix different halves: .gitattributes prevents it for new clones, the script change unblocks existing ones.

marketing-website was raised as unverified in the Problem and is not affected. Its scripts/lint-content-tags.mjs already matches /^---\r?\n([\s\S]*?)\r?\n---/, and the rest of its hook does not depend on working-tree line endings.

holdex/partnerships still needs the same two changes to unblock the original reporter. That is a separate PR in that repo.

Summary by CodeRabbit

  • Chores
    • Standardized text files to use LF line endings.
    • Marked common image, PDF, and font files as binary.
    • Improved consistency when reading text files across supported checks, regardless of line-ending format.

The rules audit parses frontmatter with `/^---\n/`. On a Windows checkout
with `core.autocrlf=true` the working tree holds CRLF while the committed
content is LF, so the pattern stops matching, every rule reports as missing
frontmatter, and the pre-push hook refuses the push on valid files.

Pin the checkout to LF with `.gitattributes` so the working tree matches
what is committed, and strip CR at read time in check-rules.mjs so the
audit stays correct on clones made before `.gitattributes` landed.
@zolotokrylin zolotokrylin self-assigned this Aug 7, 2026
@holdex

holdex Bot commented Aug 7, 2026

Copy link
Copy Markdown

Time Submission Status

Member # Time Running Total Status Last Update
zolotokrylin 11min ✅ Submitted Aug 7, 2026, 4:22 AM

Submit or update total time with:

@holdex pr submit-time 2h

Add time on top of previous submission with:

@holdex pr add-time 1h30m

See available commands to help comply with our Guidelines.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ac57c00b-7956-4d72-b614-d6d341c82788

📥 Commits

Reviewing files that changed from the base of the PR and between 5e723d8 and 3b0d696.

📒 Files selected for processing (2)
  • .gitattributes
  • scripts/check-rules.mjs

Walkthrough

The repository now enforces LF line endings and binary file handling. The rules validation script normalizes CRLF input to LF for configuration, rule, index, document, and README reads.

Changes

Line Ending Normalization

Layer / File(s) Summary
Repository line-ending policy
.gitattributes
Text files use LF line endings. Common image, PDF, and font formats are marked as binary.
Normalized validation reads
scripts/check-rules.mjs
A shared UTF-8 reader converts CRLF to LF. All rules, index, document, and README reads use this reader.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the hook change that enables documentation pushes from Windows checkouts.
Linked Issues check ✅ Passed The changes address issue #145 by enforcing LF line endings and normalizing CRLF input in documentation checks.
Out of Scope Changes check ✅ Passed The changes are limited to line-ending handling for documentation hooks and related repository attributes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/github-issue-legitimacy-921af3

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.

@zolotokrylin

Copy link
Copy Markdown
Member Author

@holdex pr add-time 11m

@zolotokrylin
zolotokrylin marked this pull request as ready for review August 7, 2026 04:22
@zolotokrylin
zolotokrylin merged commit ad35cdc into main Aug 7, 2026
4 checks passed
@zolotokrylin
zolotokrylin deleted the claude/github-issue-legitimacy-921af3 branch August 7, 2026 04:26
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.

Problem: contributors on Windows can't push docs changes

1 participant