Skip to content

fix: classify lock observation errors as unknown #11

Closed

Description

@abruption

Problem

observeLockFile() returns exists: false for every lstat failure other than ENOENT. probeLock() then treats that result as free, discarding the observation error.

This is reproducible with an ENOTDIR path such as README.md/not-a-directory.lock: the observation contains an error while the probe reports free.

Security impact

Permission errors, invalid path components, I/O failures, and similar uncertainty can be misreported as an unlocked or absent lock, violating the fail-closed contract.

Required behavior

Represent actual absence separately from observation failure. Only a confirmed ENOENT may produce absent/free; every other lookup or open error must produce unknown and preserve a machine-readable error reason.

Ensure inspect, list, unlock preflight, and post-signal verification all propagate this state consistently.

Tests

Cover at least:

  • ENOENT as confirmed absence
  • ENOTDIR as unknown
  • permission-denied lookup/open as unknown where the platform permits
  • file replacement between observation and open
  • JSON output retaining the diagnostic reason

Activity

  1. added
    bug
    on Sep 20, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions