Skip to content

Detect a .lake child renamed out and back in on Windows project inspection #403

Closed as not planned

Description

@Deicyde

On Windows, os.stat(path).st_ctime_ns is a directory's creation time, not its last change. So, according to the docstring of the token described below, the identity _directory_generation (autoform_cli/project/_snapshot.py) records for a directory may not change when a child is renamed out and back in while the decision files are captured; no test has shown this on a real Windows filesystem. On POSIX the change time covers that case.

Merge 216ad27b on #90's branch added a Windows-only token for the .lake directory's identity: _directory_change_token read the change time from FILE_BASIC_INFO through a directory handle (kernel32 CreateFileW with backup semantics, then GetFileInformationByHandleEx) and appended it to the identity. c5313fe0 took it only for directories and opened the handle without FILE_FLAG_OPEN_REPARSE_POINT, so it follows links as os.stat does. Its only test monkeypatched the token, and the change had nothing to do with #90's inventories or explorer, so 73ed9247 returned _snapshot.py and tests/test_project_inspect.py to main's bytes.

Proposal: bring the token back as its own PR, with a test on the Windows CI job that renames a real child out and back in during a capture and shows the snapshot notice it, which the monkeypatched test could not. The removed code is in git show 73ed92470 -- autoform_cli/project/_snapshot.py.

Activity

  1. Deicyde commented on Oct 20, 2026

    @Deicyde
    ContributorAuthor

    Closing in the stabilization triage Jack approved on 2026-10-20 (open issues only for a failure a user or CI hit, a request from Jack, or a decision only Jack can make). A speculative Windows-only race. Its own text says no test showed it on a real Windows filesystem, and the code was reverted out of #90. Reopen if a user or CI hits this.

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