Skip to content

Delete the unreachable mtime stamping and say why it is gone - #40

Merged
myobie merged 1 commit into
mainfrom
fix/dead-mtime-stamping
Aug 4, 2026
Merged

Delete the unreachable mtime stamping and say why it is gone#40
myobie merged 1 commit into
mainfrom
fix/dead-mtime-stamping

Conversation

@myobie

@myobie myobie commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Cleanup only, no behaviour change. Approved by cos as the part of #27 that needs no contract decision.

What was wrong

My own 62a30b8 removed the last call that stamped an origin mtime onto a materialized file. It left the machinery behind, and it left a doc comment arguing that stamping matters.

write_atomic_with_mtime had exactly one caller — write_atomic, which always passed None. The parameter was unreachable, and the comment explained the value of behaviour the code no longer had.

Same defect as the replay-buffer text in #39: a written claim that does not match the code, in a file I edited. Second one tonight, both found by reading code rather than prose.

What this does

The two functions collapse into one. write_atomic now carries the real reason stamping is gone: it made mtime a cross-node value, two contending entries of equal size could collide on size + mtime, and the scan cache then reported content the file did not hold — the permanent three-node divergence.

The comment also records the consequence, so the next reader does not rediscover it the hard way: fabric replicates no mtime at all today, so a consumer must not read a replica's mtime as an activity signal. #27 is exactly that mistake.

What I did not delete

set_file_mtime is kept and marked #[cfg(test)] rather than removed. It is not dead — the test that reconstructs the size-plus-mtime collision needs it to build that collision on purpose. Deleting it would have removed the proof that the divergence mechanism is understood. Calling it "dead code" and dropping it would have been the easy wrong answer.

Scope

This does not prejudge the #27 contract. cos is taking that to st2's owner and to Nathan, with the recommendation to put the heartbeat in the file bytes and declare metadata-only changes non-replicating.

Tests

195 lib tests green. Changed file passes rustfmt.

My own 62a30b8 removed the last call that stamped an origin mtime onto a
materialized file. It left the machinery behind, and it left a doc comment
arguing that stamping matters. Both are now wrong.

write_atomic_with_mtime had exactly one caller, write_atomic, which always
passed None. So the parameter was unreachable, and the comment explained the
value of behaviour the code no longer had. That is the same defect as the
replay-buffer text: a written claim that does not match the code, in a file I
edited.

The two functions collapse into one. write_atomic now carries the real reason:
stamping made mtime a cross-node value, two contending entries of equal size
could collide on size plus mtime, and the scan cache then reported content the
file did not hold, which is the permanent three-node divergence. The comment
also records the consequence, so the next reader does not have to rediscover it:
fabric replicates no mtime at all today, so a consumer must not read a replica's
mtime as an activity signal. Issue 27 is exactly that mistake.

set_file_mtime is kept and marked test-only rather than deleted. It is not dead:
the test that reconstructs the size-plus-mtime collision needs it to build the
collision on purpose. Deleting it would have removed the proof that the
divergence mechanism is understood.

No behaviour change. 195 lib tests green.
@myobie
myobie merged commit 1bff556 into main Aug 4, 2026
2 checks passed
@myobie
myobie deleted the fix/dead-mtime-stamping branch August 4, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant