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
fix(fs): narrow create_once's duplicate arm and single-source the staging prefixes
Four corrections from independent review of the fold, each a real gap rather than
a wording fix:
1. `create_once` evaluated `written.and_then(|()| hard_link(…))`, so its
`Err(_) if path.is_file() => Ok(false)` arm also caught failures from the
staged WRITE. An `ENOSPC`/`EIO` on the staged bytes was then reported as "this
key was already published" whenever the target happened to exist — bytes that
were never written are nobody's publication. Only the hardlink may answer that
question now. The absorbed callers propagated a failed write unconditionally,
so this restores their contract. No test can force the edge in-process (there
is no write-fault injection in this tree), so it is review-pinned.
2. `replace` removed the staged file on a REFUSED creation, which meant st2
unlinked whatever an agent had planted at the staging path instead of merely
refusing to follow it — and asymmetric with `create_once`, which returns
before its cleanup. The creation now returns before the cleanup scope in both.
3. Folding the staging name into a module made each caller's prefix a bare string
argument, and the assertion that pinned `.status.tmp-` went with `tmp_name`.
The walkers that skip staged files by prefix now read the writer's own const —
`status::TMP_STAGING_PREFIX` for the six in `catalog`, `catalog_transaction`
and `agent_publish`, `message::TMP_STAGING_PREFIX` for the four in `message`,
and `harness_context::is_legacy_staging_name` derives its prefix from the
`TMP_PREFIX` the writer passes — so a walker can no longer drift from the
writer. Each module also asserts its const's VALUE, which is the part a shared
const cannot protect: renaming both sides together would leave every
already-staged file on the fleet unrecognized.
4. `reserved_message_temporary_symlinks_are_never_followed` predicted staging
names from one probe of a counter that is now process-global, so a sibling
test advancing it past the planted window would have turned the test
intermittent. It now plants, re-probes, and only proceeds once the very next
name is one it has blocked.
Also corrects the HC-T08 sentence added by the fold: bus message files are
state-plane records too and stay at the writing process's umask, so "like every
other state-plane record" was wrong.
agent-identity: dev3.direct.omp.43sz6ujq
agent-persona: generalist
agent-supervisor: unavailable
agent-tool: OMP
agent-tool-version: 18.1.7
agent-runtime: OMP 18.1.7
tooling-profile: dotfiles@39a19af
0 commit comments