You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit feeaf07
Browse filesBrowse the repository at this point in the historyBrowse files
fix(core): keep a placeholder whose content is not the one open() wrote
The abandoned cleanup unlinked placeholderPath whatever had landed in it between
open() and the discard, so content the user typed into the preview, a formatter's
output or a later edit could be deleted by an edit nobody had approved. open()
now records the exact content it wrote at that path and the discard reads the
file back before unlinking: it unlinks only while the bytes still match, treats
an already-deleted placeholder as the cleanup having done its job, and otherwise
keeps the file and reports it instead of removing it.
The keep is reported through the channel this site already uses - the catch
around this cleanup logs it and the method already rejects as a cleanup failure -
so no new reporting channel is introduced here. Choosing a different one, for
example a dedicated revert-failure path of the kind the review names, is a
design call for a maintainer; this change uses the channel the file has.
Tests: a mismatching read keeps the file, writes nothing over it and surfaces as
a cleanup failure; a placeholder somebody else already deleted resolves without
a report; and the pre-existing placeholder test now answers the guard's read with
the empty content open() wrote. The record is cleared wherever placeholderPath is
cleared, and a placeholder installed without open() having written it keeps the
unconditional behaviour it always had.
0 commit comments