Skip to content

test(core): keep the storage rename journal test content-neutral on Windows - #2129

Merged
groksrc merged 1 commit into
mainfrom
shipright/BMEM-116
Nov 18, 2026
Merged

groksrc merged 1 commit into
mainfrom
shipright/BMEM-116

Conversation

@groksrc

@groksrc groksrc commented Nov 17, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the one test from #2121 that fails on every Windows run of main. The product code is fine. The test expected a content-neutral rename, but the test config made indexing rewrite the file during the rename. This PR also makes pull requests run the test file on Windows, so this kind of failure shows up before merge.

What failed

tests/indexing/test_storage_change_journal.py::test_storage_rename_leaves_one_moved_row fails on the Windows SQLite unit shard of main, most recently in run 44118870413 at b4b2c226:

>       [moved] = await journal_after(session_maker, test_project, created.partition_position)
E       ValueError: too many values to unpack (expected 1)

Why

  • The shared test config sets update_permalinks_on_move=True (tests/conftest.py:308). When the rename is indexed, that rewrites the moved note's permalink frontmatter.
  • write_file_atomic writes text with the platform's newline (src/basic_memory/file_utils.py:138-146), so on Windows the rewrite is stored with CRLF line endings. That behaviour is deliberate.
  • The stored checksum then differs from the planned checksum. The moved row stays unsettled, and the same index run promotes the stored bytes as a new version, which journals an updated row. This is the designed recovery path from fix(core): journal note changes that arrive through storage #2121, not a bug.
  • So on Windows the test saw two rows after the rename (moved, updated) where it expected one.

What changed

  • The test. test_storage_rename_leaves_one_moved_row now turns update_permalinks_on_move off, so the rename really leaves the file's bytes unchanged. It also asserts that the moved row carries the note's existing db_version and db_checksum, which pins down "unchanged content". The rewrite path is already covered by test_scan_move_keeps_a_rewritten_note_row_unsettled_when_storage_holds_other_bytes and ..._when_its_write_fails in tests/indexing/test_project_index_maintenance.py.
  • CI. test.yml runs the full Windows unit suite only on main. This PR adds tests/indexing/test_storage_change_journal.py to the test-windows-platform job's file list, so pull requests run it on Windows.

No product code changes.

Verification

All local runs on macOS, from origin/main at b4b2c226:

  • Reproduced the Windows failure before the fix. I used a scratch pytest plugin, kept outside the repo, that makes write_file_atomic write CRLF the way Windows does. The old test failed with ValueError: too many values to unpack (expected 1, got 2).
  • After the fix, with CRLF forced: tests/indexing/test_storage_change_journal.py, 4 passed.
  • After the fix, native: SQLite 4 passed; PostgreSQL (BASIC_MEMORY_TEST_POSTGRES=1, testcontainers) 4 passed.
  • ruff check, ruff format --check and ty check pass on the changed test. test.yml still parses as YAML.
  • The Windows job on this PR is the proof on real Windows.

Out of scope

tests/mcp/test_hook_brief_search.py::test_session_start_never_imports_the_mcp_tool_stack also fails on some Windows runs of main. It comes from #2113 and is not touched here.

Ticket: BMEM-116 (Drew's board).

🤖 Generated with Claude Code

…indows

test_storage_rename_leaves_one_moved_row failed on every Windows run of
main with "too many values to unpack (expected 1)". The test fixtures turn
on update_permalinks_on_move, so indexing the rename also rewrote the
note's permalink frontmatter. Windows stores that rewrite with CRLF line
endings, so the same index run promoted the stored bytes as a new version
and journaled an "updated" row after the "moved" row. That is the designed
recovery path, not a bug, but it meant the rename was not content-neutral.

The test now turns the setting off, so the rename leaves the file's bytes
unchanged and must produce exactly one "moved" row carrying the note's
existing version and checksum. The frontmatter-rewrite path stays covered
in test_project_index_maintenance.py.

The full Windows unit suite runs only on main, so the file is added to the
Windows platform regression job in test.yml. Pull requests now run it on
Windows before merge.

Ticket: BMEM-116

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Drew Cain <groksrc@gmail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T20:34:59.054709Z 7819af2 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@groksrc groksrc left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: done — no blocking findings.

Pull request #2129 fixes the Windows-only test setup and adds Windows pull-request coverage. The patch changes no product code.

I checked the two-file diff against base b4b2c226:

  • test_storage_rename_leaves_one_moved_row disables update_permalinks_on_move through function-scoped test fixtures. This makes the rename content-neutral on every platform.
  • The test now proves the moved journal row keeps the existing database version and checksum.
  • The pull-request Windows job includes the changed test file. Its real Windows run passed 116 tests in 59.11 seconds.
  • A local run passed all four tests. ruff check, ruff format --check, and ty check also passed.
  • Every current GitHub check passes at head 7819af2c. The patch adds no dependencies, permissions, secrets, or runtime behavior.

Next step: Shipright can advance this pull request. The merger owns the merge.

@groksrc groksrc added the review:done Automated review found no blocking issues label Nov 17, 2026
@groksrc
groksrc merged commit cbc00ca into main Nov 18, 2026
43 checks passed
@groksrc
groksrc deleted the shipright/BMEM-116 branch November 18, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:done Automated review found no blocking issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant