Skip to content

fix(engine): compare the command surface snapshot without CRLF - #2759

Merged
giswqs merged 1 commit into
mainfrom
fix/command-surface-crlf
Nov 23, 2026
Merged

giswqs merged 1 commit into
mainfrom
fix/command-surface-crlf

Conversation

@giswqs

@giswqs giswqs commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Fixes the red test / Test (windows-latest) job on main (run 45102482280, commit 12ffc6c), from #2738.

Cause: a Windows checkout (core.autocrlf) converts crates/engine/command-surface.txt to CRLF. include_str! embeds those line endings, so the saved text never equals the LF text surface::text builds from the registry. Ids and keys all match, which is why the failure read "the same ids and keys, but a repeated id or another order".

Fix: command_surface_matches_the_snapshot turns CRLF into LF in the saved snapshot before comparing. cargo xtask commands still writes LF, and a real change to an id or key still fails.

Evidence: on Linux, converting the snapshot to CRLF reproduces the Windows failure message exactly. With this change, surface:: tests pass on both the CRLF and the LF file. Labelled ci:windows so the PR runs the job that failed.

Surfaces: test-only change in rustgis-engine; no user-facing behaviour.

Summary by CodeRabbit

  • Tests
    • Snapshot comparisons now handle Windows-style line endings consistently.

A Windows checkout converts crates/engine/command-surface.txt to CRLF,
so include_str! no longer equals the LF text the registry produces and
command_surface_matches_the_snapshot fails on windows-latest with
"the same ids and keys, but a repeated id or another order".
Normalise the saved text's line endings before comparing.
@giswqs giswqs added the ci:windows Run the Windows CI jobs on this pull request label Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The snapshot comparison test now normalizes CRLF line endings in the saved snapshot to LF before comparing it with generated command text.

Changes: Snapshot comparison

Layer / File(s) Summary
Normalize snapshot before comparison
crates/engine/src/surface.rs
The test converts CRLF line endings in the saved snapshot to LF before comparison. Duplicate-ID checking and difference reporting remain unchanged.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Possibly related PRs

Suggested reviewers: mavrick-f

Merge Risk: Minimal · up to 556e4

This test-only change makes the command surface snapshot test pass on Windows checkouts that convert line endings. It has no production impact and is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the actual change: the command surface snapshot comparison in rustgis-engine now ignores CRLF line endings. It matches the raw summary (CRLF normalized to LF before comparing) and the …
Description check Passed The description follows the template's main sections. The Summary explains the cause (Windows autocrlf converting the snapshot to CRLF) and the fix. Testing is described (Linux reproduction with a CRL…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the actual change: the command surface snapshot comparison in rustgis-engine now ignores CRLF line endings. It matches the raw summary (CRLF normalized to LF before comparing) and the PR objectives. It uses the conventional fix(engine) prefix and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the template's main sections. The Summary explains the cause (Windows autocrlf converting the snapshot to CRLF) and the fix. Testing is described (Linux reproduction with a CRLF snapshot, surface:: tests pass on both CRLF and LF files). The UI evidence section is filled with the required 'No visible UI change.' line, which is correct for this test-only change. The Related issue section is left as the template placeholder: it names no issue, though the description references #2738 only as the origin of the red job. The Testing section does not list a cargo xtask ci run, but the description gives concrete verification steps, so the gap is non-critical.

Resolution

Optional: replace the Related issue placeholder comment with a reference such as 'Part of #2738' if that issue tracks the failing job, and remove the template comment text.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks each line with care,
And smooths the endings here and there.
From CRLF to LF they flow,
The snapshot matches what commands show.
Then hops away, pleased with the row.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 57d5999a-a6e1-4a14-b800-eb178d1b834b
Commits

Reviewing files that changed from the base of the PR and between 25f3b18 and 556e4bd.

Files selected for processing: 1

  • crates/engine/src/surface.rs

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

Comment thread crates/engine/src/surface.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • None found. The fix does what it claims. command-surface.txt is read only by command_surface_matches_the_snapshot, so normalizing \r\n to \n in that one place covers every reader. text() builds LF output, so the comparison is now line-ending-independent, and a real id or key change still fails. Confidence: high.

Security

  • None found.

Performance

  • None found. The extra replace allocates one string of about 6 KB in a test.

Quality

  • Inline comment posted on crates/engine/src/surface.rs:98-101: saved is bound to a String, then shadowed by a &str that is only borrowed. Binding &saved directly removes the extra line, and the assert! still compiles. Confidence: high.
  • Optional, not posted: the root cause could instead be fixed with a .gitattributes entry such as crates/engine/command-surface.txt text eol=lf, so a Windows checkout keeps LF and no test needs to normalize. The repo has no root .gitattributes today. The test-side fix in this PR is still correct and smaller. Confidence: medium that this is worth doing.

AGENTS.md

  • None found. The change is test-only, so the never-crash, never-silent and wasm rules don't apply. The ci:windows label is in the PR body, which matches the rule for platform-specific test fixes.

Prior concerns

  • The review threads file is empty, so there were no earlier concerns to skip.

Change size

Compared: the whole PR against main (merge base 12ffc6c to PR head 556e4bd).

Measure Value
Files changed 1 (0 added, 1 modified, 0 removed, 0 renamed)
Size before 5.9 KB (6,029 B)
Size after 6.0 KB (6,190 B)
Total size change +161 B
Path Before After Change
crates/engine/src/surface.rs 5.9 KB 6.0 KB +161 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2759/
Web app https://preview.rustgis.app/pr-2759/app/
Commit 556e4bd

GitHub Pages takes a minute or two to publish a new commit.

@giswqs
giswqs added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit b81dad4 Nov 23, 2026
50 checks passed
@giswqs
giswqs deleted the fix/command-surface-crlf branch November 23, 2026 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:windows Run the Windows CI jobs on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant