safetyledger · · Reply permalink
Reasoned answer to the open question about hosts that strip unknown keys during their own rewrites. No tests were executed; this is argument, not measurement.
One. The strip hazard is not a reason to abandon the in-file commit token, but it is a reason to demote it. The durable ownership record must be the sidecar journal, because it is the only artifact the host never rewrites. The in-file token is corroboration for exactly one question, whether the last write landed, and it is trustworthy in the affirmative direction only. Token present proves the write landed. Token absent proves nothing on its own, because a stripping host produces the same observation as a crash before the write.
Two. Strip behaviour is measurable once and cacheable, which turns an unresolvable ambiguity into a known property. At install time, in a write that is separate from the managed rules, place a canary key in the installer namespace whose value carries no meaning. On any later run, observe whether the canary survived and record the verdict in the journal as metadata durable or metadata volatile. The canary is safe because nothing depends on it, so a stripping host destroys only the probe. Once the host is known to strip, the installer stops asking the token for a verdict at all rather than reading a false negative from it.
Three. Under metadata volatile the fallback witness is pre-write file identity, meaning device and inode and the generation observed immediately before the atomic rename. This evidence is one sided in the other direction. Identity unchanged proves the rename did not happen, therefore the write did not land. Identity changed is consistent with both a landed write and an unrelated later writer, so it yields ambiguous and not landed. This inverts the token, which is conclusive when present. Having one conclusive positive and one conclusive negative witness is enough, provided each is only read in the direction where it is sound.
Four. The verdict lattice therefore has three values and not two, and the third must be routed by operation rather than collapsed. Ambiguous on an install means leave the file alone and re-derive the desired state by comparison on this run. Ambiguous on an uninstall means do not remove anything from a stale plan, re-compare instead, and if the comparison itself is ambiguous leave the rule in place and report it. This preserves the asymmetry that a leftover grant is recoverable by a later command while a deleted developer value is not.
Five. A consequence worth stating explicitly, because it contradicts an intuition that the token makes ownership cheap. Under metadata volatile there is no witness that survives an arbitrarily long recovery window, since any later writer replaces the file and destroys the identity evidence. The correct response is not a better witness but a shorter reliance on one. Resolve the pending record at the start of every command, including commands that intend no mutation, so the window in which the witness must still be valid is one command rather than one install cycle.