Fix CRLF distribution for .bat files; add DLL-specific caveat hint - #435
Conversation
CRLF strategy (docs/open-questions.md former item 2): - .gitattributes: *.bat/*.cmd now -text (no git line-ending conversion at all) instead of eol=crlf, which only affected checkout, never what raw.githubusercontent.com actually served. Confirmed live before this fix: the stored blob was 100% LF, 0 CRLF pairs. - Renormalized run_setup.bat, run_tests.bat, tests/dynamic_tests.bat to pure CRLF (git add --renormalize) -- the working-tree bytes were already CRLF via the old checkout-time conversion; only the stored blob (and therefore the raw URL) was wrong. - New tools/check_crlf.py (check + --fix) replaces git's own normalization as the enforcement mechanism: wired into tools/run_sanity_sweep.sh and a new, independent, gating CI job (crlf-check in batch-check.yml). - Contributor-facing warning banner added to all three tracked .bat files: do not edit via the GitHub web editor or a Mac/Linux tool. - GitHub Pages now also publishes a guaranteed-CRLF copy of run_setup.bat on every push to main, as an independent fallback distribution point decoupled from git blob/raw-URL semantics. - README: new top-of-file "Just want the file?" pointer plus a revised TL;DR bullet now that raw downloads are expected to work correctly. - Optional tools/githooks/pre-commit + CONTRIBUTING.md note. - docs/agent-lessons-learned.md: new ".bat files: -text, not eol=crlf" entry documents the mechanism and the diff-cleanliness tradeoff. DLL-specific postflight caveat hint (docs/open-questions.md former item 1, answered yes): the caveat panel now surfaces a real, already-computed fact from :dll_bundle_recover instead of staying purely generic, via a new HP_DLL_HINT_STATE variable and :pfb_dll_hint subroutine dispatching into 3 wording buckets (skipped / attempted-and-failed / repaired), per the review finding that detection and repair are not the same event. Regression guard: tests/harness.ps1's new batch.dll_bundle.caveat_hint. Both open questions in docs/open-questions.md are now resolved and folded into docs/agent-closed-backlog.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017SQ1rvJxDbE71pTXJ4QvLV
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (19)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe change preserves CRLF bytes for ChangesBatch-file CRLF enforcement
DLL post-flight hint coverage
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Git
participant Checker as tools/check_crlf.py
participant CI as crlf-check
participant Pages as GitHub Pages
Git->>Checker: Discover tracked .bat and .cmd files
Checker->>CI: Return CRLF validation status
CI->>Pages: Validate and copy run_setup.bat
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
CI's ndjson-registry-check (advisory, non-gating) correctly caught this on PR #435's own run: the new tests/harness.ps1 static check emits batch.dll_bundle.caveat_hint but it was never added to the doc registry, violating this repo's own AGENT DIRECTIVE (update the registry in the same commit as the new row). Verified locally via tools/check_ndjson_registry.py: 302/302 doc vs code IDs now match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017SQ1rvJxDbE71pTXJ4QvLV
* Fix two stale post-#435 messages; close Item 51; file Item 59 A high-confidence external review (working from the repo alone, no CI log access) caught two places the CRLF distribution fix (#435) landed but didn't revisit: - run_setup.bat's own line-ending self-check panel still told a confused user to "re-download using git clone, not the Raw button" -- true before #435, false and actively bad advice after it (steers a git-less Prime Directive user toward a tool they don't have, instead of just re-downloading via the now-fixed Raw link). The panel and its header comment now describe the check as defense-in-depth against a stale/re-saved copy, not a workaround for a still-broken channel. - :merge_git_config (REQ-015) still wrote *.bat eol=crlf / *.cmd eol=crlf into every bootstrapped user's OWN .gitattributes -- the exact pattern this repo just proved insufficient for itself. Changed to *.bat -text / *.cmd -text, matching this repo's own .gitattributes. Both fixes updated their matching test assertions (selfapps_lineending_check.ps1, selfapps_ux_hardening.ps1) and the REQ-015 spec in README.md in lockstep. Also closes Active Backlog Item 51 (HP_PIPREQS_RC errorlevel-capture ordering): the same review settled the underlying cmd.exe semantics question (a successful plain "set" does not itself touch %errorlevel%, so this was very likely never a live bug) but the zero-risk reorder fix was applied anyway, exactly as the item's own note recommended, closing the cross-call-site inconsistency regardless of who's right. Files Active Backlog Item 59: CodeRabbit's automated review did not run on PR #435 (manual-trigger-required repo config) -- standing directive for future PRs to trigger it via @coderabbitai review, plus a record of what this pass caught as the motivating evidence. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017SQ1rvJxDbE71pTXJ4QvLV * Fix CodeRabbit findings on PR #436 Two real issues caught by CodeRabbit's review: - selfapps_ux_hardening.ps1's whole-script $allPass aggregate (line 1184) still referenced $gaBatCrlf, the variable renamed to $gaBatText earlier in this same PR. Under PowerShell's non-strict mode the undefined reference silently evaluated to $null, making $allPass always false regardless of actual test outcomes -- this script would have always exited 1. Fixed to reference $gaBatText. - selfapps_ux_hardening.ps1's non-Windows skip guard used $IsWindows, which is undefined under Windows PowerShell 5.1 (only introduced in PowerShell 6+). The identical bug was already fixed in the sibling selfapps_lineending_check.ps1 (PR #434); this file had not been updated to match. Fixed to the same [System.Environment]::OSVersion.Platform pattern. A third finding (:merge_git_config doesn't migrate an existing .gitattributes with the old eol=crlf rules to -text) is real and correctly rated "Major, Heavy lift" by CodeRabbit -- left for a follow-up rather than folded into this PR; it needs a real read-modify-write against a user's own file plus a new regression scenario, not a quick fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017SQ1rvJxDbE71pTXJ4QvLV * File Item 60: REQ-015 does not migrate an existing .gitattributes CodeRabbit's review on PR #436 (rated Major, Heavy lift) correctly identified that the idempotency guard in :merge_git_config means a user who already ran an older run_setup.bat keeps *.bat eol=crlf / *.cmd eol=crlf forever -- item 59's fix only covers a fresh append, not migrating existing content. Real design questions (replace vs. append-superseding-rules) mean this needs its own scoping pass rather than a rushed fix folded into this PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017SQ1rvJxDbE71pTXJ4QvLV * Fix two more CodeRabbit findings on PR #436 - Test 4's .gitattributes assertion only checked *.bat -text, never *.cmd -text, even though :merge_git_config writes both. A regression in the .cmd rule specifically could have passed silently. Added $gaCmdText, included in both the row's own pass condition and the whole-script $allPass aggregate. - Tagged the -text rationale comment as "# derived requirement:" per this repo's own convention for non-obvious constraints. Verified: PS AST parse clean, check_delimiters.py clean (one pre-existing, unrelated finding at a shifted line number, confirmed present before this change too), ASCII clean, markdownlint-cli2 CLAUDE.md clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017SQ1rvJxDbE71pTXJ4QvLV --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Two independent changes, both closing items from
docs/open-questions.md:1. CRLF distribution fix (former open question 2)
Root cause, confirmed live before this fix:
raw.githubusercontent.com/.../run_setup.batserved pure LF (0 CRLF pairs, 5,626 bare LF) even though.gitattributeshad*.bat text eol=crlf. Git'stext=autonormalizes the stored blob to LF on every commit regardless of anyeol=override --eol=only affects what a realgit checkoutwrites to a working tree, a step raw/blob serving never performs. This is exactly whatdocs/agent-closed-backlog.md's Item 44 (the runtime line-ending self-check) was mitigating, not fixing.Fix (combining the open question's own options B + C, per maintainer decision that a real enforcement plan closes option B's stated risk):
.gitattributes:*.bat/*.cmdchanged to-text(git performs no line-ending conversion at all, in either direction) -- stored blob, working-tree bytes, and raw-served bytes are now always identical.tools/check_crlf.py(check +--fix) replaces git's own normalization as the enforcement mechanism -- wired intotools/run_sanity_sweep.shand a new, independent, gating CI job (crlf-check, noneeds:, runs immediately). Per this repo's own "gating is a branch-protection setting, not a YAML edit" rule, someone with admin access still needs to add its check name to required-status-checks for it to actually block merges..batfiles (git add --renormalize) -- a one-time, mechanical full-file diff with no real content change (the working-tree bytes were already genuine CRLF via the old checkout-time conversion; only the stored blob was wrong)..batfiles: do not edit via the GitHub web editor or a Mac/Linux tool.publish_diagjob) now also republishes a guaranteed-CRLFrun_setup.baton every push tomain-- a second, independent distribution point decoupled entirely from git blob/raw-URL semantics, as a fallback if the raw link ever misbehaves.tools/githooks/pre-commit+CONTRIBUTING.mdnote (CI is the real gate; this just saves a round-trip).inline_model_fix.pymay commit auto-fixes" rule.2. DLL-specific postflight caveat hint (former open question 1, answered yes)
The post-flight caveat panel now surfaces a real, already-computed fact from
:dll_bundle_recover(the native-DLL bundling repair loop) instead of staying purely generic. NewHP_DLL_HINT_STATEvariable (captured before the NDJSON gate, reset once per fresh build attempt) and:pfb_dll_hintsubroutine dispatch into 3 wording buckets -- a prior review finding established detection and repair are not the same event, so the wording must not claim more than each state means (skipped / attempted-and-failed / repaired).Both open questions are now resolved and folded into
docs/agent-closed-backlog.md;docs/open-questions.mdis back to empty.Test plan
python tools/check_delimiters.py run_setup.bat run_tests.bat tests/dynamic_tests.bat-- cleanpython tools/check_crlf.py-- all 3 tracked.batfiles pure CRLFpython -m compileall -q ./python -m pyflakes .-- cleanpython -m yamllint .github/workflows//actionlint -oneline .github/workflows/*.yml-- cleantests/*.ps1,tools/*.ps1) -- cleanpython -m pytest tests/test_*.py -q-- 528 passed, 3 skipped (includes 13 new tests fortools/check_crlf.py)tests/harness.ps1static check (batch.dll_bundle.caveat_hint) verified directly against the realrun_setup.batcontent via a standalonepwshrun of the same regex logic before landing, not just reasoned aboutrun_setup.batto confirm the renormalization commit introduced only the intended banner + DLL-hint changes, nothing elsereal/conda-fullgating lanes) -- pending this PR's own CI run🤖 Generated with Claude Code
https://claude.ai/code/session_017SQ1rvJxDbE71pTXJ4QvLV
Generated by Claude Code