Skip to content

test(core): write the indexed-bytes test note with LF newlines - #1674

Closed
cristianchiriac wants to merge 1 commit into
basicmachines-co:mainfrom
cristianchiriac:fix-indexed-bytes-test-windows
Closed

cristianchiriac wants to merge 1 commit into
basicmachines-co:mainfrom
cristianchiriac:fix-indexed-bytes-test-windows

Conversation

@cristianchiriac

Copy link
Copy Markdown

Summary

Since #1672, the Test SQLite Integration (windows-latest, Python 3.12) job on main fails in the new test-int/test_indexed_bytes_work_units.py:

FAILED test-int/test_indexed_bytes_work_units.py::test_batch_index_reports_bytes_indexed_and_zero_for_current_file[asyncio] - AssertionError: assert 204 == 193
FAILED test-int/test_indexed_bytes_work_units.py::test_single_file_index_reports_bytes_indexed[asyncio] - AssertionError: assert 204 == 193

On Windows, Path.write_text() translates \n to \r\n. The note on disk is therefore 11 bytes longer than NOTE_CONTENT (one \r per line), and the indexer correctly reports those 204 bytes. The test expects len(NOTE_CONTENT.encode("utf-8")). In the batch test, the observed checksum and size passed to the checker are computed from NOTE_CONTENT too, so they didn't describe the file on disk either.

The fix writes the note with newline="\n", as tests/test_claude_issue_triage.py already does. The file's bytes, size and checksum then match NOTE_CONTENT on every platform. Only the test changes.

Testing

On Windows 11, Python 3.12, with uv run --frozen pytest test-int/test_indexed_bytes_work_units.py:

  • before: 2 failed (assert 204 == 193)
  • after: 2 passed

ruff check, ruff format --check and ty check are clean on the changed file. The commit is signed off for DCO.

write_text() translates "\n" to "\r\n" on Windows, so the note on disk was
11 bytes longer than NOTE_CONTENT and both tests in
test_indexed_bytes_work_units.py failed on the Windows CI job
(assert 204 == 193). Write the note with newline="\n" so its bytes, size and
checksum match NOTE_CONTENT on every platform.

Signed-off-by: cristianchiriac <80774326+cristianchiriac@users.noreply.github.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@phernandez

Copy link
Copy Markdown
Member

Thanks @cristianchiriac! This landed on main as #1678 with your commit unchanged (authorship kept), so the Windows integration job is green again. Closing in favor of that.

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.

3 participants