Skip to content

CI repair: Windows failures, systemd and editor checks - #18

Draft
caparomula wants to merge 65 commits into
developmentfrom
ci-repair
Draft

caparomula wants to merge 65 commits into
developmentfrom
ci-repair

Conversation

@caparomula

Copy link
Copy Markdown
Collaborator

CI on development failed in its first run since October 14 (run 40006935606): 451 Windows test failures, one Ubuntu failure, and the systemd and editor smoke checks. These 13 commits fix them. Each commit's tree was full-built on macOS, and the Windows fixes were checked before and after in a Windows 11 VM running WPILib's x64 JDK 17.

Server fixes

  • A Windows path with a root but no drive, such as \logs\match.wpilog, is no longer refused as relative when several log folders are configured. This caused most of the 451 Windows failures.
  • Import-stage recovery reads its ownership marker only through the handle that holds its lock. On Windows, one interrupted import broke every later import, peer sync and system-log pull into that store.
  • Drives are told apart by volume serial number on Windows. A path over 247 characters made one drive look like two, so staged copies were refused and the disk budget was split.
  • A stage that another recovery removes while this one is checking it is skipped instead of failing the recovery.

Checks

  • systemd: installs all four printed units and proves the restart on the runner. The server is paused, the probe uses up its retries, and systemd must restart it. A second plant, whose probe restarts nothing, must be rejected.
  • Editor smoke: activation starts no server. Listing local logs starts it, and the server's health and version are checked at that point.

Tests

  • The REV reconsideration sharing test holds the staging thread that reconsideration now waits behind.
  • The daemon, installer, import, bridge, JVM provider and install refresh tests take ports that no other test process is handed.
  • Tests that rewrite a loaded log release it first or change bytes in place, since Windows refuses to truncate a mapped file.
  • Replaced-file identity cases run only where files have an identity. The Windows creation-time fallback has its own test, and its limit is documented.
  • Completion waits, the inventory deadline and a dead child process's lock release are sized for Windows runners.
  • The conformance sweep's teardown survives a failed setup, and the sweep now runs on Windows.

This is a draft for CI. Merging it, and pushing development, waits for the maintainer's go-ahead.

🤖 Generated with Claude Code

caparomula and others added 30 commits October 23, 2026 15:37
… handed

The daemon, installer and offline import tests asked the system for a free
port, closed it, and then had a daemon bind it or expected nothing to answer
on it. Between the close and the bind, the system could hand the same port to
a test in another Gradle fork, so full builds failed now and then and passed
on a rerun; in one run the offline import found its port answering as some
other program and refused ("did not answer as wpilog-mcp").

The ports now come from 20000 to 29999, below Linux's ephemeral range (from
32768) and the one macOS and Windows use (from 49152), in a 200-port slice for
each Gradle worker, each port checked free and handed out once.

Verified: the helper's two tests fail on two planted mistakes (every fork
given the same slice; a system-chosen port as before); the three test classes
passed twice in a row, 100 tests each; a full build of this exact tree passed,
5,264 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows a path with a root but no drive letter, such as \logs\match.wpilog,
names that file on the current drive, as any Windows program reads it, but
Java does not count it as absolute. Since 643cdfd, tool reads, source scopes
and recorded sources refused such a path with SOURCE_SELECTION_REQUIRED ("A
relative file path requires an explicit source scope") whenever several log
folders were configured, although it cannot be relative to any of them. On
Windows CI this caused most of the 451 failures, in tests that name mock logs
/test/... once a test helper had allowed the mock's folder, D:\test, beside
the fixture folder.

The rule now lives in one place: only a path with no root needs a source
chosen. Nothing changes on macOS or Linux, where every rooted path is
absolute.

Verified: a new test reads a fixture by its full path and by the same path
without its drive, with two folders configured, and is refused by bare name.
In the Windows VM the test fails without the fix, refused with
SOURCE_SELECTION_REQUIRED, and passes with it; on the Mac, where both paths
are absolute, it passes either way. A full build of this tree passed, 5,265
tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d9e3d32 moved REV reconsideration off the store queue onto the import staging
thread, but the test that two simultaneous requests share one pending result
still held the store queue. Reconsideration no longer waits behind that queue,
so on an empty store the first request could finish before the second was
made; Ubuntu CI failed once this way.

The test now holds the staging thread through an import's first progress
report, which runs there, and also requires the shared request to be still
pending while the thread is held.

Verified: planting requests that stop sharing a pending reconsideration fails
the test, and it passed 200 runs in a row; a full build of this tree passed,
5,265 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d9e3d32 added the restart service the health probe calls on failure, but
ci/check_service.py still expected the three units printed before it, so the
systemd job failed as soon as CI ran it, and nothing had exercised the restart
on a real host, as DEVELOPMENT.md said.

The check now requires exactly the four printed unit names and installs them
all. After the existing steps it stops the timer and pauses the server, whose
port stays open but silent, as a hung server's does, and requires the probe to
fail only after its retries, at least 30 seconds, and a new server process to
answer health within 30 seconds more. A second plant, with the probe's
OnFailure= removed, must be rejected, and the wiring claim check requires that
CI step.

Verified: the check's unit tests pass, and planting three units as enough, a
plant that changes nothing, and a CI job without the new step each fail them;
a full build of this tree passed, 5,265 tests with no failures. The systemd
run itself needs CI's root runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
643cdfd made the extension's local services opt-in: activation starts no
shared server, and the first request that needs one, listing local logs,
starts it. The editor smoke check still expected the server's PID file right
after activation, so it failed on both VS Code versions as soon as CI ran it.

The check now requires that activation alone starts no server, and checks the
PID file, port, health and version after listing local logs. The listing plant
now empties only the tree built from a listing, which still starts the server,
so the server and listing plants each fail at their own assertion.
DEVELOPMENT.md describes the new order and counts all seven plants.

Verified: the extension compiles and its unit tests pass, 896 of 901 with 5
skipped; a full build of this tree passed, 5,265 tests with no failures. The
editor itself runs only in Linux CI under Xvfb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g handle

Windows enforces a byte-range lock against every other handle, even the same
process's. Stage recovery read a stage's ownership marker through a second
handle twice: before taking the lock, which fails for a stage still in use,
and after taking it, which fails against its own lock. So after one
interrupted import on Windows, every later import, peer sync and system-log
pull into that store failed with "The process cannot access the file because
another process has locked a portion of the file" until the staging folder was
deleted by hand. d9e3d32 introduced it.

Before the lock, recovery now checks only that the marker is a regular file of
the magic's exact size; after it, recovery reads the marker through the
channel that holds the lock, opened for reading and writing.

Verified: in the Windows VM, reading a locked file through another handle
failed with that message, and reading through the locking handle worked. The
staging, peer-recovery and sync-recovery tests that failed on Windows CI fail
in the VM on the pushed commit too, and pass with this commit and the next. A
full build of this tree passed on the Mac, 5,265 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Four staging checks, the move check and the disk budget compared Java's
FileStore objects. On Windows, Java reaches a path longer than 247 characters
through a \\?\ prefix, and that path's store names its volume \\?\C:, unequal
to C:. A stage sits about fifty characters below its destination, so one disk
looked like two: staged copies were refused as "not on the destination
filesystem", as for a peer sync of session text into a store at
C:\Users\<name>\pit-store or a system-log pull, and the disk budget counted
the disk twice, so copies admitted through long and short paths could together
spend the capture reserve. d94c06f and d9e3d32 introduced it.

One identity now serves the staging checks, the move check and the budget's
key and lookup: Windows' volume serial number with the file system type, and
elsewhere the file store as before.

Verified: in the Windows VM one drive was (C:) through a 30-character path and
(\\?\C:) through a 261-character path, unequal, with one volume serial. A new
test that a long and a short path are one filesystem with one budget fails in
the VM with the old comparison, one disk getting two budgets, and passes with
this one; the placement and text transfer tests that failed on Windows CI fail
in the VM on the pushed commit and pass with this commit and the one before.
On the Mac a full build of this tree had one failure, a
SystemPeerRecoveryHardeningTest case that hit the concurrent stage recovery
race fixed six commits later; the trees before and after it passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows refuses to truncate, replace or delete a file while any process has it
mapped, and the server keeps a loaded log mapped. Nine tests wrote a new log
over one the server had loaded, or rewrote it to corrupt one byte, so on
Windows they failed before reaching what they test; the content-hash test's
rewrite during a scan fell back to an eager parse and failed with a class
cast.

A small fixture helper releases a log before a test writes a new one in its
place and writes a changed byte where it lies, which Windows allows through
another handle; the cached-read test keeps its log loaded. The content-hash
test now requires the lazy log it examines.

Verified: the affected classes pass on the Mac, 220 tests, and in the Windows
VM; a full build of this tree passed, 5,267 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows reports no file identity to Java, and NTFS gives a file that replaces
another the old creation time for about 15 seconds, so on Windows the
verified-hash and store-catalog tests' replacement fixtures could not make the
change they test and failed their own precondition.

Those cases now run only where the file system reports a file identity,
decided before the catalog scans: an assumption inside its scan surfaced as
the wrong exception rather than a skip. A Windows-only test checks the
fallback instead: a different creation time alone counts as a changed file.
ARCHITECTURE.md documents the window, accepted as a limitation on 2026-10-23:
there, a same-size replacement with its modification time set back is not
caught by the memory of verified hashes, which has no saved anchors.

Verified: on the Mac the cases run and the Windows-only test skips; in the
Windows VM the identity case skips and the fallback test runs and passes.
Three VM reruns pass, with the catalog's replacement case skipped there as
well. A full build of this tree passed, 5,268 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Windows runner is 6 to 16 times slower than Ubuntu on file-heavy store
work. Three tests failed there on time alone: the capture admission test's
10-second wait for 128 imports, the replica test's 120-second wait for a
300-file reconciliation, and the inventory test's 80 ms build deadline, which
also had to cover the admission it interrupts, so the interrupt landed inside
admission and the test's own signal never fired.

The completion waits are now 120 and 600 seconds, which matter only when a
test hangs, and the inventory deadline is 2 seconds.

The placement test that kills a child process holding a stage now also waits,
at most 10 seconds, until the child's lock can be taken before the next
placement. Microsoft documents that the system releases a terminated process's
file locks when resources allow, not when it exits; until then the next
placement rightly keeps the stage as live. The test failed once in six Windows
VM runs, under load, its stage kept; five reruns with recovery logging did not
reproduce it, and an idle probe found the lock free at exit in 20 of 20
trials, so the cause is inferred from that documentation, not observed.

Verified: the timing tests pass on the Mac and in the Windows VM. Three VM
reruns of the placement test passed, 10 of 10 each. A full build of this tree
passed, 5,268 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the sweep's setup failed part way, its teardown threw a
NullPointerException on the executor and saved directories the setup never
assigned. On Windows the setup failed on the drive-identity bug fixed earlier
in this series, so the sweep had not run there since that bug came in.

The teardown now restores only what the setup changed.

Verified: the sweep runs and passes in the Windows VM. A full build of this
tree passed, 5,268 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bridge, JVM provider, import command and install refresh tests each bound
a system-chosen port, closed it, and then relied on nothing answering there,
so a server in another test process could take the port in between. One full
build failed this way: the bridge reached a server it expected to be
unreachable.

They now take their ports from the per-fork slice the daemon, installer and
offline import tests use (ba567a7). Two sockets that stay open while used are
unchanged.

Verified: the five classes passed twice in a row, 29 tests each time; a full
build of this tree passed, 5,268 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two recoveries can walk the same abandoned import stage: a store's startup
recovery and an import's, sync's or pull's own. When one removed the stage
while the other was checking its path, the path check found it gone between
its existence test and resolving it, and the second recovery failed with
NoSuchFileException, failing the operation that ran it. Full builds failed
this way now and then: two of the twelve in this series before this fix did.

A stage that disappears while it is checked, or between being listed and
visited, is now skipped.

Verified: a new test's path check removes one of two abandoned stages in the
middle of checking it and throws as the real check does; the other stage is
still recovered, and planting the old behaviour fails the test. The staging
and peer recovery tests pass on the Mac, 20 tests. In the Windows VM the
staging tests, the new one included, and the peer recovery tests pass. A full
build of this tree passed, 5,269 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In CI the editor check now gets past activation and the server start, then
finds no fixture in the Logs tree, and its failure said only that. The tree
lists a connection, its source scopes, and their logs, and an error at any
level is a note the search walks past, so the message gave no reason. The
assertion now lists every item the search visited, with its kind, label and
description, notes included.

Verified: the extension compiles and its unit tests pass, 896 of 901 with 5
skipped; the editor itself runs only in Linux CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The walk the check now reports showed why it found no fixture: under "This
laptop" the only item was a note, "This operation was aborted". Listing local
logs starts the shared server, and a refresh that follows, from the server
starting or VS Code connecting its MCP server, cancels every listing in flight
and tells the tree to ask again. A tree view does ask again; the check asked
once and kept the cancelled answer.

The check now lists again every half second until the fixture appears or 30
seconds pass, and still reports the last walk if it never does.

Verified: the extension compiles and its unit tests pass on Node 26, 896 of
901 with 5 skipped; the editor itself runs only in Linux CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t the error

When a server reply went over the MCP client's or the follow client's byte
limit, the refusal settled the request and then destroyed it with the error.
If the whole reply had arrived in that chunk, Node 20 and 22 had already freed
its socket, and destroying with an error threw that error there with no
handler: an uncaught exception in the extension host. Node 26 no longer does
this, so the extension's tests passed on the Mac and failed in CI, which runs
them on Node 20.

Both refusals now settle first and destroy the request without the error.

Verified: a script destroying a finished reply with an error throws uncaught on
Node 20 and 22 and not on 26; the two byte-limit tests fail on Node 20 without
the fix, as in CI, and with it all extension tests pass on Node 20 and 26, 896
of 901 with 5 skipped; the changelog checks pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The editor check now reaches the custom editor step, and failed it: since
643cdfd a log opens as a source document, wpilog-source://<connection>/<name>
with the connection, server, scope and path encoded in its address, and the
check still compared the tab's file path with the fixture's. It now requires
the source scheme and decodes the address with the extension's own reader, as
the editor does, before comparing the path.

Verified: the extension compiles and its unit tests pass on Node 20 and 26;
the editor itself runs only in Linux CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The store control client (8 MiB) and the laptop upload (1 MiB) only destroyed
the request when a reply crossed its limit, with the error. A reply that had
already arrived whole still ended: the store client then parsed the part
under the limit and the upload resolved with it, and on Node 20 and 22 the
destroy's error was thrown as an uncaught exception, as in the MCP and follow
clients fixed before this.

Both now refuse at once, destroy the request without the error, and ignore the
end of a refused reply. Each limit is a parameter with its old default, so a
test can send a reply over it in one piece.

Verified: new tests send 1,025 bytes in one piece against a 1,024-byte limit;
with the old code each fails on Node 26, the reply not refused for its size,
and on Node 20, an uncaught exception; with the fix all extension tests pass
on both, 898 of 903 with 5 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The editor check now passes six steps on both VS Code versions and stopped at
the pit registration: since 643cdfd the extension registers the pit server as
Claude Code's own HTTP server, mcp add --scope user wpilog-pit --transport http
<url>, with no launcher, while the check still expected the older stdio bridge
through the launcher. The arguments it checks for are now the HTTP form; what
it proves is unchanged: one user-scope URL, no key, password, header or local
path. The pit-secret plant now adds a synthetic secret header to that
registration; before, it changed the bridge function the pit command no longer
calls, where no check could catch it.

Verified: the extension compiles and its unit tests pass on Node 20 and 26; the
editor and its plants run only in Linux CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On VS Code 1.101 the editor check and all seven plants now pass, and the job
still failed: VS Code names an MCP server's output log after the server's
label, "WPILog: This laptop [local]", and the evidence upload refuses a colon
in any path, since NTFS cannot store one. The upload now excludes file names
with a colon; they could not be uploaded anyway, and every other log is kept.

Verified: the workflow still parses for the wiring claim check; the upload runs
only on GitHub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows releases a terminated process's file locks when resources allow, not
when the process exits, as LockFileEx's documentation says. Tests that killed
a child holding a lock and took it at once failed there now and then: in CI's
Windows runs the peer recovery test found "A sync is already running for this
store" (its sync ownership lock, in two runs), and the capture recovery test
kept a capture the dead child had owned.

One fixture helper waits, at most 10 seconds, until such a lock can be taken,
and fails with a message naming the file if it never can. The peer recovery
test waits for every .owner.lock under its store, its sync lock and stage
markers alike, and the capture recovery test for the capture's writer lock.
The placement test's own copy of this wait, added earlier in this series, now
uses the helper.

Verified: the three classes passed three times in a row in the Windows VM and
pass on the Mac; a full build of this tree passed, 5,269 tests with no
failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The session expiry test expired every session with no idle allowance right
after a request, and expects the old session gone. Expiry removes a session
whose last use is strictly before now; in the Windows VM Instant.now() moved
in steps of about a millisecond, so the last request and the expiry read the
same instant and the session stayed. The test failed on three of five finished
Windows CI runs.

A package-private overload expires sessions as of a given moment, and the test
uses a second after its last request; the product's expiry is unchanged.

Verified: the test failed in a full Windows run in the VM and passed three
times in a row with this change; a full build of this tree passed, 5,269 tests
with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
While the recorder rolls files over, the server's catalog read can see the
store change on each of its attempts and refuse with "Store changed while
reading its catalog; retry the read", a refusal it marks retryable. The test
opened its reads once and failed on two of five finished Windows CI runs.

It now retries such a refusal every 250 ms for up to 10 seconds, as the
documented client rule retries temporary refusals.

Verified: the class passed three times in a row in the Windows VM and passes
on the Mac; a full build of this tree passed, 5,269 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The transport keeps an inventory reply's reservation until it has written the
reply, by design, and releases it when the request's response scope closes,
after the socket write. A client can therefore hold the reply first. The
inventory refusal tests read the reservation count the moment the reply
arrived, and the Windows CI runner once saw 2 MiB still held.

They now wait, at most five seconds, for the count to reach zero before
asserting it; a reservation that is never released still fails them.

Verified: planting a response scope that releases nothing fails 18 tests,
these two among them; the class passes on the Mac, 35 tests, and three times
in a row in the Windows VM; a full build of this tree passed, 5,269 tests with
no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The metrics-stack check preloads the documented images from Quay and
Google's Docker Hub cache. In CI run 40076220041 Quay answered one pull of
the Prometheus image with 503 Service Unavailable, and the check failed a
run whose 5,278 Ubuntu tests had all passed. A refused pull is now tried
twice more, ten seconds apart, before the check fails.

Verified: two new unit tests, a pull refused twice and then accepted, and
one refused three times, fail when the check makes one attempt, swallows
the third refusal, or does not wait between attempts; the CI Python suite
passes; the real check passed on Linux (cpc) with Docker in 17 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…irror

A cold reconciliation, such as the first after a restart, rechecks each
confirmed held file that the remembered hashes do not cover, as a job on
the transfer worker. Every job measured the whole mirror before and after
its work: it read the catalog, resolved every file's path and sized every
file. The rechecks therefore made a pass grow with the square of the
mirror's files. 300 held files took 9.4 s on CI's Ubuntu runner and timed
out after 600 s on its Windows runner; thread samples in a Windows VM found
the transfer worker in that measurement throughout.

A recheck only reads and hashes, so it no longer measures, unless the
journal makes it finish an interrupted transfer first, which writes: then
it measures and reserves as before. Jobs that write are unchanged.

The reconciliation test now bounds how often a pass measures the mirror,
and waits 120 s again, as it did before the Windows runner's timeout raised
the wait to 600 s. A new test interrupts a transfer, reopens the store and
rechecks a held file first: under a budget too small for the recovery the
recheck is refused with CAPACITY_PAUSED and leaves the journal unchanged,
and under the normal budget it recovers and reports the file unchanged.

Verified: the same reconciliation at 300, 600 and 1,200 held files took
1.1, 2.2 and 4.5 s on the Mac, measuring the mirror 26 times at every size.
In the Windows VM 300 and 600 files took 14.9 and 30.4 s, and in a rerun
while the Mac was building, 24.8, 41.8 and 103 s for 1,200. The 300-file
test takes 1.0 s on Linux (cpc), 1.4 s on the Mac and 17 s in the VM,
where it took over ten minutes before. Planting rechecks that measure
again fails the bounds test, and planting a recovering recheck that does
not measure first fails the new test. A full build of this tree passed,
5,270 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sks for

A capture's close completes and then asks for its clock record, which one
background worker that every store shares reads and writes later. The
replica publication tests went on as soon as the close completed. When the
record's write landed after a test had restored the store's header, the
catalog had room again and published the record too: on the Windows CI
runner, the retry test counted three published files where it expects the
import and the capture, while its other assertions passed.

The tests' capture helper now waits for that pass, so the record's write is
attempted while the catalog is still full and is refused, as the tests
assume.

Verified: holding the clock worker until after the header restore made the
test publish the import, the capture and the capture's clock record. In a
Windows VM, 30 repetitions of the test failed 18 times, each with the clock
record as the third file, and never with the wait; the class passes on the
Mac, 17 tests. A full build of this tree passed, 5,270 tests with no
failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The read API marks each 409 and 413 refusal with a boolean retryable and
tells clients to decide by it, never by the message; the extension does.
The Java client in the wpilog-reader library rebuilt every refusal it
received over HTTP from the code and message alone, so retryable() was
always false. The FILE_CHANGED that a catalog read returns while a
recording rolls over, with "retry the read" in its message, looked
permanent, and so did a busy reply. The session transfer test's retry
helper asks the client, as a program would, and on the Windows CI runner
it gave up at once, 0.75 s into the test.

The client now keeps the flag. A missing flag, from an older server, still
means false; a flag that is not a boolean is an invalid response,
MALFORMED_RECORD, as the extension treats it; and a busy reply (HTTP 503
or 429) is a retryable BUSY. A refusal at the end of a stream that has
already started carries no flag from the server and stays not retryable.

The wire test checks each case, the catalog refusal test now reads the
real endpoint's refusal through the real client, and the overload test
asserts the flag its name promises.

Verified: planting a client that drops the flag fails the wire and round
trip tests, a busy reply that is not retryable fails the wire and overload
tests, and an unchecked flag fails the wire test. The read, client and
session transfer tests pass on the Mac, on Linux (cpc, 50 tests) and in a
Windows VM, where the transfer test also passed 20 times in a row; in
one of them it met the refusal that failed CI, retried it and went on.
A full build of this tree passed, 5,271 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every mirror in a server shares a limit of two transfer jobs at a time,
one per mirror, and a third is refused as busy. The limit was a pool of
two threads with no queue, so it counted threads. A job's thread wakes
the caller waiting for its result and only then returns to the pool. A
caller that asked for its next job in between, while the other thread
was in the same state, was refused although nothing was running, and the
mirror pass ended partial. Since a held file's recheck takes a few
milliseconds (836e39f), the next job follows the last almost at once:
pinned to one CPU, the reconciliation test failed in 3 of 4 runs, with
both threads inside the call that wakes the reconciler, and it failed
once on CI's Ubuntu runner.

The limit is now two permits for jobs. A job returns its permit before
it reports its result, so the caller it wakes can start the next job at
once, and jobs run on a pool that never refuses. The limit itself, the
refusal of a third job and the absence of a queue are unchanged.

Verified: a new test holds two finished jobs' threads inside their
completion, as a busy machine can, and starts a third job; it fails on
the previous code and passes now. Planting a permit kept until the
thread is done fails it, and planting three permits fails the existing
test that a third concurrent transfer is refused. Pinned to one CPU on
Linux (cpc), the reconciliation test passed all 6 runs, where it failed
3 of 4 before; the transfer and reconciliation tests pass in a Windows
VM. A full build of this tree passed, 5,272 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A server with a disk cache first resolved its cache directory in the
cleanup that runs on a background thread at startup, which creates the
directory and logs "Cache directory: ...". A server that stopped at once,
as the extension's cache tests start it with an empty input, could exit
before that thread ran: on the Windows CI runner one of those tests found
neither the directory nor the line. Delaying the cleanup thread by two
seconds made both cache tests fail every time on the Mac.

The server now creates and reports the directory on the main thread
before it serves anything; the cleanup still runs in the background. A
directory that cannot be created is still reported by the cleanup. The
scan index's guard lists the disk cache's source among its inputs; the
change leaves how a log is scanned and how an index is encoded, read and
trusted untouched, and the reviewed baseline records that decision.

Verified: with the cleanup thread delayed by two seconds, both cache
tests now pass; the startup tests pass in a Windows VM; a full build of
this tree passed, 5,272 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
caparomula and others added 30 commits October 25, 2026 17:08
A mirror's timer runs syncNow at its interval. When a tick found the
transfer owner busy with another job, reconciliationEpoch threw an
IllegalStateException, LogStore.mirror rethrew it, and it left syncNow
before the completion handler that clears the service's busy flag was
attached. The flag stayed set, the status read "synchronizing", and the
scheduler never ran the task again, because scheduleWithFixedDelay stops
a task that throws. The mirror silently stopped synchronizing until it
was disabled. The owner is busy past a job's result whenever an idle
timeout or a cancel completes the job early, and disabling a mirror then
configuring the same folder starts a new service whose first tick runs at
once. migrate had the same hole for a call that throws.

Busy is now an answer, not a failure (rule R3 of the concurrency review):
reconciliationEpoch reports it as ReplicaTransfers.NotStarted, LogStore
returns that as a failed future, and a tick that meets it leaves the
status as it was and lets the next tick retry. The service's busy flag
and its state are one atomic phase, so a job's completion and the next
job's admission are one write (R1); before, the state was published
before the flag cleared, and a client acting on it could be refused.
Every path out of a sync, migration or maintenance releases the phase,
and the timer's task catches everything.

Verified: three new tests, a busy tick then an admitted next tick, a
synchronization that throws while the 1 s timer keeps ticking, and a
maintenance request sent the instant a sync completes, each fail on a
planted mistake: the synchronous failure leaving the phase running, a
busy tick reported as an error, the store throwing busy again, and the
completed state published 300 ms before admission is released. The
mirror, replica and endpoint tests pass, 85 tests. A full build of this
tree passed, 5,275 tests with no failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
HttpTransport.stop() closes the follow and read owners first and drains
requests in flight afterwards. A follow page already past admission then
met owners being torn down beneath it: the session grants, the store
door, its workspace's source catalog. Each failed in its own words, and
the page reported them as permanent: an AccessDeniedException ("Recording
store is no longer configured") became 403, and "SOURCE_UNAVAILABLE" or
"Source catalog is closed" became a non-retryable 409. The extension stops
following on both, so in a Windows VM all four views open across a server
replacement stopped for good; on Linux the old connection happened to
close first. Native reads and data requests admitted before a stop met the
read endpoint's retired catalog, which reported itself as no store at all
(an empty catalog, 403 or 404), and a body read after the stop lost its
reply to an uncaught RejectedExecutionException.

A follow caught by the stop now ends with 410 CLOSED whatever failed
beneath it, the answer a parked follow already gets; the follow endpoint
decides this, since it knows it is stopping and its owners do not
(rules R2 and R3 of the concurrency review). The workspace's closed
source catalog raises a typed CLOSED refusal. The read endpoint's catalog
lease says when it is closing, and read and data requests that meet it,
or fail after the stop, receive 503 CLOSED, as new requests during the
stop already do. This fixes what each interleaving answers; the order of
the stop itself is stage 2.

Verified: a follow held inside its per-page check while the endpoint
closes ends with 410 for each of the three failures, and without a stop
an access refusal still answers 403; a catalog request and a data range
admitted before the stop receive 503; the transport test now pins 410 for
every parked follow. Planting a follow endpoint that never answers the
stop, a catalog route or data range that ignores the closing lease, or a
read endpoint that never reports closing fails those tests. In a Windows
VM with a short 8.3 TEMP, the extension's broker test, which replaces the
server under four open views, now passes; before, all four views stopped
with 403. It passes on Linux too, with the follow, read and data tests,
in both places. A full build of this tree passed, 5,281 tests with no
failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
Capture startup runs the capture store's recovery and then the store's
publication recovery, and tolerated only a complete recovery that leaves
publication pending. Any other failure stopped capture until the server
restarted. That was decided for unsafe or corrupt recovery, but passing
conditions failed the same way: another process holding store.lock (for
the capture store's recovery, after its 30-second deadline), the store's
queue busy past that deadline, a receipt or intent rewritten while
recovery read it, and most often a manifest write renaming its temporary
file while the recovery's walk of the store had it listed: Files.walk
threw, and the pass ended as unavailable. The walk also counted every
path in the store toward its 32,768 bound, so a store holding more files
than that could never start capture.

A StoreBusyException now types the passing conditions, with a fixed code:
store.lock's Held refusal, a store turn's deadline, and the receipt and
intent rechecks. Startup tries each step again after a second, doubling
to at most 30 seconds, until it succeeds or capture stops; a stop ends
the wait at once. While it waits, /health reports the capture stopped
with reason waiting_for_store and a cause (lock_held, queue_busy or
record_changing), and once recovery succeeds the status is what a
startup that never waited shows. Unsafe recovery and a closed store stay
fatal.

The recovery walks the store with a walk that hands back an entry that
vanished once listed. A temporary manifest is skipped. Anything else that
moves, a session folder above all, may carry a marker past the walk, so
the pass reports itself incomplete and busy, never complete; an unsafe
failure in the same pass outranks a busy one. As decided, the bound now
counts session folders, the folders markers are written in, plus any
other folder where a marker is found; the store's other files cost the
walk a listing, never an inspection. Explicit recovery reports the same
bound. The read library, which packages the receipt recovery code, now
carries the new type, and the operations guide's claim check knows the
new status words.

Verified: with store.lock held when the publication pass starts, capture
waits with cause lock_held and starts once the lock is released; a stop
during a 60-second wait ends startup at once; the retry delays run 1, 2,
4, 8, 16 and then 30 seconds. A temporary manifest renamed over its
manifest once listed is skipped; another entry vanishing leaves the pass
busy and the next pass completes; a receipt rewritten between inspection
and the locked retry is busy; fifty other files cost the bound nothing
while a marker outside a session folder counts. The existing tests that
an unsafe intent or receipt still stops startup, and that a closed store
reports startup_failed, pass unchanged; the test of the walker's real
bound now creates one session folder past it instead of 32,768 files,
and still sees recovery stop with RESOURCE_LIMIT and the same status.
Twelve planted mistakes (no
retry, a stop that does not end the wait, the walk failing on a vanished
entry, every vanished entry skipped, the bound counting every path or
not counting markers elsewhere, the first failure winning, no cap on the
delay, lock contention or a rewritten receipt not busy, the waiting
status never set or never cleared) each fail the test meant for it.
A full build of this tree passed, 5,289 tests with no failures. A full
Linux build failed only the three checks fixed above before they were
fixed; with them, those checks and the new tests pass on Linux too. In a
Windows VM, 87 store and capture tests pass, the new ones among them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
The inbox never retried a refused file that had not changed, and local
ingestion stored a refusal receipt that it reused after a restart. Several
refusals were passing conditions: the store lock held by another process,
the store's metadata changing while an import was prepared or published,
the disk budget's accounting changing during admission, the space kept
free for recording, another import moving the file or readers still
holding it, and imports stopping during shutdown. They reached both
callers as message text with no type, so a log that arrived while the
store was briefly busy was never imported (review finding 5, rule R3).

An import outcome now has the status deferred, decided by type where the
cause is known, never from the reason: a StoreBusyException (store.lock's
refusal, the three metadata races, now typed where they are thrown, and
the disk accounting race), the log layer's new InUse (another import
moving the file, a reader or capture still holding it) and BeingMoved (a
read that meets another import's move; still a LogFileException, so the
endpoints answer as before), the disk budget's CAPTURE_DISK_RESERVE code,
and the store stopping. Every other cause stays refused.

As decided, the inbox returns a deferred file to waiting with its reason
and tries it again five seconds after the poll that admitted it, doubling
to a minute; imported.log records each attempt. Local ingestion writes no
receipt for a deferred file, so a restart tries it again, and it waits
out the same backoff, both for a deferred file and for a batch whose
whole import met a busy store; the sources view shows the file as waiting
with its reason, so no new state appears there. The import command exits
1 for a deferred file as for a refused one, and the extension's import
summary counts deferred files when there are any. Refusal receipts
written before this release keep their state until the source is scanned
on request or the file changes, since their reasons are only text.

Five existing tests expected refused for causes that are now deferred: an
active reader, a tool call still holding the log, the recording reserve,
and candidates changing after preparation, twice. Each still checks that
nothing was placed and the source stayed. The local ingestion test of an explicit retry used another
import's move as its permanent refusal; it now uses bytes no reader
accepts, made valid at the same size and time, so it still checks that
idle scans and restarts leave a real refusal alone.

Verified: with store.lock held, an inbox file is deferred with its reason,
waits five seconds and then ten, and is imported once the lock is free;
local ingestion defers a batch that meets the held lock and imports it
after its wait, not before; a file another import is moving is deferred
with no receipt, tried again after five seconds, and imported by the
restarted service; the import command exits 1 for it; the classification
keeps a reason's words from deciding, and the waits run 5, 10, 20, 40
and then 60 seconds. Ten planted mistakes (lock contention refused, the
inbox keeping a deferral as refused or ignoring its wait, local ingestion
recording the deferral or ignoring its wait, a read that meets a move or
the recording reserve refused, a deferred batch retried at once, a wait
that does not double, a deferred file passing the command) and a summary
without its deferred count each fail the test meant for them.
A full build of this tree passed, 5,295 tests with no failures. A full
Linux build failed only the tool-call test before it was updated; with it,
that test and item 4's tests pass on Linux, as do the extension's tests.
In a Windows VM, 121 import, inbox and ingestion tests pass, and so
do the extension's tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
…leases

HttpTransport.stop() kept the listener accepting during its five-second
drain, so new MCP calls and data requests began while the follow, read and
replica owners were closing, and met them closed. The drain counted a
streaming request only once a worker ran it, and an MCP inventory read was
uncounted between its MCP worker and its stream worker. The stop
interrupted tool calls and stream workers instead of awaiting them; an
interrupt closes any file channel the thread is reading, which other
readers of an open capture may share. A second stop() returned at once, so
a signal arriving during a stop request or an idle exit made the shutdown
hook close capture and the log manager under the first stop. The idle exit
ran its stop on the session-cleanup scheduler, and the stop's shutdownNow
of that scheduler interrupted the very thread running it: every later wait
returned at once, and the store's final barrier was skipped. A call still
running after the stop could also rebuild the visualization workspace,
whose orphan kept the state lock (review finding 8, rule R2).

The stop now follows R2's order. An admission gate wraps every route: once
the stop begins, a new request gets 503 with Retry-After: 1 and code
CLOSED, while /health and /stop still answer. Each request is counted from
its admission until its response is complete; the stream pools and the
MCP pool join that count before they hand a request to a worker. The drain
gives byte streams five seconds, then ends each at its next network write,
interrupting only a worker blocked on the network, as a silent peer's
deadline already does. Tool calls may run until the stop's deadline of 80
seconds, as decided; past it, the log names what still runs and the
executors' shutdown interrupts it, so the process ends before the 90-second
kill. Only then are the listener, executors, workspace, sessions and
stores released. One stop runs, and a later caller waits for it. The idle
exit runs its stop on its own thread, as a stop request does. A closed
workspace is not built again until a transport starts serving; a build
that races the close gives way to it.

Five idle-exit checks (three in HttpTransportTest, one each in
StoreImportEndpointTest and StoreInboxTest) now wait for the exit's thread
instead of checking at once, and VisualizationSseLifecycleTest looks for
the drain under its new name.

Verified: a request arriving during the stop gets 503 with Retry-After 1
and code CLOSED, a data request too, while health answers 200; a tool call
that outlasts the stream grace still completes with its response and is
never interrupted; a second stop returns only after the first; past a
300 ms deadline the stop ends and interrupts the held call; the idle exit
runs on its own thread and its stop is not interrupted; a closed workspace
is not built until it is opened again; a streaming request is counted from
its hand-off until its worker finishes. Seven planted mistakes (the gate
left open, the drain ending at the grace, a second stop returning at once,
no interrupt past the deadline, the idle exit on the scheduler's thread, a
close leaving the workspace open, a hand-off left uncounted) each fail the
test meant for them.
A full build of this tree passed, 5,302 tests with no failures, and so did
a full Linux build. The extension's broker check, which replaces the
server under four open views, passes on Linux and in a Windows VM. There
the transport tests pass too, except two HttpAdmissionTest cases that fail
with a connection reset on that VM with or without this change, three
runs of each; CI's Windows runner passes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
StoreRegistry.close() closed the disk-space owner first and only then
stopped each store's imports. An import still running when the server
stopped could therefore fail with "Disk-space owner is closed" while its
store did not yet know it was stopping, so the failure was recorded as
refused, not deferred, and folder synchronization kept that refusal
receipt after the restart: the file was never imported (review finding 8,
rule R2: refuse, drain, release).

The registry now stops every store's imports and local ingestion, waits
for the store watcher and the imports, and only then stops the disk
sampler and closes the disk budget, then the stores. An import the stop
catches is deferred, since its store already knows it is stopping.

Verified: when the disk budget is about to close, both stores of a
registry have already stopped their imports; planting the old order,
where the budget closes while imports still run, fails the test.
A full build of this tree passed, 5,303 tests with no failures. A full
Linux build of the next commit's tree, which contains this one, passed,
and the registry tests pass in a Windows VM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
DaemonManager ended a server that had not exited 10 seconds after its stop
request, the start timeout, and its Javadoc assumed the server needed half
of that. A stop could take about 70 seconds, and it now has its own
80-second deadline, so wpilog-mcp stop, a restart or an upgrade could kill
a server still finishing its calls. The launcher also sent the stop
request, which can wait seconds for its answer, while holding its
cross-process start lock, contrary to its Javadoc, so a concurrent start
or status check waited for the server's answer.

As decided (D3), a stop now waits 90 seconds before ending the process,
the pit server's systemd TimeoutStopSec. The start timeout stays 10
seconds, and the test constructors that pass a timeout still use it for
both waits. The lock is held only to check the record and mark it
stopping; the request and the wait for the exit happen outside it. A
claim check ties the stop timeout to the systemd unit and to the server's
stop deadline, for which HttpTransport.STOP_DEADLINE is now public. The
extension already allows its launcher commands 120 seconds.

Verified: a server that exits 800 ms after the request is not ended,
though that is past a 100 ms start timeout; while a stop request waits for
its answer, a status check takes the lock at once; the stop timeout equals
the unit's TimeoutStopSec and exceeds the server's deadline. Planting the
start timeout as the stop's wait, the request under the lock, or a
60-second stop timeout fails the test meant for it.
A full build of this tree passed, 5,306 tests with no failures, as did a
full Linux build. In a Windows VM the launcher, registry, import and
ingestion tests pass, 122 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
CaptureService.close() waited at most 30 seconds for the NT4 client's
close, the pull's, the gateway's and the providers', then for the writer's
admissions and the placement's completion (review finding 8, rule R2).
Several of those completed before their work had ended. The client's
close completed before the tasks queued behind it on the loop had run.
The pull's completed after its remote close while a transfer step was
still running; a busy transfer only records the close request, and that
step writes the checkpoint as it unwinds. The placement completed the
final manifest's future before asking for the closed file's clock record,
so a close could not wait for it. The providers' close covered only the
SSH hosts. Main then closed the log manager and the stores under whatever
still ran.

The close now waits, until the whole stop's 80-second deadline, which the
HTTP server's stop passes to it (closeBy), for the providers' statistics,
tail and PhotonVision workers, the pull's last step and checkpoint, the
writer's admissions, the final manifest, settled clock records, and the
loop's last task. The last file's clock record is among the settled ones,
since the placement now asks for its pass before it completes. A
ClientScheduler offers terminated(), completed once the loop has shut down
and run its last task, so these owners wait without threads of their own;
a test's scheduler has nothing to wait for. JMX's RMI call stays unjoined,
as the pit server guide already says: it can block as long as the robot's
network does, and it delivers only through the closed capture loop. A
close without a server stop keeps its 30-second bound. An identity the
pull learns during the stop no longer throws on its thread once the loop
has shut down.

Verified: the close returns only after the loop's end, which a test
holds, and only after a clock pass running for its store, held by a new
probe at each pass's start; the pull's close completes only once a step
still running on its worker has ended, and the providers' close only once
the statistics worker has ended; when the final manifest completes, the
closed file's clock pass has already been asked for. Five planted
mistakes (the manifest completing before the pass is asked for, the
close not waiting for the loop or for clock records, the pull's close not
waiting for its step, the providers' close covering only SSH) each fail
the test meant for them.
A full build of this tree passed, 5,311 tests with no failures, as did a
full Linux build. In a Windows VM the capture, pull, provider and
transport stop tests pass, 65 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
The operations manual's start and stop section said only that a stop
finishes the calls in progress, and the pit server's said the stop waits
at most 30 seconds for the writer. The stop changed in this series: a
call may take up to 80 seconds, after which the server names it in its
log and ends it; the launcher ends a server that has not exited 90
seconds after the request; a request arriving during a stop is answered
503 and retried while health still answers; and capture's close also
writes the recording's clock record within the same deadline.

Verified: the documentation and claim checks pass, 50 tests in 8 classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
…h run

junit-platform.properties sets the @tempdir cleanup mode to NEVER: on
Windows a memory-mapped log stays locked until a garbage collection, so
JUnit's deletion failed and failed the tests. Every @tempdir therefore
stayed in the system's temporary folder, on every platform, for good. On
cpc, whose /tmp is a 15 GB memory file system, three days of builds left
32,306 of them holding more than 10 GB, and the next build failed 1,450
tests with I/O errors. This Mac's temporary folder held 64,171, 20 GiB,
all from one day.

Each test task now sets its JVMs' java.io.tmpdir to
build/test-tmp/<task>, so every @tempdir, and every temporary file a
test or the server under test creates (the CSV export folder among
them), lands there. Following the build's scratch rule, the task empties
its folder before its tests start and deletes it after a passing run; a
failed run keeps it for diagnosis, and a later task's run leaves it
alone. The cleanup mode stays NEVER. BuildScratchTest knows the new list
and checks that every test task sets the folder, empties it first and
deletes it after a pass, and a new check confirms that a test's
temporary folder is its task's folder under build/. Folders that earlier
builds left in the system's temporary folder stay there.

CI's Windows JVM tests no longer see the runner's 8.3 short temporary
path (C:\Users\RUNNER~1\...). The extension's tests and the follow
broker check use Node's temporary folder and still do.

Verified: full builds of this tree passed on the Mac and on Linux, 5,312
tests each with the CI Python suite. Neither created a junit folder in
the system's temporary folder (none appeared in the Mac's after the
build began, and none newer than a marker made at the start on Linux),
and each left build/test-tmp empty. A run made to fail kept
build/test-tmp/test with the file its test left there. Planting the
system's temporary folder for the tests, or a passing run that keeps its
folder, fails the check meant for it. In a Windows VM whose TEMP is an
8.3 short path, as on CI, a full build of this tree left no junit folder
there; its four failures need an elevated user or fail under the VM's
x64 emulation, and fail the same way on the tree before this change.
With those excluded, a full build of the next tree, which changes only
two tests, passed in the VM and left build\test-tmp empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
…s thread

CI run 40263620867 failed ContextProviderStateTest's journal case on
Ubuntu: the test asserted that the providers' close had completed the
moment it returned. Since eb44c0e the close also waits for each tail
provider's control worker to end. ContextProviders makes that worker
itself, as a real daemon thread even in these tests, so the close
completes on that thread a moment later. The tail period test and the
tail admission test now wait for the close, at most five seconds,
instead of asserting that it has already completed. The other tests that
assert a completed close have no tail and no PhotonVision provider, and
their close still completes before it returns.

No test shows that the close waits for the tail's worker in particular:
ContextProviders creates that worker itself, so a test cannot hold its
end the way the statistics worker test does.

Verified: with the worker's end planted 300 ms after its shutdown, the
old assertion failed all four cases (the three tail roles and the
admission test) and the new wait passes them; with an end that never
comes, all four fail at the five-second bound. Full builds of this tree
passed on the Mac and on Linux, 5,312 tests each. In a Windows VM a full
build passed, 5,282 tests, with the tests excluded that fail there
without this change: they need an elevated user, fail under the VM's x64
emulation, or meet a follow admission race that is reported separately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
A read that found the store's files changing while it listed them listed
them again at once, and if they had changed again it refused with a
retryable FILE_CHANGED. A store moves in bursts: when a robot
disconnects, capture closes its file and writes the file's placement and
then its clock record, so a second listing made at once could land
inside the same burst. On Windows CI a health check sent just after a
disconnect met exactly that, and LiveSourceTest failed (CI run
40263620867).

The refresh owner now waits RESCAN_PAUSE, 50 ms, before its second scan,
on its own thread: a request's or a tool call's, never a loop's. A stop
that interrupts the wait ends the read with InterruptedIOException and
keeps the interrupt for the caller. A store still moving after the pause
is refused as before, so clients still follow the retryable answer.

Verified: a new test makes one burst of two writes, the first during the
first scan and the second just after it. With the pause the read returns
the settled store; without it the second write lands in the second scan
and the read is refused. Another test interrupts the pause. Planting no
pause, an ignored interrupt or a dropped interrupt flag each fails the
test meant for it. Full builds of this tree passed on the Mac, 5,314
tests. On Linux it had one failure, HttpAdmissionTest's refusal-pool
race (the review's finding 6), which reads no catalog; each later tree
in this series keeps this change and passed its full Linux build. In a
Windows VM the catalog tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
A follow being opened holds a slot, counted with the open leases against
the limit of 32. The slot was given back only after the 201 had been
sent, in the request's finally block, although the lease was already in
place. A client that opened its next follow as soon as it read the reply
could therefore find the first one counted twice, as a lease and as
still opening, and the 32nd follow was refused with 429 "Close another
follow" while 31 were open.
FollowEndpointTest.viewAndRawFollowsShareTheLeaseCap failed that way in
a Windows VM. This is the concurrency review's "done before settled"
shape (rule R1), in a place its finding 6 does not list.

Both create paths, raw and view-bound, now hand the slot to the lease in
the same step, under the lock, before the reply; the finally block gives
the slot back only if it never became a lease. A probe after the reply
lets a test hold a request there.

Verified: a new test holds the first follow's request just after its 201
and opens the other 31, each of which must be 201, and the 33rd 429.
Restoring the old order in either create path fails the case for that
path. With a 100 ms delay planted before the old release, the lease cap
test failed every time. Full builds of this tree passed on the Mac and
on Linux, 5,316 tests each. In a Windows VM the follow tests pass, 50
tests, among them the lease cap test that had failed there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
The source health monitor showed every failed check as "unavailable"
until its next check five seconds later. A refusal the server marks
retryable is a passing state, such as a check that meets the store still
writing the file a robot's disconnect closed (409 FILE_CHANGED, retry
after 1,000 ms), so the panel showed a recording as unavailable just as
someone was watching the disconnect.

The monitor now keeps the views' last status through a retryable refusal
and asks again after the server's suggested wait, at most one heartbeat.
A refusal that has lasted a heartbeat is shown, and later checks keep
the heartbeat. The client keeps the server's retry_after_ms on its
refusal error, and refuses a malformed one as it refuses a malformed
retryable flag.

Verified: new tests show a retryable refusal asked again within three
seconds under a one-minute heartbeat, with nothing shown meanwhile; a
refusal between two answers leaving the status as it was; a refusal that
lasts a heartbeat shown as unavailable, and not before; and the client
keeping and validating the wait. Planting the refusal shown at once, the
wait ignored, a refusal hidden for good, the wait dropped by the client,
or a malformed wait accepted each fails a test. The extension's tests
pass on the Mac (903 of 908, 5 skipped), in CI's Ubuntu job on Linux
together with the editor smoke tests on VS Code 1.101.0 and stable, and
in a Windows VM (901 of 908, 7 skipped). Full Java builds of this tree
passed on the Mac and on Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
CI run 40263620867 failed LiveSourceTest on Windows: a health check sent
just after the test disconnected its robot got 409 FILE_CHANGED,
retryable, with a suggested wait of a second, and the test's helper
accepted only 200. The server's answer was right; the test was a client
that did not follow it. The helper now waits the suggested time and asks
again, for up to 10 seconds, as the extension's health panel now does.

Verified: with the server planted to refuse the test's first catalog
read once, retryably, the new helper passes and the old one fails with
CI's message. Full builds of this tree passed on the Mac, 5,316 tests,
and in CI's Ubuntu job on Linux; in a Windows VM the live source tests
pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
CI run 40334057612 failed ReplicaPublicationStatusTest on Windows: its
second publication recovery, which must change nothing, published a
fifth file. Each capture the test makes through the shared
ReplicaPublicationFixture helper asks for the closed file's clock
record, which one worker every store shares writes later; when the
record landed between the test's two recoveries, the second one
published it. 4b1cfda taught ReplicaPublicationCausesTest's own capture
helper to wait for that pass; the shared helper, which this test and
three others use, still did not.

The shared helper now waits for the store's clock records to settle
before it returns. A clock pass adds its record to the session's clock
records, not to its files, so the callers' checks of a receipt's files
still hold, and the one test that holds clock passes does not use this
helper.

Verified: with the test temporarily holding clock passes until just
after it notes the catalog's files, it fails at the same assertion as on
CI (3 identities expected, 5 found), and with the helper's wait it
passes. Full builds of this tree passed on the Mac and on Linux, 5,316
tests each, and the four test classes that use the helper pass in a
Windows VM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
A mirror that asks for its next catalog as soon as one arrives was
refused with "BUSY: two replica catalogs are building" while nothing was
building. The master builds two catalogs at a time, and the limit was a
pool of two threads with no queue, so it counted threads: a build
completed its caller's result and only then returned its thread, and
with both threads still finishing the next build was refused. This is
the shape a43a593 fixed for mirror transfers (concurrency review finding
6, rule R1).

The limit is now two permits for builds, on a pool that never refuses. A
build gives its permit back before it completes its result, in a
finally, so a failure gives it back too; a build its caller timed out
keeps its permit until it unwinds, as it keeps its reservation. The 64
MiB build budget, the refusal and its message are unchanged.

Verified: a new test holds two finished builds' threads after their
results complete, as a busy machine can, and starts a third build, which
is admitted. Planting the permit's release after the thread is done, or
the two-thread pool, fails it. Full builds of this tree passed on the
Mac and on Linux, 5,317 tests each. In a Windows VM, with the rest of
this series, the replica protocol tests pass, 7 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
A migration started the moment another store's migration finished was
refused with "BUSY: two replica migrations are preparing". Two
migrations prepare at a time across every store, and the limit was a
shared pool of two threads with no queue. A migration completed its
result on the store queue, and its preparer's thread woke from waiting
for publication and only then returned to the pool, so with both threads
still finishing the next migration was refused (finding 6, rule R1).

The limit is now two permits shared by every store, on a pool that never
refuses. A migration gives its permit back on the store queue, beside
clearing replicaPreparing, before it completes its result; a failed or
refused preparation gives it back on its own path. A store closes its
queue with shutdown(), which still runs a queued publication, so no
permit can be stranded.

Verified: a new test holds two finished migrations' preparer threads and
starts a third store's migration, which is admitted. Planting the
permit's release after the preparer is done, or the two-thread pool,
fails it, and three permits fail the existing test that a third
concurrent preparation is refused. Full builds of this tree passed on
the Mac and on Linux, 5,318 tests each. In a Windows VM, with the rest
of this series, the replica contract tests pass, 15 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
A peer announced while two earlier handshakes were finishing was put off
a second, tick after tick. Two handshakes run at a time, and the limit
was a pool of two threads with no queue: a handshake published its
result and only then returned its thread, so a tick that came in between
found both threads taken and deferred the next probe (finding 6, rule
R1).

The limit is now two permits on a pool that never refuses, and a
handshake gives its permit back before it publishes its result. A probe
that finds no permit is still tried again after a second.

Verified: a new test holds two finished handshakes' threads and
announces a third peer, which is probed within the test's three seconds.
Planting the permit's release after the thread is done, or the two-
thread pool, fails it, and three permits fail the existing test that
only two probes run. Full builds of this tree passed on the Mac and on
Linux, 5,319 tests each. In a Windows VM, with the rest of this series,
the peer discovery tests pass, 4 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
Opening an inventory as soon as two others finished building was refused
with "Both inventory builders are busy". Two inventories build at a
time, and the limit was a pool of two threads with no queue: a build
completed its result and only then returned its thread (finding 6, rule
R1).

The limit is now two permits on a pool that never refuses, and a build
gives its permit back, in a finally, after publishing its handle and
before completing its result. A build past its deadline keeps its permit
until a blocked read unwinds, as it keeps its reservation.

Verified: a new test holds two finished builds' threads and opens a
third inventory from another client, which is admitted. Planting the
permit's release after the thread is done, or the two-thread pool, fails
it, and three permits fail the existing test that a third concurrent
build is refused. Full builds of this tree passed on the Mac and on
Linux, 5,320 tests each. In a Windows VM, with the rest of this series,
the recording inventory tests pass, 16 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
The HTTP streaming pools (data, read, follow, store, inventory and the
replica pools) were thread pools with no queue, so their limits counted
threads, and a request's thread was still closing the exchange after the
client had the reply. A client that sent its next request at once could
find every thread finishing and get 503 BUSY with nothing running. The
two refusal threads counted the same way, and a refusal that found no
thread had its connection closed with no reply: HttpAdmissionTest failed
that way once on Ubuntu CI and twice on cpc (task #48; finding 6, rule
R1).

A ReplyCapacity now counts requests. SettledReply wraps the worker's
exchange and frees the request's slot the moment its reply's last byte
is written: after the write that completes a fixed-length body, the
close that ends a chunked one, or the headers of a reply with no body,
before the exchange closes and the thread returns. Each pool may hold
twice its limit in threads, so a request with a slot never waits for a
finished request's thread. The JDK writes a body straight to the socket,
so a client can hold the reply an instant before the worker frees the
slot; a request that finds no slot while some reply is finishing waits
up to 50 ms for it, and one that finds none otherwise looks once more,
since a reply that finished between the two looks has already freed its
slot, and is then refused at once, so a refusal under real overload
never holds the dispatch thread. The design note had the wait
unconditional; that would have held a dispatch thread for every refused
request in a flood.

FollowEndpointTest's limit test failed twice in a loaded Windows VM: its
sixteenth parked follow was refused at admission. Later runs did not
repeat it, so which of three races did is not known: the gap between the
two looks, a finishing reply's thread stalled past the 50 ms wait, or
the test probing the limit early, since it waited for 16 active workers,
which can now include a finished request whose slot is free. The server
keeps the second by design: a client that asks again the instant its
reply arrives, while that reply's thread is stalled past 50 ms, gets 503
and retries a second later. The test now sends each wait once the page
before it has freed its slot and moves on once the wait holds one. Its
refusal check took any 503, and the follow engine answers a second page
on a waiting lease with 503 as well, so it passed with the limit
removed; it now checks that the refusal is the limit's own. Its checks
after the stop run outside the finally, where their failure hid an
earlier one.

Verified: new tests hold a worker after its reply has reached the
client, with a fixed-length reply, a chunked one and one with no body,
and the next request at a limit of one is admitted; hold two refusal
threads after their 503s, and a third refusal is still answered; check
that admission waits only while a reply is finishing; and finish a reply
between admission's two looks. Planting a late release for fixed-length
or chunked replies, the two-thread refusal pool, the thread-counted work
pool, no wait, a wait every time, or a single look, each fails the test
meant for it. On JDK 17 the exchange also closes the response stream
when it writes a no-body reply's headers, so the headers path and the
close path each settle that reply, and only planting both fails the
test. Planting admission that lets follow pages past the limit fails the
follow test at the refusal's body; the old test passed with that plant
three times out of three. The existing test that fills the read pool now
takes its slots instead of its threads. Full builds of this tree passed
on the Mac and on Linux, 5,326 tests each. A full Windows build of the
series passed in a VM, 5,304 tests, leaving out the tests that fail in
that VM without this series.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
The MCP pool counted its threads in the same way, so an MCP client that
sent its next call at once could be refused with 503 at the limit. And
an inventory reply's reservations were freed when the request's scope
closed, after the socket write, so a client could read the reply and
still find 2 MiB reserved; 1dadec9 taught the inventory refusal tests to
wait for that instead (review catalog #16).

MCP requests now hold a ReplyCapacity slot, freed when the reply's last
byte is written, on a pool of twice as many threads. Inventory reply
reservations are freed as the reply's last write begins: they bound
memory, not threads, and the request's own slot, still held through that
write, bounds what remains in flight. A request handed from the MCP pool
to the inventory pool writes through both replies' streams; the MCP
reply, settled at the hand-off, only passes the bytes on. Over stdio
nothing changes.

Verified: a new test holds an MCP call's worker after its reply, and the
next call at a limit of one is admitted. The inventory refusal tests now
check, while the worker is held right after its last write, that the
reservations are already free, without 1dadec9's wait, and a new test
does the same for the visualization endpoint's inventory replies.
Planting the thread-counted MCP pool, a late MCP release, or
reservations freed after the last write on either path, each fails the
test meant for it. Full builds of this tree passed on the Mac and on
Linux, 5,328 tests each, and in a Windows VM, 5,304 tests, leaving out
the tests that fail in that VM without this series.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
… code has them

The pit server reference said four replica metadata workers own a
separate 8 MiB encoding budget, and the architecture guide that replica
metadata has its own 8 MiB response budget. Nothing reserves against
that 8 MiB or refuses for it: it follows from four requests at a time,
each reply capped at 1 MiB and encoded in at most two buffers (the JSON
is built in a capped buffer, then copied). Both now say so. The stage 3
design note had called the pit sentence stale; on a closer look only its
word "budget" was wrong.

The standalone reference said library reply reservations are held
through encoding and socket completion. Since 0637123 they are freed as
the reply's last write begins, and the reference now says so; 0637123
updated the architecture guide but missed this sentence.

Verified: the 20 test classes that read documentation pass, 196 tests,
and none of them reads the changed phrases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5CT7TCBB3b6EvH4zSPpb9
The sync recovery tests kill a child process at a chosen boundary of a
sync and reopen its stores at once. At its boundary the child holds a
store's lock and the sync's owner lock, and Windows releases a
terminated process's file locks when resources allow, not when it exits.
On Windows CI the reopened store of one case (CROSS_COMMITTED) found
"Store lock is held by another import" (CI run 40385963014). The crash
helper now waits, at most 10 seconds, for every store lock and owner
lock under the child's folder, with the helper a38fc24 added for the
other tests that kill a lock holder.

Verified: with the CPU saturated in a Windows VM, ten runs of the old
tests failed once, in another case that uses the same helper, with the
lock held by another process. Ten runs with the wait passed, six of them
under the same load. The tests also pass on the Mac and on Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two store objects for one folder each ran their own queue and could
take the folder's lock at the same moment. Java refuses a lock the same
process already holds, and the store reported that refusal as another
import holding the lock: on Windows CI the legacy layout test's import
failed with "Store lock is held by another import" (CI run
40385963014), and thread dumps in a Windows VM showed two store
objects' startup recoveries in their locked turns at once. The server
opens every folder through one registry, but listing a store folder
opens it there, and tests that kept a registry or store of their own
for the same folder made a second object.

A store now claims its folder when it is made, before its queue starts,
and a second object for the folder is refused with STORE_OWNED. The
folder is given back on the queue's thread after its last turn, since a
turn queued before close still takes the lock. Close waits up to ten
seconds for that turn, and a registry stops all its stores before it
waits for any, against one deadline. A test that stands in for another
server makes its second store through an explicit factory that claims
nothing, so the two meet only at the lock, as two processes do. The
registry can also open a folder's store with a test's own file mover,
and give one folder back.

With the guard alone, 32 tests in ten classes failed at once, each a
second owner: listing helpers and captures beside a test's own
registry, fixtures that made a second store to inject a mover, peer
servers in one JVM serving a store the test had made itself, and tests
that held a folder through two registries. Each now has one owner:
listings hand the folder to the process's registry and take it back,
captures and served stores open through that registry, and movers go to
the registry's store.

Verified: new tests refuse a second store from another registry or made
directly, keep a closed store's folder owned until a turn queued before
the close has ended, and keep a closing registry's folders owned until
its stores' last turns have ended. Planting no refusal, a close that
does not wait, a folder given back when close begins, or a registry
close that does not wait, each fails the test meant for it. Full builds
passed on the Mac and on Linux, 5,331 tests each. In a Windows VM a full
build, run while the Mac built too, failed four tests that time a
server's or a capture's start; no output or child server's log showed
STORE_OWNED, the servers' logs show slow starts, and the three classes
passed when run again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the turn

Since c459705 a store's close waits, up to ten seconds, for its queue's
last turn. The staging shutdown test held a publication turn for up to
ten seconds, closed the registry and then checked that the turn's staged
bytes had survived. The close now returned only once the turn's own wait
gave up and the turn unwound, so whether the turn's cleanup had already
removed the bytes decided the test: it failed on Windows CI (run
40418419255) and on the Mac, and took ten seconds where it passed.

The test now closes in the background and waits until the close has
stopped the store's imports, which interrupts staging's wait, and its
queue. It then checks that the close is still waiting and the bytes are
still there, and only then releases the turn. A new store accessor
reports that a close has stopped the queue.

Verified: the test passes in three runs each on the Mac and in a
Windows VM, in about a second, and on Linux. Planting a staging wait
that stops at the interrupt, which deletes the bytes the running turn
still uses, fails it. Comparing the clean Mac builds before and after
c459705, this was the only test that grew by close to ten seconds, and
no close in either build reached its ten-second limit. The store tests,
589, pass on the Mac.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a Mac a JVM that is not headless gets a Dock icon when AWT starts,
and the icon takes focus. Chart images draw through AWT, so the chart
tests in the test JVMs, and the servers that tests started when they drew
a chart, took focus while the suite ran: nothing set java.awt.headless.

Every test task now sets java.awt.headless. Every JVM a test starts
takes its java and the headless option from one fixture, ChildJvms: the
33 places that found this JVM's java themselves now use it, and a check
fails when a test resolves java any other way. The server sets the
property itself at startup unless its command line does, since a server
never shows a window, so a real server on a Mac no longer gets a Dock
icon when it draws a chart either.

Verified: new tests check that the test JVM is headless, that the
server's default applies only when nothing set the property, and that no
test starts a JVM outside the fixture. Planting a test task without the
property, a server without the default, or a test that resolves java
itself, each fails the test meant for it. Full builds of this tree
passed on the Mac, 5,334 tests, and, with the next commit's test fix, on
Linux, 5,334 tests, and in a Windows VM, 5,310 tests, leaving out the
tests that fail in that VM without this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The library pressure test sends four library calls, holds the first
one's write, waits until their reply reservations reach 8 MiB, and then
checks those and the library's input reservations. A call reserves its
reply before its library call charges input, so the fourth could still
be between the two: on Windows CI (run 40425990970) the test found 6 MiB
of input where it expected 8. It now waits for both before it checks
them.

Verified: delaying only the fourth call's input charge by half a second
fails the old test with CI's message and passes the new one, which also
passes without the delay. Full builds of this tree passed on the Mac and
on Linux, 5,334 tests each, and in a Windows VM, 5,310 tests, leaving
out the tests that fail in that VM without this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A poll admitted a batch and then, if nothing was importing and a REV
reconsideration was due, started that as well. A batch can finish before
the poll reaches that check: one a busy store refuses fails at once and
marks a reconsideration due. The reconsideration then became the poll's
work in place of the batch, so a caller waiting on that work saw the
reconsideration finish. On Ubuntu CI (run 40437957885) the test that
holds the store lock, as another process would, found nothing thrown
where the deferred batch's failure was due.

A poll that admitted a batch now leaves reconsideration to its next
poll, three seconds later.

Verified: pausing the poll for 300 ms after it admits a batch fails the
old code's ingestion test with CI's message, and the new code passes
with and without the pause, 25 tests. Full builds of this tree passed on
the Mac, 5,334 tests, and, with the next commit's test fix, on Linux,
5,334 tests, and in a Windows VM, 5,310 tests, leaving out the tests
that fail in that VM without this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test that fills the read pool with 32 peers that never read takes
the status line of each reply before it opens the next connection. For
the sixteen refusals it read only that line, while the server was still
writing the reply's body and holding its refusal slot until the last
byte. Two refusals could still be writing when a third came, and by
design that one is closed without a reply: on Ubuntu CI (run
40437957885) the test read a missing status line and failed with a
NullPointerException. It now reads a refusal to its end, as a client
does, and names a connection closed with no reply.

Verified: writing each refusal's body 300 ms after its headers fails the
old test with CI's NullPointerException and passes the new one, which
also passes without the delay. Full builds of this tree passed on the
Mac and on Linux, 5,334 tests each, and in a Windows VM, 5,310 tests,
leaving out the tests that fail in that VM without this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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