Reports whether a path is a staging file belonging to one store.
Matches the whole grammar stagingPathFor emits, not just its
ends. Testing the ends alone is not enough: a store at `tokens.json` would
claim `tokens.json.backup..tmp`, which is the legitimate staging file
of a different store called `tokens.json.backup`, and sweep away its
credential. Requiring the middle segment to be exactly a UUID makes the
prefix unambiguous again.
The suffix still matters independently: a quarantined file shares the
prefix but is the only copy of salvaged data, and must never be swept.
Both sides are reduced to their file name first. A candidate came from
listing the store's directory, so its name is all that identifies it, and
comparing whole strings would tie the match to how each caller spelled
that directory; the OTP store passes bare names. Normalising either side
would be wrong: collapsing `..` lexically can point at a different
directory when a symlink precedes it, which is also why the listing keeps
the directory exactly as given (see `EntryPath`).
Parameters
filePath: string
Absolute path of the store.
candidate: string
Path found alongside it.
Returns boolean
True when the candidate is this store's staging file.
Reports whether a path is a staging file belonging to one store.
Matches the whole grammar stagingPathFor emits, not just its ends. Testing the ends alone is not enough: a store at `tokens.json` would claim `tokens.json.backup..tmp`, which is the legitimate staging file
of a different store called `tokens.json.backup`, and sweep away its
credential. Requiring the middle segment to be exactly a UUID makes the
prefix unambiguous again.
The suffix still matters independently: a quarantined file shares the prefix but is the only copy of salvaged data, and must never be swept.
Both sides are reduced to their file name first. A candidate came from listing the store's directory, so its name is all that identifies it, and comparing whole strings would tie the match to how each caller spelled that directory; the OTP store passes bare names. Normalising either side would be wrong: collapsing `..` lexically can point at a different directory when a symlink precedes it, which is also why the listing keeps the directory exactly as given (see `EntryPath`).