Skip to content

FileState read-ledger misses NFD unicode filenames on Linux (rescued read not recorded) #212

Description

@robertohluna

Symptom

FileReadDiagnosticsTest "a rescued read is recorded so a follow-up edit is not blocked" fails deterministically on Linux CI (has been red on every CI run), while passing on macOS.

Detail

test/tools/file_read_diagnostics_test.exs:279: after reading a file whose name is NFD-decomposed (:unicode.characters_to_nfd_binary("naïve.txt")), FileState.check_read(Path.join(tmp, nfd_name)) returns {:error, ...} instead of :ok.

Root cause: macOS (APFS) normalizes unicode filenames, so the rescued read and the check resolve to the same path. On Linux the NFD name is stored on disk as-is, so the rescue records the read under the resolved path while check_read is queried with the NFD form — they don't match, so the ledger reports 'never read' and a follow-up edit would be blocked. This is a real Linux product bug, not test flakiness.

Real fix

Make FileState path-keying unicode-canonical: normalize (NFC) both on record_read and check_read, or have check_read fall back to normalization-equivalent lookup. Then un-skip the test on Linux.

Interim

The test is skipped on non-macOS (kept running on macOS where the path resolves) so CI can be green. Needs a Linux repro + fix.

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