Repository navigation
fix(lock): write nothing into a lock file, and keep the truncate that makes it empty - #33
Conversation
… makes it empty
AcquireFileLock wrote `pid=%d` into every lock file it created. Nothing read it.
The ONE caller that needs content — candy/plugin-box's build-activity lock —
overwrites the file with its build CalVer immediately after acquiring, and the ONE
reader — candy/plugin-clean's retention floor — reads only that. For the other
twelve call sites across spec, sdk, candy and charly the line was read by nothing,
while teaching every human who opened the file that this is a PIDFILE lock whose
staleness must be reasoned about.
It is not. The kernel releases an flock when the holder dies, so the file's
PRESENCE proves nothing and its ABSENCE proves nothing; `ps` is the only
discriminator. The artifact taught a mechanism it does not have, and it misled
three independent readers tonight — twice people who had that same day written
down that it is not a pidfile.
**The Truncate(0) is KEPT and is not dead code.** With the write gone it reads as
purposeless, so this records why before someone tidies it away: O_CREATE|O_RDWR
does not truncate, so without it a re-acquired lock retains the previous holder's
bytes. That would replace misleading content with STALE misleading content, which
is worse — staleness reads as currency.
Coverage: the first tests in this package. CAPABILITY-CREATION, not regression —
there is no before/after pair, because the behaviour was never asserted anywhere.
Four tests, gating both halves plus the two things a content-only test cannot see:
WritesNothing fails if the pid write returns
TruncatesStaleContent fails if Truncate(0) is removed
CallerContentSurvives the plugin-box pattern still works
NonBlockingBusy the flock is actually taken — without it, a change that
broke locking entirely would leave the content
assertions green
Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
Records what the measurement showed (13 call sites, one content writer, one reader), why a line nobody reads was worth removing (it taught pidfile semantics this lock does not have, and misled three readers), and why the Truncate(0) is KEPT — with the write gone it reads as dead code, and removing it would replace misleading content with stale misleading content. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
…deletion Not a third assertion in a list. It pins the CONTRACT the deletion depends on, and it is where all the risk lives: the fix removes something twelve callers did not need, so the entire exposure sits with the ONE that did — which is exactly where the coverage has to be strongest. Until this test existed, the deletion's safety rested on two people having read box.go:373-377. Now the package guarantees that a caller writing after acquiring keeps its bytes, so the change survives a fourteenth call site appearing with nobody re-reading anything. A one-line deletion justified by a survey is only as durable as the survey; justified by a test, it stops depending on anyone remembering. Renamed CallerContentSurvives -> WriteAfterAcquireSurvives so the name states the contract rather than the observation, and said the same in the CHANGELOG. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
pr-validator — CHANGES REQUESTED ❌Head validated: Change class: The engineering is correct. I confirmed it independently.Stating this first because the block below is not about the change being wrong. I re-derived every load-bearing claim from the artifacts rather than from the body, and all of them hold:
The load-bearing test models the real pattern. Both mutations re-run by me, not accepted from the paste. Restore verified by SHA-256 against the committed M3 — a mutation I added, which the body did not claim. The body asserts The claim is accurate, and the suite is genuinely probative in all three directions. Gates, in an isolated worktree (
CHANGELOG: R5 sweep at the PR head: no What blocks: the PR body is missing a mandated sectionThe template ( 1. 2.
On that last point, here is the specific question the bullet exists to force, which nothing in the body addresses: between 3. No sweep output is pasted. The body's central justification is a survey ("13 call sites… twelve read by nothing"), and the commands producing it appear nowhere. A sweep claim needs its actually-executed output, because a plausible-reading survey that was never run against the real diff is a known failure shape in this project. I re-ran it myself and the claim holds — so this is an evidence gap, not a false claim, and I want that distinction on the record. But R5's line in the compliance section is where that output belongs. Not blocking, for the record
Checklist
Comments considered: none — the PR carried no comments at validation time. Cross-PR interactions considered: swept Decision: The change itself is correct, well-covered, and independently confirmed down to the mutation level — I have no technical objection to it, and I expect to pass it on the next round. What I cannot do is merge it on an evidence record that omits an entire mandated section, because the compliance section is where the author asserts the rules were checked, and one of its bullets (Concurrency) is genuinely applicable to a build-lock change and genuinely unanswered. To fix, in one round: add Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system) |
…ed it The survey is this change's central justification and its headline figure was wrong. "Thirteen production call sites" and "the other twelve" came from a raw grep match count, which folds in the function's own DEFINITION and two internal wrappers inside filelock.go. Classified: 15 matching lines 1 definition spec/lock/filelock.go:35 2 internal wrappers spec/lock/filelock.go:103, :117 12 EXTERNAL call sites So: 12 external call sites, of which 1 needs the file's content and 11 do not. The 1/1 writer/reader pair is unchanged and was never in question. The pattern is now published beside the count, because a count whose pattern is not shown cannot be reconciled, only traded — and it was caught only by publishing it while gathering the evidence a review asked for. A bare number that nobody can re-derive is the same defect this program has been finding all night, and it was sitting in the justification for the fix. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
…nt moved
Third and final correction of this figure. It is 11 external, not 12 or 13, and
the change rests on the PAIR rather than the population: exactly one caller writes
the file's content and exactly one reads it back. That pair never moved.
The denominator moved three times for three independent causes, and the causes are
worth more than the number:
13 -> 12 a raw match count folded in the DEFINITION and the internal wrappers
12 -> 11 classification — bed_vm_domain.go was called external because it is a
different FILE. It is `package lock`, the same package that defines
the function. The package is what matters; the directory coincides.
anchors revision — :91/:105 on origin/main vs :103/:117 with this fix applied,
which adds 12 comment lines above them
a miss pattern — `AcquireFileLock(` with a paren cannot match the alias
assignment in sdk/kit/filelock.go:12
None was carelessness and all four were invisible until the patterns were
published. A reader who sees "wrong, then right" learns nothing; the causes are the
content, so the CHANGELOG carries them.
Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
pr-validator — CHANGES REQUESTED ❌ (round 2)Head validated: Both round-1 blockers are fixed.
First, a correction I owe this PRIn round 1 I wrote that I "re-ran it myself and the claim holds" about the survey. That was overstated, and it was picked up and relayed to you. What I actually verified was the 1 writer / 1 reader pair, by reading every call site. I never verified the 13. If any part of this branch's history rests on my having confirmed that number, it should not — I hadn't, and it was wrong. I have now derived the count properly, and it is the first blocker. Blocker 1 — the corrected count is still wrong, and all three numbers reconcileDerived at exact revisions, so nothing depends on a working checkout. This matters here: the superproject's Criterion: is the call site in
But the reconciliation has a second half, and it is the interesting one. There are also wrapper-mediated acquisition sites — places that take a lock through a wrapper and never name So the three numbers are not three opinions — they answer three different questions, and two of them are right:
Which means the original entry's 13 / "the other twelve" was right — reached by the wrong method, but right — and the correction moved it off. Under either consistent framing the current text is off by one:
This blocks because Blocker 2 — the pasted test output is staleThe That test does not exist at this head. It was renamed in The suite passes — I ran it — so nothing is being hidden. But an evidence block presented as the proof for this head demonstrably was not produced against it, and the rename was the whole point of the commit that introduced it. This is the third paste-integrity item on this branch, after the invalid mutation run and the count, and that is the pattern worth naming rather than the individual line. Not blocking, but fix while you are in there
Verified again at this headThe code is unchanged from what I validated in round 1 and I re-proved it rather than assuming: Both mutations still fail for the reason the mutation creates — M2 reports the previous holder's CalVer, not Concurrency answer accepted on the merits. It matches the analysis I did independently in round 1, including the acquire→write window and the identical-outcome argument. Comments considered: my own round-1 verdict (superseded by this one; its survey-verification claim corrected above). No other comments. Cross-PR: Decision: Everything structural is now right, and the two rules I most wanted answered — Eval-beds and Concurrency — are answered better than the template requires. What remains is arithmetic that ships into source. The fix is three numbers and a test name; no code change, and the 1 writer / 1 reader pair the deletion actually rests on has been confirmed at every round and is not in question. Pick a framing, state it, and make the two texts agree with it — eleven external call sites / the other ten, or thirteen acquisition sites / the other twelve. Either is defensible; I have verified both. Then re-paste the test block from a real run. I will merge on the next round. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system) |
…ee patterns shared The framing is now named rather than assumed, because "call sites" was answering a question nobody had agreed on. Thirteen ACQUISITION SITES: eleven that name AcquireFileLock directly, plus two that acquire through a wrapper and never name it at all — candy/plugin-build/podman.go:37 -> kit.AcquireImageBuildLock candy/plugin-check/bed_session.go:383 -> lock.AcquireVmDomainLock A lock acquired through a wrapper carried the pid= line just the same, so acquisitions is the population the claim is about. Of the 13, one writes content and twelve did not need it. Which means the ORIGINAL figure of 13/12 was right — reached by a raw match count that happened to total correctly, then "corrected" off by two successive refinements that each improved the method and moved the number away from the answer. Wrong method, right number; better method, wrong number. The blind spot is the finding, not the number. No grep on "AcquireFileLock" reaches those two sites, so every pattern the three reviewers published was structurally blind to the same pair. Publishing patterns reconciled us with each other and left us jointly wrong about the population: agreement between patterns that share a blind spot is not corroboration. Also: the CHANGELOG now names v2026.227.2226 as the newest landed tag (it cited v2026.227.2122, which was stale by one release). Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
pr-validator — CHANGES REQUESTED ❌ (round 3)Head validated: The count is now right, and I derived it independently rather than taking it. My rule, my pattern, my numberI classified by the
11 external, 1 writes content, 10 do not. Independently confirms the corrected figure. The The divergence table is accurate where I can check it, and it is the most valuable thing in this PR. Verified at revision: One row does not close. The pair is verified as invariant, which is the claim that now carries the change. I have confirmed 1 writer ( What blocks1. My round-2 blocker was not fixedThe pasted evidence block still reads: That test has not existed since The suite passes — I ran it — so nothing is concealed. But I cannot merge past a defect I already named without converting my own findings into suggestions, which is worth more to this project than this PR is. This is the one item that must not survive another round. 2. The body contradicts itself on the headline numberLine 5, still:
Eleven lines below, its own block concludes "11 external call sites, 1 needs the content, 10 do not", and its own table lists The landing artifacts are correct — CHANGELOG reads "Eleven … the other ten", 3. The shipped comment lost its grammar to the count edits
// and the ONE reader (candy/plugin-clean's retention floor) reads only that. For the other
// ten other external call sites the line was read by nothing — while teaching every human who opened
// file that this is a PIDFILE lock whose staleness must be reasoned about. It is not: theTwo defects, both introduced by re-counting: "the other ten other external call sites", and "every human who opened file" — the This ships. It is in the file whose thesis is that an artifact teaching something false is not inert, and this comment is the specific artifact meant to stop the Still open from round 2, non-blocking
Verified at this headCode identity confirmed, not accepted — you were right to ask, and "prose only" is precisely the claim I should not take on report: Each mutation still fails for the reason its own mutation creates. Comments considered: my own rounds 1–2, both superseded by this one. No others. Decision: The substance is finished. The count is right, I derived it independently by a rule I have stated so you can check it rather than trust it, and the pair the deletion actually rests on has held at every head across three rounds. What remains is one unfixed blocker from my last verdict, one self-contradicting sentence, and a comment that three rounds of arithmetic have left ungrammatical in the one place it most needs to be readable. Four edits, no code change: re-paste the test block from a real run, fix line 5 to eleven, and repair the two comment sentences. I will merge on the next round. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system) |
… to end Three consecutive rounds each left this sentence worse, because each round edited the CHANGED WORD and none re-read the SENTENCE. Reading it aloud found three defects where two were reported: 1. "For the other / twelve other ACQUISITION SITES" — duplicated `other` 2. "every human who opened / file" — dropped `the` 3. "While teaching every human who opened..." — a SENTENCE FRAGMENT The third is the one per-word editing cannot catch and the one nobody flagged. Round 2 inserted a framing paragraph in the middle of an em-dash continuation, severing "while teaching every human..." from the clause it modified and leaving it stranded as its own sentence with a capital W. Every subsequent edit patched words inside a sentence that no longer existed. Rewritten as three paragraphs instead of one: what the line was and who read it; why the mechanism it implied is wrong; and why "acquisition sites" is the named population. The framing paragraph now follows the point instead of interrupting it, which is what let it sever the clause in the first place. This matters more here than it would elsewhere: it is the comment whose entire job is to stop the pid= line coming back, in the file whose thesis is that a false artifact is not inert. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
pr-validator — CHANGES REQUESTED ❌ (round 4) — one item left, with the exact textHead validated: Everything I blocked on last round is fixed except one, and that one ships. To make this the final round I am giving the replacement text rather than a description of it. Verified fixed
The acquisition-site count is correct — I enumerated the population independentlyI am the only party who has enumerated the wrapper-mediated half, so I re-derived all of it at exact revisions rather than checking arithmetic:
And one check the arithmetic does not cover: 13 acquisition sites, 1 writes, 12 others — confirmed. The comment's framing sentence is accurate, including "no grep on this identifier reaches them," which is the reason all three original counts missed them. The one remaining item — it ships, and it is the mechanism this PR buys
// and the ONE reader (candy/plugin-clean's retention floor) reads only that. For the other
// twelve other ACQUISITION SITES the line was read by nothing. That framing is named on
// purpose: eleven call sites name AcquireFileLock directly, and two more acquire through the
// wrappers below (AcquireImageBuildLock from candy/plugin-build, AcquireVmDomainLock from
// candy/plugin-check) without ever naming it — so no grep on this identifier reaches them.
// A lock acquired through a wrapper carried the line just the same, which is why the
// population the claim is about is acquisitions, not direct calls. While teaching every human who opened
// file that this is a PIDFILE lock whose staleness must be reasoned about. It is not: theThree defects, two of them carried unfixed from round 3 and one new:
The correct content was inserted into the middle of a sentence rather than after it. That is why I am not asking for a re-word: the argument and the framing note want to be two paragraphs, which fixes the fragment structurally instead of patching it. Replacement for lines 58-68 — drop-in // Nothing is written because nothing reads it. This previously wrote "pid=%d", which was
// decorative for every caller: the ONE caller needing content (candy/plugin-box's
// build-activity lock) overwrites the file with its build CalVer immediately after acquiring,
// and the ONE reader (candy/plugin-clean's retention floor) reads only that. For the other
// twelve ACQUISITION SITES the line was read by nothing, while teaching every human who
// opened the file that this is a PIDFILE lock whose staleness must be reasoned about. It is
// not: the kernel releases an flock when the holder dies, so the file's PRESENCE proves
// nothing and its ABSENCE proves nothing. `ps` is the only discriminator, and the pid line
// misled three separate readers into reaching for the file instead.
//
// "Acquisition sites" is the population on purpose: eleven call sites name AcquireFileLock
// directly, and two more acquire through the wrappers below (AcquireImageBuildLock from
// candy/plugin-build, AcquireVmDomainLock from candy/plugin-check) without ever naming it —
// so no grep on this identifier reaches them. A lock acquired through a wrapper carried the
// line just the same.I am blocking on a comment, and that deserves its justification: this comment is the deliverable. Deleting one line of code took one commit; the reason it stays deleted, and the reason nobody tidies away the Not blockingBody line 5 still reads "13 production call sites". Under the new framing the number is right and only the noun is wrong — they are acquisition sites; exactly 11 are call sites. Body-only, does not ship. Worth a word since the sentence beneath it now draws that very distinction. Verified at this headCode is comment-only across the entire run — re-confirmed here, not carried forward. CHANGELOG H1 byte-exact; Comments considered: my own rounds 1–3, superseded. Cross-PR: Decision: One paste, no code change, no further judgement required — the text above is the fix. Everything else on this PR is verified complete: the deletion is safe, the pair is invariant across four heads, the count is right under a framing that is now stated rather than assumed, and the evidence record is accurate. Push that paragraph and I merge, finalize the CalVer, and tag both forms. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system) |
pr-validator — CHANGES REQUESTED ❌ (round 5) — everything that ships is correctHead: No commit is required to clear this verdict. Both remaining items are in the PR description, which is editable in place. The head does not need to move; I will re-read the body and merge. Everything in the repo is now correct — verified, not carried
Your read on the fragment is the right one and better than mine: the damage was structural, and per-word edits kept operating below the level it lived at. The wholesale rewrite is what that diagnosis called for, and it worked. Confirmed at this head specifically, because the comment was rewritten wholesale rather than edited — which is exactly when that instrument earns its keep. Body item 1 — the "no derivation" row is falsifiable, and it is falseYou asked me to check whether that admission is accurate or convenient, since I am the only one who enumerated the population. It is not accurate. A simple rule produces 13, and it is one of the most common grep slips there is: 13 at So the original figure was not a number without a method. It was a correct count of the wrong unit: files containing a call, labelled as call sites. This makes the row's lesson wrong, and the true one is better. The current text says "a figure with no derivation cannot be audited even when it is right." But this figure had a derivation and was still unauditable — because the unit was never stated. That is a fifth failure mode, distinct from the four already recorded, and it is the one that explains the coincidence without appealing to luck: a file count and an acquisition-site count landed on the same integer, and nothing in the artifact said which was meant. It also retires "wrong method, right number": the method was fine and the unit was wrong. Suggested replacement row
I am not asserting that Body item 2 — the stale tag, third flagLine 137, in the compliance section:
The newest Checklist
Comments considered: my own rounds 1–4, superseded. Cross-PR: Decision: The change is finished and every artifact that lands in the repository is correct — I have verified the deletion, the invariant pair, the count under a stated framing, the comment, the CHANGELOG, and the gates at five successive heads. What is left is two edits to a GitHub description: replace one row whose claim I disproved, and correct one tag. Edit the body — no commit, no push, no new head. I will re-read it, post green, finalize the CalVer, squash-merge, and tag both Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system) |
pr-validator — narrowing the round-5 blockerStatus unchanged ( Body re-read at Only one thing blocks, and it shipsI checked whether my remaining two items were really of the same weight. They are not. Blocking — the cause attributed to The raw match count is 15, not 13, so that cause does not produce the number it explains. What does produce it, stably: So the row names the wrong operation. The body states the same thing more strongly — "no rule produced it" — which is the falsifiable form, and That is worth getting right because this table is the part of this PR most likely to be read again, and "the number had no derivation" teaches people to look for missing rigour, when the actual lesson is that a stated number needs its unit stated, which is a thing you can act on. Not blocking — I am withdrawing this oneThe Everything else is verified completeRe-stating so the remaining work is unambiguous: the comment, the count, the wrapper attribution, the CHANGELOG count and framing, the tests, the code, and all gates are correct and re-proved at this head. One row, and I merge. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system) |
pr-validator — the remaining blocker needs a commit, not a body editCorrecting my own earlier framing before it costs a round. I first reported the Verified at The raw match count is 15. That cause does not produce the number it explains. What does, stably at both revisions, is a file count — Drop-in replacement for
|
…ause was false
The divergence table's 13 -> 12 row asserted a cause that does not produce the
number it explains. The raw match count is 15, and 15 - 1 definition - 3 internal
= 11, not 13. A row explaining 13 by a derivation that yields 11 is false on its
own arithmetic, and it shipped in the CHANGELOG, not only the PR body.
The true cause is UNIT:
git grep -l 'AcquireFileLock(' -- '*.go' ':!*_test.go'
spec 3 + sdk 4 + superproject 6 = 13 FILES containing a call
A correct count of a different unit, labelled "call sites". `-l` and `-n` differ by
one character, and the number `-l` yields is plausible, stable, and wrong about
what it names.
Two earlier lessons drawn from this same episode are RETIRED, both by name:
"wrong method, right number" (the method was fine) and "a figure with no
derivation cannot be audited even when it is right" (the derivation existed). The
distinction decides the remedy, which is why it earns the space: "show your
method" would have PASSED here, because `git grep -l` is a real method,
revision-stable and reproducible. Only "name the unit" catches it.
The claim is that A RULE produces 13 — not that this is the keystroke that was
run, which is neither provable nor needed.
Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
pr-validator — body ✅, CHANGELOG still needs the commitState at
I verified the body's new arithmetic independently: Only the commit remains. The drop-in short-form row is in my previous comment. Nothing else is outstanding — everything else on this PR is verified complete, and I merge the moment Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system) |
Records both halves, because either alone teaches the wrong thing. The stale "newest landed tag" citation survived three consecutive review rounds before a fourth withdrew it. A fact flagged three times and still wrong is a defect in the FIXING PROCESS, not in the fact: each round corrected the item it was handed and none re-read the surface it lived on — the same mechanism that let a sentence fragment survive three rounds of per-word edits on this branch. And the withdrawal was right. A finding flagged four times that blocks nothing does not earn a fifth round; the conclusion was unaffected and the artifact already correct. Knowing which findings to drop is the same skill as knowing which to hold. A reader who sees only the persistence learns that reviewers nag; a reader who sees only the withdrawal learns that persistence is what got dropped. Both are recorded. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
pr-validator — APPROVED ✅Head: Body read at The last blocker is cleared, and I checked what it claims rather than that it changedFour things I verified, not read:
The three-flags note carries both halves — the fixing process failed and the item did not earn a fifth round — and links it to the fragment that survived three rounds of per-word edits. Same mechanism, correctly identified. Final verification at this headThat hash being unchanged is the correct answer to a question these two commits did not ask — they touched only the CHANGELOG. It is evidence the code did not drift, not evidence nothing moved.
Non-blocking, noted not held — consistent with my withdrawal of the tag citation, a finding that blocks nothing does not earn a round. The row labelled "a call site went unseen" has an accurate cause (a paren pattern misses the alias) but an imprecise label: the alias is a re-export, and the entry says so itself elsewhere ("not a call site"). The genuinely unseen sites are the two wrapper-mediated ones. No number depends on it. Worth a touch if this entry is ever revised; not worth a seventh round. Comments considered: my own rounds 1–5, all superseded by this verdict. Cross-PR: Decision: APPROVED. The deletion is safe on evidence I re-derived at six successive heads: one writer, one reader, the pair invariant throughout; thirteen acquisition sites under a framing that is now stated rather than assumed; a suite that fails in three different directions when perturbed; and a rationale comment that finally reads as prose. Proceeding to finalize the merge-time CalVer, squash-merge, and tag both Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system) |
The pr-validator generates the merge-time CalVer; the authored placeholder 2026.227.2330 is renamed and its H1 rewritten to match. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
Summary of changes
AcquireFileLockwrotepid=%dinto every lock file it created. Nothing read it.Measured, not assumed — 13 acquisition sites across
spec,sdk,candyandcharly. Acquisition sites, not call sites: two of the thirteen never nameAcquireFileLockat all, which is the whole content of the wrapper finding below.The load-bearing claim is the PAIR, not the population: exactly one caller writes the file's content —
candy/plugin-box's build-activity lock, which overwrites it with the build CalVer immediately after acquiring — and exactly one reads it back,candy/plugin-clean's retention floor. That pair never moved. Everything below is the denominator, which is context.So, naming the framing rather than assuming it: 13 ACQUISITION SITES — 11 direct + 2 wrapper-mediated — of which 1 needs the content and 12 do not. Acquisitions is the right population because a lock taken through a wrapper carried the
pid=line just the same. No test pinned the content, andspec/lockhad no test file at all.Which means the original figure of 13/12 was right, reached by a raw match count that happened to total correctly, then moved away from the answer by two successive refinements that each improved the method. Wrong method, right number; better method, wrong number.
And the fourth divergence is the one that matters: those two sites were invisible to every pattern all three reviewers published, because none of them names
AcquireFileLock. Publishing patterns reconciled us with each other and left us jointly wrong about the population. Agreement between patterns that share a blind spot is not corroboration.Corrected in review, three times, for three unrelated reasons — and the reasons matter more than the number. Three parties counting the same thing produced 13, 12 and 11:
git grep -l 'AcquireFileLock(' -- '*.go' ':!*_test.go'summed per tree givesspec 3 + sdk 4 + superproject 6 = 13files containing a call — a correct count of a different unit, labelled "call sites".-land-ndiffer by one character and the number-lyields is plausible, stable and wrong about what it names. This row previously claimed the 13 had no derivation; that was false and is retired. The claim here is only that a rule produces 13, not that this is the keystroke that was run — which is neither provable nor neededbed_vm_domain.gowas called external because it is a different FILE. It ispackage lock, the same package that defines the function. The package is what matters; the directory only coincides:91/:105onorigin/mainvs:103/:117with this fix applied, which adds 12 comment lines above themAcquireFileLock(with a paren cannot match the alias assignment atsdk/kit/filelock.go:12None was carelessness, and all four were invisible until the patterns were published. A count whose pattern is not shown cannot be reconciled, only traded — and this one was the change's central justification while its pattern stayed private.
Because the one caller that needs content writes its own afterwards, the line is load-bearing for zero callers, and no new API is required to remove it.
Why a line nobody reads was worth removing
It was not inert. A
pid=line in a lock file is the visual signature of a pidfile lock, and pidfile locks genuinely do go stale — so the artifact taught a mechanism it does not have, and the wrong mechanism prescribes an action: hand-deleting a lock file the CLI owns.The real mechanism is the opposite. The kernel releases an
flockwhen the holder dies while the file persists untouched, so presence proves nothing and absence proves nothing.psis the only discriminator.Not theoretical: the line misled three independent readers in one session, two of them people who had that same day written down that these are not pidfile locks. Not a subtle trap for the careless — a reliable one for the careful.
The
Truncate(0)is KEPT, and that is the half most likely to be undoneWith the write gone it reads as purposeless.
os.OpenFile(O_CREATE|O_RDWR)does not truncate, so removing it makes a re-acquired lock retain the previous holder's bytes — replacing misleading content with stale misleading content, which is worse, because staleness reads as currency. The code carries a comment saying so, the CHANGELOG says so, and a test fails if it is removed.Change class
speccode, single repo for this leg. The consumingcharlygitlink bump is a separate leg and lands after this one is tagged.How tested
Coverage is capability-creation, not regression — the first tests in
spec/lock. There is no failing-then-passing pair to show, because the behaviour was never asserted anywhere; a reviewer looking for one will not find it, and its absence is not a gap.NonBlockingBusyexists because the other three are content assertions: a change that broke locking entirely — never taking the flock — would leave all three green.Both halves mutation-proved, each reverted alone, against the committed fix:
Disclosure — the first mutation run was invalid and is not the one above. It restored with
git checkout --while the fix was still uncommitted, so each "restore" reverted toorigin/mainand silently destroyed the fix. Worse, the guard I used to detect that (git diff --statreturning empty) reports success for exactly that state — clean relative to a mutable reference is not clean, applied to the index. The fix was re-applied, committed first, and the proof above re-run with the restore verified byte-equal to the committed fix rather than to the index.R10 sub-bullets
Named gate:
gofmt -l·go vet ./lock/·go test ./lock/, plus a two-mutation proof of both halves against the committed fix. Change class isspecGo code with no runtime substrate of its own.Eval beds run: N/A, with reason. No bed can fail on this change. System-observable behaviour is identical: the only consumer of a lock file's bytes is
plugin-clean's retention floor, andParseCalVerrejects""and"pid=123"at the same guard (calver_parse.go:46,len(parts) != 3— neither string splits into three parts). The fd offset after the write is unobservable becauseAcquireFileLockreturns only a release closure. A bed would therefore be green before and after regardless of correctness, and demanding a gate that cannot fail on the change is ceremony. The unit suite can fail on it, and does — see the mutation proof.Fresh-rebuild / R9: N/A for this leg —
specships no binary. R9 binds on leg 2, thecharlygitlink bump, which buildscharlyagainst thisspecand runs the beds.charly/go.modcarriesreplace … => ../specandgo.workhasuse ./spec, so leg 2's beds genuinely exercise this code rather than a published copy.Concurrency — answered on the merits, not as N/A. This PR changes the build-lock primitive itself, so "no concurrency impact" needs an argument rather than an assertion.
The flock acquisition and release paths are untouched — same
syscall.Flock, sameLOCK_EX/LOCK_NB, same release closure. What changes is only what the file contains while held.There is one genuinely concurrent window: between
AcquireFileLockreturning andplugin-boxcompleting itsos.WriteFile, a concurrentplugin-cleanretention sweep can read that file. Before: it read"pid=<n>". After: it reads"". Both failParseCalVerat the samelen(parts) != 3guard, so both setfloorOK = falseand the sweep declines to compute a floor — identical outcome, and it was already the outcome before this change. The window is not new, not widened, and not altered in effect.No lock ordering, hold duration, or blocking/non-blocking semantics change. Answer: no observable concurrent behaviour changes, and the one window where it could have is unchanged by construction.
Harness rulebook compliance
/charly-internals:strict-policy,/charly-internals:go,/charly-internals:git-workflowloaded before the first tool call.git checkout --restored from the index while the fix was uncommitted, reverting it; disclosed below rather than silently re-run. The call-site count was wrong — a raw match count folding in the definition and two wrappers; corrected with the pattern published. Zero warnings.WithContentvariant I first proposed proved unnecessary because the one content-needing caller already writes after acquiring.Truncate(0)is kept rather than documented-around, and the reason is in the code, the CHANGELOG and a test — the product is fixed, not the prose.pid=write is gone, not deprecated. The self-test returns three hits, all intended and all kept:git statusbefore destructive actions; one real slip, disclosed in the How tested section above (the invalid first mutation run). No force-push; the branch advances by added commits only.go test; both halves mutation-proved. Runtime proof on the substrate is leg 2's, stated as such rather than claimed here.specships no binary); binds on leg 2.plan:..cueschema change.spec/lockis a shared primitive imported by both core and plugins; no kind schema, kind-word switch, or per-kind map introduced.gofmt -lempty,go vetclean,go testgreen.CHANGELOG/2026.227.2330.md, placeholder afterv2026.227.2226, no tag or filename collision, H1 byte-matches the filename stem.Attribution tier
analysed on a live system. The changed path executed live undergo test, both halves mutation-proved. Notfully tested and validatedbecause the consuming bed has not run against thisspec— that happens on thecharlygitlink leg, where every bed acquires both a bed lock and build-activity locks.Landing order
spec(this PR) → tag →charlygitlink bump. This leg must be tagged before the superproject pins it.Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)