Skip to content

Windows: 26 unit tests fail beyond locking — path-separator assumptions in scope, provenance and hook setup #55

Description

@Apageoflove

Follow-up to #54 (portable locking). On real Windows 11 / Python 3.13.5 the PR branch imports and the store works, but 26 unit tests still fail. The same 26 fail identically on a main baseline run with an fcntl shim, so these are pre-existing, not regressions. All measured on this machine; the root causes below are the three families I reproduced, the rest 未逐一定位.

First family: scoped recall never matches, because in_scope compares forward-slash scopes like fact/payments against backslash paths. Covers the four test_scope cases in test_recall.py and the four test_a_crowded_system_directory cases in test_manage.py.

Second family: provenance pointer validation rejects backslash paths. Reproduced error is validation_error with unsupported provenance archive\provenance\legacy...md. Covers the four test_progressive_trace.py cases; the memory_systems family 疑同源(推测,未逐一验证).

Third family: hook setup assumes POSIX absolute paths, the assertion executable.startswith("/") can never hold on Windows. Covers the two test_setup_writes_an_absolute_hook_command cases in test_write_triggers.py.

Remaining 12 without individual diagnosis: test_memory_systems.py seven cases (memcore prepare/count/inject/release/reopen/fingerprint/keeps-no-transcript), test_timestamps.py two (legacy file reindex, calendar-day upgrade), test_indexer.py one (touching one file reindexes only that file), test_muse_host.py one (setup idempotent), test_read_exposure_gate.py one (store gate rejects missing projection).

Design note, 仅个人判断: normalising paths to forward slashes at the store boundary (as_posix on keys and pointers) likely fixes the first two families in one place, but that call belongs to the maintainers.

Baseline numbers: main with fcntl shim 471 passed / 30 failed; #54 branch 480 / 26; the four the PR fixes are itimer hook/muse cases.

Activity

  1. Apageoflove commented on Oct 6, 2026

    @Apageoflove
    Author

    First family (scoped recall, the 8 tests in test_recall.py and test_manage.py) now has a fix up as #58: the scoped SQL in SearchIndex.match compares the stored side normalised with replace(path, backslash, slash), so backslash-carrying paths match forward-slash scopes.

    Verified on real win32: the 8 tests go red to green, full unit suite 481 passed / 22 failed against the 471/30 baseline in this issue, failure-set diff empty (exactly the 8 fixed, nothing new). The new test_scope_separator.py manufactures a backslash path row directly in the database so POSIX CI also exercises the normalisation — 我没实测 POSIX 环境本身,那条结论以 CI 为准.

    Families two (provenance pointers) and three (hook setup assertion) remain open here. Write-side normalisation remains the bigger design alternative if the maintainers prefer it over comparison-side — 仅个人判断.

  2. Apageoflove commented on Oct 6, 2026

    @Apageoflove
    Author

    Second family now has a fix up as #61: the write side stores as_posix references, and the two read-side guards (the trace.read membership gate and _legacy) normalise before validating, with the traversal guards still in place and pinned by a test. On real win32 the target test goes red to green and the failure-set diff is exactly one.

    One correction to my own triage in this issue, so nobody chases the wrong bug: only one of the four progressive_trace failures was the separator bug. The other three fail on win32 during test setup with WinError 1314 (creating symlinks needs a privilege this machine does not grant), before any agent-memory code runs(这是本机实测结论,其他 Windows 环境未验证). They belong to a symlink-privilege class, not the separator families. The remaining 12 undiagnosed failures from the original list are unchanged.

  3. Apageoflove commented on Oct 6, 2026

    @Apageoflove
    Author

    Triage update, all reproduced on real win32 today(仅本机实测,其他 Windows 环境未验证).

    The timestamps pair now has a fix up as #62, and it is a product bug, not an environment one: from_text hashes the LF-normalised text while _write_locked compared raw disk bytes, so a CRLF-saved file (Notepad, git autocrlf) failed its first write with memory changed since it was read. Both tests red to green; failure-set diff exactly two.

    The seven memory_systems failures are reclassified as environment, not the separator family I guessed earlier (that guess was wrong): six fail at symlink setup with WinError 1314, and the seventh runs the fixture's shell-script fake binary, which win32 cannot execute (WinError 193). None of the product code under test is reached.

    That leaves three undiagnosed of the original twelve: test_indexer (its assertion shows a backslash path in an unexpected reindex list, 需要确认 whether separator-related), muse_host setup idempotence (untested today), and read_exposure_gate (fails during temp-dir cleanup with WinError 32, a file-handle class).

  4. Apageoflove commented on Oct 11, 2026

    @Apageoflove
    Author

    The indexer case from the remaining three now has a fix up as #97. All numbers below come from my own machine runs(以下全部是本机实测,其他环境包括 CI 未验证).

    One line in the indexer: the scan built relative keys with str(relative_to(...)), which embeds the win32 separator, and those keys become the records.path column that the comparisons #58 patched all read. Switching to as_posix(), on plain main with no #58 code, flipped nine tests green on real win32: the indexer target, the four scope recall cases and the four crowded-directory manage cases. Full unit suite on the identical tree: 27 failed with the patch, 36 without, failure-set diff empty in both directions beyond those nine.

    Whether this makes it the write-side root of the scope family is my judgment from that measurement(仅个人判断,因果归我推断): plain main code passing once the stored form is posix is strong evidence the stored form was the cause, but I have not traced every consumer of the column.

    A legacy store with backslash rows self-heals on its first sync after the fix, verified empirically here and pinned as a test that manufactures the backslash rows directly in the database, so the case is at least represented on POSIX CI(CI 实际跑成什么样我无法验证,需要确认).

    Ledger of the original 26, from my runs only: #58 the comparison side of the scope family, #61 provenance, #62 timestamps, #97 this scan fix covering the indexer case and the scope family from the write side, seven memory_systems reclassified as environment. Remaining: muse_host setup idempotence and read_exposure_gate, both only seen failing at setup on my box, 根因未定位.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions