From 33f2bd34c5e6554187ef4d70a5adf6a80ed38bea Mon Sep 17 00:00:00 2001 From: BearHuddleston Date: Mon, 23 Nov 2026 08:23:46 +0000 Subject: [PATCH] fix(ci): check the prompt-surface snapshot out with LF on every host prompt_surface.py now writes the snapshot with LF on Windows and the snapshot test compares bytes, but .gitattributes pinned only the .json files. The prompts/*.txt files fell under "* text=auto", so a Windows clone with core.autocrlf=true (the Git for Windows default) checked them out as CRLF, and every prompt read as stale on a clean checkout. Pin the whole snapshot directory to eol=lf. The new test checks that every snapshot file resolves to eol=lf. On a core.autocrlf=true checkout of 2304f34aea, both it and test_committed_prompt_surface_is_current fail, with all 9 prompts stale. With this .gitattributes the same checkout passes 3/3. Found by the sol-loop review on #159146. --- .gitattributes | 3 +++ tests/ci/test_prompt_surface.py | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/.gitattributes b/.gitattributes index e230890e49..778a2f79ff 100644 --- a/.gitattributes +++ b/.gitattributes @@ -41,6 +41,9 @@ docker/entrypoint.sh text eol=lf *.svg text eol=lf *.ps1 text eol=crlf +# scripts/ci/prompt_surface.py renders this snapshot with LF on every host and compares bytes. +tests/fixtures/prompt_surface/** text eol=lf + # Shims at old module paths: hermes_agent/compat/required_names.py # BEGIN shims (generated by scripts/move/generate_shims.py; do not edit) /tools/plugin_guard.py linguist-generated=true diff --git a/tests/ci/test_prompt_surface.py b/tests/ci/test_prompt_surface.py index 4e597ed8dc..7156d8a379 100644 --- a/tests/ci/test_prompt_surface.py +++ b/tests/ci/test_prompt_surface.py @@ -13,6 +13,7 @@ from __future__ import annotations import filecmp import importlib.util import shutil +import subprocess from pathlib import Path REPO = Path(__file__).resolve().parents[2] @@ -44,6 +45,15 @@ def test_committed_prompt_surface_is_current(tmp_path): ) +def test_snapshot_is_checked_out_with_the_lf_that_render_writes(): + """render() writes LF on every host and the check above compares bytes, so a Windows clone with + core.autocrlf=true must not check the committed snapshot out as CRLF.""" + files = "\n".join(p.relative_to(REPO).as_posix() for p in prompt_surface.SNAPSHOT.rglob("*") if p.is_file()) + attrs = subprocess.run(["git", "check-attr", "--stdin", "eol"], cwd=REPO, input=files, + capture_output=True, text=True, check=True).stdout.splitlines() + assert attrs and [line for line in attrs if not line.endswith(": eol: lf")] == [] + + def test_summary_names_the_surface_and_tool_that_changed(tmp_path): base = prompt_surface.SNAPSHOT head = tmp_path / "head"