Skip to content

chore: adopt §6.5 text file format (LF, UTF-8, final newline) - #2

Open
UnbreakableMJ wants to merge 3 commits into
mainfrom
chore/6.5-text-file-format
Open

UnbreakableMJ wants to merge 3 commits into
mainfrom
chore/6.5-text-file-format

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

Adopts Steelbore Standard §6.5 — Text File Format (added at Standard v1.51).

What

File Purpose
.gitattributes * text=auto eol=lf — normalizes every text file to LF in the repo and on checkout
.editorconfig charset = utf-8, end_of_line = lf, insert_final_newline = true, trim_trailing_whitespace = true
.github/workflows/text-file-format.yml Fails CI on a CR byte in a tracked text file

Why

.gitattributes is the mandatory half because it is the only mechanism independent of a contributor's core.autocrlf — which defaults to true on Windows and rewrites the working tree on checkout. The contributor's editor shows nothing unusual; the commit that leaves their machine rewrites every line of every file they touched, and the reviewer gets a whole-file diff with the real change buried in it. The failure is silent where it originates and expensive where it lands.

.editorconfig reaches the other half of the problem: editors that never consult Git, where the file is created wrong before Git ever sees it.

Both config files are only advisory to the tools that read them, so §6.5 makes the CI gate the binding part. git grep -I skips binaries and honors .gitattributes, so a pinned CRLF exception is invisible to it and no exclusion list is needed.

The gate ships as its own workflow rather than a step inserted into an existing one, so the check is byte-identical across every repository in the rollout and no existing workflow is touched.

Risk

Configuration only — no file contents change. This repository was verified to have zero CRLF bytes in tracked text files before the change, so there is no renormalization commit and no diff noise. Repositories that do carry CRLF content are handled in a separate wave, because .gitattributes does not retroactively fix blobs already stored with CRLF — that needs git add --renormalize.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XGgUmYtDJxo8EMKyB5LdoV

The Steelbore Standard v1.51 added §6.5: every text file in a Spacecraft
Software source tree is LF-terminated, UTF-8 without BOM, and ends with a
newline, with `.gitattributes` and `.editorconfig` required at the root and
a CI gate that fails on a CR byte.

`.gitattributes` is the mandatory half because it is the only mechanism
independent of a contributor's `core.autocrlf`, which defaults to true on
Windows and rewrites the working tree on checkout — the commit that leaves
that machine then rewrites every line of every file touched, and the
reviewer gets a whole-file diff with the real change buried in it.
`.editorconfig` reaches editors that never consult Git.

Both config files are advisory to the tools that read them, so the gate is
what makes the rule binding. It ships as its own workflow rather than a step
inside an existing one, so the check is identical across every repository.

This repository has no CRLF in tracked content today, so this is
configuration only — no file contents change.

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

@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: 597501f61b

ℹ️ 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 .github/workflows/text-file-format.yml Outdated
- name: No CR bytes in tracked text files
run: |
CR=$(printf '\r')
if git grep -Il "$CR" -- .; then

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 Exclude declared CRLF exceptions from the grep

When the documented *.bat text eol=crlf exception is added, actions/checkout writes that text file with CRLF and this worktree search matches its CR byte, causing every workflow run to fail. The official documentation says -I only suppresses matches in binary files (git-grep), while eol=crlf explicitly checks text paths out with CRLF (gitattributes); it does not make such paths invisible as the workflow comment claims. Exclude paths whose eol attribute is crlf before failing.

Useful? React with 👍 / 👎.

UnbreakableMJ and others added 2 commits September 12, 2026 22:17
A working-tree grep for CR fails a correctly pinned `eol=crlf` file,
which is stored LF and checked out CRLF by design — punishing the very
exception §6.5 grants. The gate now reads `git ls-files --eol` and
fails only on i/crlf or i/mixed, which is CRLF in the repository.

Corrects Standard §6.5 as amended at v2.02.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGgUmYtDJxo8EMKyB5LdoV
A path pinned `-text` is declared binary; git does no eol conversion on
it, so its blob keeps CRLF and `ls-files --eol` reports i/crlf though it
is not a text file at all. Found on a PDF with no NUL bytes in its first
8KB, which git classifies as text.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGgUmYtDJxo8EMKyB5LdoV
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