Skip to content

v0.10.1 — integrity core: write path, read path, FUSE node contract, and a harness that can see seams - #191

Merged
scttfrdmn merged 35 commits into
mainfrom
v0.10.1-integrity
Aug 2, 2026
Merged

scttfrdmn merged 35 commits into
mainfrom
v0.10.1-integrity

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

A deep audit of v0.10.0 found ~45 defects. Four are verified by execution to lose or corrupt
user data, and one prevents the shipped default configuration from mounting at all. v0.10.0 is
withdrawn. CHANGELOG.md carries the full account; this is the shape of it.

Why this is a refactor and not a patch set

The defects were not independent. They clustered in three subsystems whose designs could not
express what they were asked to do:

  1. The write path could not represent an offset write. Per-file state was one contiguous
    []byte plus a single offset — a representation that can hold "a run of bytes starting
    somewhere" and nothing else. It could not hold two disjoint dirty ranges, so a filesystem
    built on it had to either refuse the second write or lose the first, and it did both in
    different places. Replaced by internal/vfs with an extent list and real read-modify-write.
  2. The read cache could not hit as keyed. Request length was part of the cache key, so the
    metadata cache never hit and small files were never served from cache. Nothing invalidated on
    write, so read-after-write on a single fd returned pre-write bytes for up to five minutes.
  3. The FUSE node layer was missing most of its contract. No Setattr, no Fsync, no
    DirectoryNode.Getattr (so directories reported mode 0000 and every non-root user got
    EACCES), no Readdir pagination, and every HeadObject error collapsed to ENOENT — which
    Create then read as "absent" and wrote an empty object over an intact, merely throttled file.

Why 32,680 lines of tests across 90 files caught none of it

Every one was a seam defect: a value correctly produced at one layer and silently dropped at
the boundary to the next. A mock on the far side of a seam agrees with its caller by
construction. Two additions remove that blind spot:

  • internal/testaws — the real S3 backend against an in-process substrate endpoint over real
    HTTP. No network, no credentials, no AWS account.
  • internal/difftest — a differential oracle running one operation sequence against ObjectFS
    and against the local OS filesystem, asserting they agree on reads, sizes, and durable bytes.

Each is the mechanism that catches this class and the cheapest thing that does. pwrite("AAAA",0)
then pwrite("BBBB",4) producing a 4-byte object is invisible to a length assertion and obvious
to a byte comparison — and a length assertion is exactly what the deleted WriteCoalescer test
had, which is why it passed while merging "hello!" and "LO_WORLD" into corruption.

Release machinery

Verification of the release path found it would have mislabeled or failed to build the artifact:

  • Three of seven matrix entries were guaranteed-red — windows/amd64 and freebsd/amd64
    cannot build (internal/fuse is //go:build linux || darwin, by design), and linux/armv7
    fails separately on a 32-bit int overflow. Trimmed to the four pairs that compile.
  • -X main.Version targeted a symbol that does not exist. The version is a const, which the
    linker cannot rewrite, so every release ObjectFS has cut silently ignored the flag.
    Replaced with a check that the tag and the constant agree.
  • Releases were built with Go 1.24 against go.mod's 1.26.0 — the one build users download was
    the least tested configuration in the repo. Now read from go.mod.
  • Both .goreleaser files deleted: two configs, same directory, invoked by nothing, disagreeing
    on platforms, on which nonexistent symbol to inject into, and on repo owner. One would have
    stamped a misspelled name and [email protected] into every .deb and .rpm.

Breaking changes

Each is in CHANGELOG.md with a Migration note. The load-bearing ones: strict config
decoding now rejects an unknown key at startup, naming it (previously discarded in silence —
eight of ten top-level keys in the file users were told to copy were inert); security.encryption
booleans are replaced by mode/kms_key_id/bucket_keys and defaulted to off, because the old
pair defaulted to true and set no header on any object; pkg/types.Backend.PutObject takes a
user-metadata map; and transparent compression now defaults off, since a compressed object is
opaque to aws s3 cp and voids the implicit "my data is just objects in S3" guarantee.

Verification

make build clean, full suite green under -race (not -short). Lint is 735 findings, unchanged
from the pre-existing baseline and gated per-PR by --new-from-merge-base.

This PR exists rather than a direct tag because these 27 commits modify CI itself and no CI
run has ever executed against them. The tag follows a green run here, not the other way round.

scttfrdmn added 30 commits July 29, 2026 21:28
Three fixes toward the v0.10.1 data-integrity milestone.

#170 — HeadObject reported the compressed ContentLength as the file
size, which the FUSE layer cached and handed to the kernel, truncating
every read of a compressed file at the compressed length. A 40 MB
object reported 4,556 bytes; a 64 KB object reported 87. PutObject now
records the uncompressed length as objectfs-original-size when
compression actually shrank the object, and HeadObject reports it.
Objects written before this change fall back to ContentLength.

#170 (second bug, found while fixing the first) — putObjectMultipart
recomputed objectfs-sha256 from the post-compression bytes while the
single-part path hashed the uncompressed content, so the two upload
paths stored hashes of different byte streams under the same key. The
metadata map is now threaded down from PutObject instead.

#163 — go-fuse's NodeUnlinker/NodeRmdirer defaults return success when
unimplemented, so rm and rmdir claimed to delete files that were never
touched. DirectoryNode now implements both, returning EROFS with a
warning, until the real DeleteObject implementation lands.

#161 — Removed the AWS Pricing API path. Its parser matched storage
classes on names absent from the API payload and both cost extractors
ignored their arguments to return hardcoded constants, so
use_pricing_api fetched a multi-megabyte document and discarded it in
favour of the static rates. The flag is deprecated and warns at
startup. internal/cost is kept — it delivers per-tenant accumulation
and budget alerting that exist nowhere else — with a drift tripwire
guarding its rate table against StorageTierInfo.

Verified against real S3 (objectfs-test-scttfrdmn, us-west-2): all 12
TestAWSS3Integration subtests pass, including new single-part and
multipart size-reporting cases proven to fail without the fix.
A deep audit found defects that prevent the shipped default configuration
from mounting and that silently lose or corrupt user data. Disclose this
in the README and CHANGELOG rather than leaving it undisclosed while the
fixes land.

The three that matter most:

  C1  internal/config/config.go defaults compression.algorithm to "gzip";
      internal/compression/codec.go implements only none/zstd/lz4. Every
      layer that reads config treats gzip as valid — only the codec
      factory disagrees — so `objectfs s3://bucket /mnt` exits with
      "Failed to start adapter".

  H7  The write-buffer flush callback in internal/adapter/adapter.go is
      handed (key, data, offset) and calls PutObject(ctx, key, data),
      discarding the offset. PutObject is a whole-object replace, so
      appending one byte to a 1 MiB file leaves a 1-byte object.

  C4  internal/storage/s3/backend.go decides whole-object-versus-ranged
      fetch from the compression *config* rather than from the object, so
      a ranged read of any object downloads the whole object. Measured
      216x penalty on a 256 MiB object with a fixed 4 KiB read.

The corresponding GitHub release note carries the same disclosure.
The cgofuse build tag has never compiled. `filesystem.go` carried no
build constraint of its own while `cgofuse_filesystem.go` had
`//go:build cgofuse`, so under the tag `OpenFile` was declared twice —
an unconditional duplicate-symbol error, masked by a missing `fuse.h`
that fails first:

    $ go build -tags=cgofuse ./internal/fuse/
    fatal error: 'fuse.h' file not found

Its stated rationale was also false. FUSE_MIGRATION.md justified the
switch by "macOS compatibility issues" with go-fuse, but go-fuse's
darwin mount execs

    /Library/Filesystems/macfuse.fs/Contents/Resources/mount_macfuse

and cgofuse needs the same macFUSE headers. Identical macOS
requirements; the migration solved nothing.

And it was a silently divergent subset: 382 lines against 727,
implementing only Mount/Unmount/IsMounted/Getattr/Open/Read/Write/
Release/Readdir. It never received the Unlink/Rmdir fix, so under that
tag `rm` still reported success while the object survived in S3.

Windows is now explicitly unsupported, which matches what builds.
go-fuse cannot target it either:

    $ CGO_ENABLED=0 GOOS=windows go build github.com/hanwen/go-fuse/v2/fs
    internal/fallocate/fallocate.go:8:9: undefined: fallocate
    internal/openat/openat.go:26:19: undefined: unix.EINVAL

platform_unsupported.go makes a non-linux/darwin build fail inside this
package naming the reason, rather than emitting a list of
"undefined: fuse.PlatformFileSystem" errors from internal/adapter.

doc.go is rewritten: it cited the stale billziss-gh module path and
listed chmod/chown/utimes/truncate/fsync/rename/link/symlink/xattrs as
supported along with FSEvents, Spotlight, and NTFS optimizations. None
of those exist.

If Windows or NFS is ever wanted, it is a second thin shim over
internal/vfs, not a fork of this package that drifts unnoticed.
Three releases behind. No API changes needed: ObjectFS uses 14 distinct
fs.* symbols and none of their signatures moved. Build, vet, and the
race-enabled internal/fuse tests all pass unchanged.

Isolated in its own commit so a regression here is bisectable
independently of the cgofuse removal that precedes it.
v0.10.0 had no layer between go-fuse types and the S3 backend. That absence
is not untidiness; it generated a class of defect. Attributes could not
persist because no type owned them. Offset writes could not be buffered
because no range model existed. The go-fuse mode backstop was left disabled
because nothing owned the default, so every directory reported mode 0000.
A second FUSE binding drifted into a divergent subset because there was no
shared core to bind to.

internal/vfs is that core: backend-agnostic, FUSE-free, returning typed
errors rather than syscall.Errno, and testable without a mount.

  ExtentList  an interval list of pending writes, replacing the contiguous
              buffer + single offset that could not represent an offset
              write. Accepts any write anywhere, coalesces so later writes
              win, and plans exactly which stored ranges a flush must fetch.
              Truncation is a watermark, not a flag: two sizes are required,
              because "truncate to 4 then write at 83" must leave 4..83 a
              hole rather than resurrecting the deleted bytes.

  Attr        one owner for size, mode, ownership, times, ETag, and the
              stored SHA-256, with round-trippable S3 metadata encoding.
              Keys match case-insensitively — S3 lower-cases them, MinIO
              title-cases them, an http.Header round-trip canonicalises to
              Objectfs-Mode — so a case-sensitive lookup would pass unit
              tests and fail against real storage. Malformed values fall
              back to defaults; MetadataWarnings reports what was ignored.

  Node        per-path state shared by every handle, because one path is one
              object. MarkFlushed takes the generation captured when the
              plan was made and refuses to clear pending state if a write
              landed mid-upload — the exact v0.10.0 path where a write
              concurrent with a flush was dropped and counted as flushed.
              Release keeps a dirty node; Forget refuses one still dirty or
              still open.

Tests assert against a deliberately naive map[int64]byte model of the file,
so a test cannot ratify the same off-by-one the implementation has. That
found two real design bugs the thirty-odd hand-written cases had all passed:
truncate-then-write-past-the-end re-fetched the whole object and resurrected
deleted bytes, and a sparse read could not distinguish a hole from EOF,
returning zero bytes where it owed zeros.

98.4% statement coverage; three fuzz targets clean over ~4M executions.
The uncovered arms are defensive paths unreachable through the public API.
…nicked

Two defects that blocked the substrate-backed test harness outright, both
proven by execution rather than inference.

The connection pool's factory called s3.NewFromConfig with no options while
the three direct clients applied Endpoint and ForcePathStyle. HeadObject,
DeleteObject, ListObjects, HealthCheck, and the non-accelerated path of
executeWithAccelerationFallback all draw from that pool, so those operations
addressed real AWS S3 while PutObject and GetObject addressed the configured
endpoint. ObjectFS could not work against MinIO, Ceph, Wasabi, or an
emulator, and the failure surfaced as a 403/404 from AWS — which reads as a
credentials problem, not a configuration bug. One shared clientOptions
mutator now feeds all four construction sites, and the test enumerates the
manager's accessors so a client added later without it fails there rather
than in production. use_dual_stack was likewise applied by nothing.

ConnectionPool.Get returned *s3.Client alone and yielded nil once
currentSize reached maxSize; the select's default arm made its own
time.After case dead code, so a full pool failed instantly instead of
waiting for the connection about to come back. All six call sites
dereferenced it unchecked, so the ninth concurrent operation on the default
8-connection pool panicked and unmounted the filesystem under every open
descriptor. Get/GetWithTimeout now return an error and block up to the
timeout, whose message names the in-use count and the knob to raise.

Put's closed check and its send are now one critical section and Close
drains rather than closes the channel: the two were a check-then-act race
whose losing side was a send on a closed channel, on the path every deferred
Put takes during unmount. A Get already blocked when Close runs now fails
immediately rather than waiting out its timeout.

Writing the regression tests surfaced two more. The capacity check and the
counter increment were taken under separate locks, so 16 concurrent workers
against a pool of 4 ran the factory 16 times and threw 12 clients away on
return; reserving a slot is now atomic and a factory failure releases the
reservation instead of permanently shrinking the pool. Resize could raise
maxSize above the idle channel's fixed buffer, which would let a reservation
be made for a slot with no space and deadlock the return under the write
lock; it now refuses to grow and says to raise storage.s3.pool_size,
and shrinking converges by dropping connections as they come back.

Closes #173, #174
…paths

The harness comes first because nothing else was trustworthy. The v0.10.0 audit
found ~45 defects that 32,680 lines of tests across 90 files had all missed,
overwhelmingly because they were seam defects: a value produced correctly at one
layer and dropped at the boundary to the next. A mock on the far side of a seam
restates what the caller believes, so it agrees with the caller by construction.

internal/testaws runs the real S3 backend against a real S3 endpoint (substrate
in-process) over real HTTP — no network, no credentials, no AWS account. Two
design points carry the weight:

  - A byte-counting recording proxy. Read amplification is a byte-count property
    and neither the SDK nor the emulator reports one, so the alternative was
    asserting latency, which would make the decisive read-path test a flaky
    proxy for the thing it measures.
  - Runtime capability probes that skip loudly. Against an endpoint that ignores
    Range, every ranged-read assertion passes for the wrong reason, because the
    whole object contains the requested bytes. Probes are pinned to observable
    behaviour, not to a dependency version, so they stay correct whichever way
    the dependency moves.

It paid for itself inside an hour, surfacing live corruption on the shipped
default config. Fixed here:

  - CargoShip stored Content-Encoding as user metadata only, so a compressed
    object read back as its raw zstd frame. An 8192-byte write returned 29 bytes
    with a nil error. Compressed uploads now bypass the transporter.
  - GetObject fails closed on an object it cannot decode, and dispatches decoding
    on the object's stored encoding rather than the write config. Decompress
    returns its input unchanged on a mismatch, so a raw frame previously reached
    the caller with exit status 0 while HeadObject reported the original size and
    the kernel padded with zeros. This is the guard the v0.10.0 SHA-256 was for;
    it was written and never read.
  - Ranged-versus-whole is decided from the object, not the compression flag.
    Measured: 1024x amplification on a 4 KiB read of a 4 MiB *uncompressed*
    object with compression merely enabled. A 416 on an uncompressed object is
    still an error, not a whole-object refetch — that would have quietly
    reintroduced the defect for ordinary reads past EOF.
  - GetObject cannot panic on a negative size (C3), DeleteObject is a no-op on a
    missing key (S3 reports NotFound, not NoSuchKey), a retried GET cannot mix
    one attempt's encoding with another's body, and access_key_id /
    secret_access_key are no longer dead config fields.

pkg/errors gains ErrCodeDataCorruption: never retryable, since retrying reads
the same bad bytes and only delays the report.

TestMultipartCompressedObjectRoundTrips skips pending scttfrdmn/substrate#406
(CreateMultipartUpload drops Content-Encoding). ObjectFS sets the header
correctly and real S3 preserves it, so that path needs live-AWS coverage.

Refs #14, #21, #173
…(C1)

internal/config defaulted write_buffer.compression.algorithm to "gzip"
while internal/compression's codec factory implemented only none, zstd,
and lz4. Every layer that touched config believed gzip was valid —
pkg/compression declared AlgorithmGzip, the S3 config comment listed it,
and examples/config.yaml shipped it — and the only code that knew better
ran after the user had already asked for a mount. Result on stock config:
"Failed to start adapter", naming nothing.

Two changes close it.

A gzip codec now exists. It is slower and compresses worse than zstd at
every level, so it is not recommended, but it offers the one property the
others cannot: gzip is a registered HTTP content coding, so an object
stored this way is decodable by browsers, curl, and any HTTP client,
whereas a zstd or lz4 object fetched with `aws s3 cp` lands as an opaque
frame. Whether to implement it or delete the constant was decided by
measurement, not preference: a throwaway probe established that the AWS
SDK returns a Content-Encoding: gzip object as the stored bytes with the
header intact, ranged and whole, so gzip needs no special handling in the
read path. Verified against the standard library in both directions,
because reading back through the same codec that wrote cannot detect a
non-standard encoding.

Configuration.Validate() now rejects an unbuildable compression block at
config load by building the codec. Validating against a list of algorithm
names would have been a second authority on the same question, free to
drift exactly as the first one did — and it could not catch the other
half of this, a level out of range for the chosen algorithm: zstd accepts
0-22 and gzip only 0-9, so `level: 22` is valid for one and not the other.

Making that possible required inverting a dependency. internal/compression
imported internal/config, so the config layer could not ask the factory to
build anything without a cycle — which is why it was reduced to trusting a
duplicate list. NewCompressor now takes a compression.Settings it owns.

Also: compression defaults to off. It is a storage-format decision, not a
performance knob — it makes objects opaque to every other S3 client and
makes a ranged read fetch the whole object, since a zstd frame cannot be
sliced.

TestEveryDeclaredAlgorithmHasACodec walks SupportedAlgorithms() and
round-trips each one, so a declared-but-unimplemented algorithm is now a
test failure rather than a release. TestShippedDefaultsConstructABackend
reads the compression block from config.NewDefault() verbatim rather than
assembling one by hand, which is the mistake that let this ship.

Teeth verified by reconstruction: removing the gzip case fails the two
codec-facing tests, and restoring the full v0.10.0 state fails the two
config-facing tests with the exact production error text.
…t found

internal/difftest runs one operation sequence against ObjectFS and against the
local OS filesystem, then asserts they agree on what each read returns, on the
size each reports, and on the bytes that end up durable. The reference is not a
model of POSIX; it is POSIX. That matters because the v0.10.0 write-path defects
were invisible to 32,680 lines of unit tests: each layer was tested against a
mock of its neighbour, and the mock restated what the caller believed, so the
disagreement between layers had nowhere to show up.

Calibrated before being trusted: Legacy (the write path v0.10.0 shipped) is kept
as a target, and all seven of the audit's proven data-loss sequences diverge on
their own named property at their own named operation. Local compared against
itself never diverges across 7 programs.

Shrink reduces a failing program to a minimal one and emits it as pasteable Go.
Its test asserts the survivor still fails on the property that was *planted*,
not merely that it still fails — a shrinker that wanders into an unrelated
divergence produces a confident bug report about a bug nobody saw.

That check fired on first contact. Shrinking a 44-operation program reduced it to
a single one-byte write and reported a health divergence rather than the
durability defect the program contained. Not a harness artifact — two real bugs,
composing into a total, permanent read outage on an entirely healthy S3:

  1. pkg/health counted a NoSuchKey as evidence the service was unwell, so ten
     reads of absent keys drove s3-reads to unavailable.
  2. unavailable was a one-way door. GetObject checks the availability gate
     *before* reaching getObjectRange, which holds the only
     RecordSuccess("s3-reads") call in the backend — from the state that needed a
     success, no success could be produced. RecoveryThreshold is configured and
     read by nothing; StartHealthChecks has no callers.

Verified by execution: after ten reads of a missing key, a read of an object that
existed was refused with SERVICE_UNAVAILABLE, and twenty further attempts never
recovered. Ten stats of absent paths is an ordinary minute in the life of a
filesystem — tab completion, a build probing for headers, any open(O_CREAT) of a
new file, and ObjectFS's own Lookup does one per path component.

Fixed at both authorities, because two independent mechanisms guarded the same
call and both got the same classification question wrong:

- pkg/errors.IsServiceFailure is now the single predicate for "is this evidence
  the service is unwell, or an ordinary answer to an ordinary request." It
  enumerates the non-failures and returns the negation, so a code added later
  defaults to counting: the failure mode of forgetting to update the list is a
  component that degrades too eagerly and recovers on its probe timer, not one
  that never notices an outage.
- internal/circuit's defaultIsSuccessful asks it instead of testing err == nil.
  With the health gate fixed, the seam test proved the s3-get breaker had the
  identical defect and produced the identical refusal — something pkg/health's
  own unit tests could not see.
- pkg/health gained TrackerConfig.ProbeAfter (default 30s): a refusing component
  admits one operation to find out whether the service came back. This is the
  circuit breaker's half-open state, which internal/circuit already implemented
  correctly and this layer lacked. A clean probe recovers outright rather than
  decrementing, because the gate admits one operation per interval and recovery
  must not require ten of them. Admission is gated on a timestamp rather than on
  the in-flight flag, so a probe whose outcome never arrives costs one interval
  instead of latching forever — gating on the flag would have rebuilt the very
  defect the mechanism exists to fix. Concurrent callers yield exactly one probe.

Tests: pkg/health/admission_test.go pins the classifier at 3x the unavailable
threshold, so a pass is not a pass by staying under a limit; it also asserts
GetState still reports unavailable *during* a probe, since a probe is permission
to try, not a recovery. internal/storage/s3/health_gate_test.go runs the composed
path through the real backend over real HTTP, because that seam is where the
composition lives and neither fix alone suffices there.

The S3 backend's breaker config now says outright that MaxRequests is the
half-open probe limit and that the trip decision belongs to ReadyToTrip — reading
that block and seeing only MaxRequests invites the conclusion that ten failures
trip the breaker, and it was read that way during the audit.
The v0.10.0 audit found ~45 defects that 32,680 lines of tests across 90
files had all missed. They were overwhelmingly seam defects — a value
produced correctly at one layer and dropped at the boundary to the next —
and a mock on the far side of a seam is a restatement of what the caller
believes, so it agrees with the caller by construction. These five targets
run both sides of a seam and compare.

  FuzzOperationSequence  operation streams through the differential oracle
  FuzzSliceRange         the full offset/size domain, negatives included
  FuzzGetObjectRange     the same against a real endpoint
  FuzzConfigConstructsBackend  YAML -> buildS3Config -> NewBackend (C1's seam)
  FuzzRoundTrip          bytes -> compress -> PUT -> GET -> decompress

Three found real shipped defects, all fixed here:

  sliceRange overflowed its own bounds check. The C3 fix compared
  offset+size < end, which wraps negative for a large size and produces
  data[1:-9223372036854775808] — C3 again by another route, found in the
  corrected code within seconds.

  A malformed storage.s3.region passed every layer that reads config and
  failed inside NewBackend's health check with "501 NotImplemented" or
  "exceeded maximum number of attempts", naming nothing. Verified against
  real S3: US-WEST-2 returns 400, "us west 2" fails endpoint resolution,
  because the region is interpolated into a hostname. C1's exact shape in
  a second setting. internal/awsname exists as its own package because
  pkg/types aliases internal/config and s3 imports pkg/types, so config
  cannot import s3 — the same dependency inversion that produced C1.

  Backend.Close leaked 2 sockets per cycle. ClientManager.Close drained
  the ConnectionPool, which pools *s3.Client values sharing one transport,
  so it freed no sockets; the sockets are the transport's idle connections,
  held for 90s, and nothing released them. A loop exhausted the ephemeral
  port range and failed every later operation with "can't assign requested
  address" whatever its config. The fuzzer reported it as a config finding
  with a minimized input of the empty string, which is the signature of an
  environmental failure rather than a finding.

Also pins two integrity fixes that previously had only unit coverage:
TestRoundTripAcrossACodecChange (C2) writes with one codec and reads with
another configured, and TestPutObjectRecordsAVerifiableChecksum (#170)
asserts one hash across both upload paths at six sizes straddling the
multipart threshold.

testaws.Shared gives fuzz targets a process-lifetime endpoint: f.Fuzz's
*testing.T is per-iteration, so a t.Cleanup-scoped server is rebuilt every
exec — measured at 49 executions in 24 seconds before the port range
filled. BackendOn lets two differently-configured backends share a bucket,
which is the only way to express the reconfiguration C2 needs.

Corpora are committed selectively, not wholesale: FuzzRoundTrip alone
accumulated 32 MB with several entries over 5 MB. Entries above a
per-target cap stay in the cache where the fuzzer can still use them.

Refs #17
Mechanical only, from `golangci-lint run --fix`: Go 1.22 integer ranges,
maps.Copy and slices.Contains over hand-rolled loops, interface{} to any,
atomic.Uint64 over the free functions, import grouping with the local
prefix last, and US spellings.

Two fixers were run and reverted, and both are now disabled in
.golangci.yml with the reason recorded there:

  errorlint rewrote `err.(*errors.ObjectFSError)` into `errors.As(...)`,
  which does not compile — pkg/errors shadows the standard library's
  errors package and exports no As.

  dupword deleted a token from test data. `want: "F F S"` in
  internal/difftest is a compact program notation (flush, flush, stat)
  which it read as a duplicated word and rewrote to `"F "`, leaving the
  test asserting that a three-operation program decodes to one operation.
  All four of its findings in this repo were false.

That is the argument for running a fixer and then the suite rather than
trusting either alone: a linter whose fix quietly weakens an assertion is
the failure mode the harness exists to catch.

No behaviour change. Full -race suite passes except the three
sdks/go/objectfs tests that require a real S3 bucket (#172), which fail
identically before this commit.
Adds the first lint configuration and coverage gate this repository has had,
and closes audit finding P-10 at its root.

CI (six jobs, replacing `go test -race -short ./...`):

  - full `-race` suite, no `-short`
  - per-package coverage floors (scripts/coverage-gate.sh, .coverage-floors)
  - golangci-lint against .golangci.yml, which did not previously exist
  - 60s-per-target fuzz smoke
  - cross-build matrix that fails rather than echoing
  - config-examples: every shipped and documented config must load

The test and lint jobs run with no AWS credentials and with instance metadata
disabled, so a test depending on the developer's ambient profile fails in CI
rather than passing locally and nowhere else.

Coverage is gated per package, not repo-wide: the aggregate near 69% is the
figure that looks acceptable while internal/fuse, which every POSIX operation
passes through, sits at 24.1%. The 31 floors start at today's measurements, so
the gate is green on this commit and each floor is a ratchet. A floor whose
package produces no coverage data fails, because a floor nothing measures has
stopped gating.

BREAKING: a config key the schema does not define is now rejected at startup
with the key named, instead of being discarded in silence.

What non-strict decoding cost, measured rather than estimated. configs/example.yaml
— the file the README told users to copy, the file postinstall.sh installs as
/etc/objectfs/config.yaml, and the file the Dockerfile and GoReleaser config ship
— was 162 lines of which exactly *one* field differed from the built-in defaults,
and nothing read that field. It opened with a top-level `s3:` block where the
schema has `storage.s3`, so `region: us-west-2` loaded as `us-east-1`. Its
mount:, buffer:, compression:, metrics:, health:, logging:, archive: and cost:
blocks were all inert. That is also why the compression block documented
`enable`/`zstd_level`/`min_file_size` against the real `enabled`/`level`/`min_size`
for four releases with nobody noticing: the block was already being thrown away,
so correcting the names would not have changed the behavior either.

A rejected config costs a user a minute. An ignored one lets them believe they
configured a 100 GB cache in us-west-2 while running a 1 GB cache in us-east-1,
and nothing will ever tell them. Migration is bounded: a deployment with an
unknown key was already not getting that setting, so nothing it relied on stops
working — it starts being told.

LoadFromFile decodes twice, and the passes are not redundant. yaml.v2's strict
mode reports "key already set in map" when a document assigns a map key already
present in the destination, and NewDefault ships
monitoring.metrics.custom_labels: {service: objectfs} — so one strict pass into
the defaulted Configuration would tell a user that setting their own service
label is a duplicate key. Strict into a fresh zero value for the schema check,
non-strict into the defaults for the overlay. A test guards against the
collapse, which compiles and passes everything else.

Both shipped config files are rewritten. configs/example.yaml is a 60-line
copyable starting point in which every key has an effect; examples/config.yaml
is the full-schema reference, with each key that parses but is read by nothing
on the mount path marked `not yet wired` with an issue link — roughly forty of
them. Disclosing that is worse reading than hiding it and better than implying
the settings work: security.encryption.at_rest defaults true and no SSE header
exists anywhere in the codebase, so the reference says so outright.

Three tests pin it shut, located by glob rather than by a hand-maintained list:
every shipped file must load, validate, and strictly decode; must actually
*change something*, asserted reflectively against the defaults, because a file
that parses cleanly and sets nothing is still documentation of settings that do
not apply; and every YAML block in every markdown file that uses a schema key
must strictly decode, because a block captioned `# /etc/objectfs/config.yaml`
is a file a user will copy too. 11 of the 31 documented blocks failed that last
check — docs/index.md, the page the docs site opens on, offered the same
top-level `s3:` block and a 100 GB cache under keys the loader has never had.

Removed examples/config/readahead-predictive.yaml, a preset value-for-value
identical to the defaults, and GOLANGCI-LINT.md, which instructed contributors
to hand-create a v1.x config in a repository whose real config is now v2.

Refs #176
…read-modify-write

S3's PutObject replaces an entire object; the POSIX contract is "modify a byte range."
v0.10.0 had nothing that reconciled the two, and six audit findings are that one missing
concept rather than six independent bugs. internal/buffer held one contiguous []byte plus
a single offset per file — a representation that can express "a run of bytes starting
somewhere" and nothing else. It cannot hold two disjoint dirty ranges, so a filesystem
built on it must either refuse the second write or lose the first, and it did both.

What that cost, as shipped:

  - the flush callback took the offset and discarded it, so appending one byte to a 1 MiB
    file left a 1-byte object and reported success;
  - canBufferWrite refused any write that did not continue the run, returning EIO to
    SQLite, mmap writeback, tar, and HDF5 — a working filesystem reporting hardware failure;
  - Flush scheduled background work and returned nil, so close(2) reported success before
    the object existed and an AccessDenied was visible only as a counter nobody read;
  - flushBuffer deleted the buffer on success without rechecking, so a write concurrent with
    an upload was annihilated and accounted as flushed;
  - a nil flush callback counted as a successful flush, dropping every buffered byte;
  - reads never consulted the buffer, so a read after a write on the same descriptor
    returned pre-write bytes for up to the cache's five-minute TTL.

internal/vfs.Flusher does genuine read-modify-write: capture the node's generation, plan,
fetch the ranges the pending writes do not cover, splice, upload, then MarkFlushed with the
generation from step one — so a write that landed mid-upload cannot be cleared. It reads the
object back and fails on a length mismatch rather than trusting the length it sent, and its
race-retry loop is bounded at eight attempts, because spinning forever inside close(2) is
worse than reporting non-convergence: a caller can retry, but it cannot recover from a
syscall that never returns.

Absence is distinguished from every other backend failure at four seams. A HEAD that 404s is
a zero-length file; a HEAD that throttles is ErrBackend. A ranged GET that 404s mid-flush is
a hole spliced as zeros, because a concurrent delete by another client is legitimate and
failing would strand the write; a ranged GET that throttles is not, because splicing zeros
there would corrupt intact data.

Deleted with it: internal/fuse.WriteCoalescer, whose mergeWrites guarded its overlay with
`if newEnd > currentEnd`, so shorter new content over longer old content kept the old —
`echo NEW > f` over a file holding OLDER CONTENT left the file reading OLDER CONTENT. Its
thirteen tests all passed. TestWriteCoalescer_MergeOverlappingWrites is the instructive one:
it wrote two overlapping strings and then asserted only that the merge produced one write of
eleven bytes. It never looked at the bytes, and a length assertion cannot see content
corruption. Every migrated test now reads the stored object back instead.

FileHandle.Release returns the flush errno rather than discarding it with `_ = fh.Flush(ctx)`,
Flush no longer gates on the handle's own dirty bool (the write path owns that state and is
the only thing that can see a truncation or a write through another descriptor), and
Adapter.Stop flushes with the caller's context before cancelling the mount context or closing
the backend.

internal/vfs is at 98.4%. internal/fuse's floor drops from 24 to 17, which is the one shape
of lowering that is not a weakened gate: the drop is the deletion of tests for deleted code,
so numerator and denominator both fell and what remains is covered exactly as before.
v0.10.0 computed a SHA-256 of every object's uncompressed content on
upload, stored it as the objectfs-sha256 user-metadata key, and surfaced
it on HeadObject as ObjectInfo.Checksum. No read path anywhere ever
compared it against the bytes that came back.

That is why a codec mismatch, a lost Content-Encoding header, a truncated
body, a mangled multipart assembly, and bit-rot in the bucket all
returned corrupt content with a successful exit status: the one piece of
stored evidence that what came out is what went in was written and never
read. GetObject now recomputes it on every whole-object read and fails
closed with ErrCodeDataCorruption, non-retryable — a retry re-reads the
same bad bytes.

A malformed recorded value errors rather than skipping. objectfs-original-size
falls back to ContentLength for a bad value because a bad mode must not
make a file unreadable; a checksum has no safe fallback, and treating "I
cannot tell whether this is corrupt" as "this is fine" is the reasoning
that let the compression corruption ship. An object with no recorded
checksum still reads normally — refusing objects written by aws s3 cp or
boto3 would make ObjectFS unable to read the buckets it exists to mount.

Coverage of the check is decided by what S3 returned, not by whether a
Range header was sent. Those differ for the most ordinary read there is:
cat of a 4 KiB file arrives as offset=0, size=131072 — the kernel's read
buffer, not the file's length — which sends a range and gets back the
whole object. The first version of this guard keyed on the request shape,
so it declined to verify whole small files while reporting that reads
were verified. Coverage now comes from the Content-Range header itself.
Genuine fragments stay unverified, and the doc comment says so: the hash
covers the whole content, so checking a fragment means fetching the whole
object, which is the amplification the read path was just fixed to stop
doing. Per-chunk checksums belong with seekable framing, since both
change the stored layout.

Three case-sensitive metadata lookups are now case-insensitive. S3
lower-cases keys in transit but the SDK preserves the case the *server*
sent: MinIO title-cases, and an http.Header round-trip yields
Objectfs-Sha256. Against that storage the checksum lookup would find
nothing, conclude the object came from another tool, and verify nothing —
it stops checking without ever failing.

Tests corrupt objects behind the backend with a raw SDK client, so the
bytes read genuinely differ from the bytes hashed: bit flip, truncation,
extension, and replacement at identical length. Each was confirmed
non-vacuous by mutating the guard back and watching the right subtests
die. FuzzWholeObjectResponse found two real looseness bugs in the
Content-Range parse on its first run — a negative body length accepted as
a whole object, and strconv.ParseInt admitting "+4096" where RFC 9110
spells complete-length as 1*DIGIT.

One earlier test is worth recording as a caution. It seeded four metadata
spellings through a client and asserted each was detected, and it passed
against a case-sensitive lookup — vacuously, since S3 and the emulator
both lower-case keys in transit, so all four arrived as one. It would
have certified the exact failure it was written to prevent. The lookup is
now tested directly, where the response map a foreign server produces can
be constructed.

internal/storage/s3 coverage 71.9% -> 72.8%.
The read cache could not hit in the cases that matter, and the prefetcher
transferred more bytes than the files it was prefetching. Both are design
defects rather than slips, so both are fixed by changing what the code
represents rather than by adjusting a bound.

The cache key was `fmt.Sprintf("%s:%d:%d", key, offset, size)` — the length
the caller *asked for* was part of the identity of the stored bytes. Only a
reader that happened to request exactly the length previously stored could
ever hit, and neither reader that matters does: a content read arrives with
the kernel's buffer size, and a short re-read asks for its own shorter
length. The FUSE metadata cache could not hit even in principle, storing
~138 bytes under a Get that always asked 8192, so every stat cost one S3
HeadObject per path component for the life of the mount. Entries are now
identified by (object key, chunk index) in a new internal/cache/chunking.go,
the one place either cache decides what a chunk is — the two had carried
character-for-character copies of the keying logic, which is how they came
to share the same three defects.

Delete matched a bare prefix with no delimiter, so Delete("logs/app") also
flushed logs/app2 and logs/appendix. Deletion now works from an explicit
object-to-chunk index, and the composed key separates its parts with NUL
because a prefix scheme is still wrong with ":" — S3 keys may contain ":",
so "logs/app"+":" is a prefix of the entry key for the distinct object
"logs/app:0".

Nothing in internal/fuse called cache.Delete at all, so a path served its
pre-write bytes and pre-write size until the TTL expired. And the persistent
cache measured each entry with file.Stat() while the gzip.Writer wrapping
the file was closed by a deferred call, recording 10 bytes for a 330-byte
file — currentSize drives eviction, so the budget was never reached and the
cache filled the disk.

On the prefetch side: the read-ahead window defaulted to 64 KiB against the
kernel's 128 KiB MaxRead, and a prefetch shorter than the read it
anticipates cannot satisfy that read, so all 18 prefetches of a 3 MiB
sequential traversal were walked past and re-fetched — 43 GETs and 4,325,644
bytes for a 3,145,728-byte file. A prediction one read past EOF was sent to
S3 for a guaranteed 416, once per traversal. And OnRead was called only on
the cache-miss path, so a prefetch that worked hid the next read from the
detector that scheduled it, resetting the sequential-hit count and cycling
0→6→prefetch→0 forever.

In internal/vfs, Node.ReadRange now narrows a fetch at the head as well as
the tail, so a program that rewrites a file header and reads further into
the object stops paying for bytes it is about to overwrite in memory.
Node.ReadInto takes the fetched range's offset as a separate argument
because of it: the bytes belong at that offset into the caller's buffer, and
splicing a narrowed range at the buffer's start shifts the whole object
earlier with no error anywhere.

Every fix here is mutation-verified rather than merely green. Three of them
were not covered by any test when first applied — the suite passed with the
fix reverted — which is what the new tests are for: nine driving
FileHandle.Read against a real byte-range cache and a substrate-backed S3
endpoint, 27 over the cache keying, 17 over the head narrowing, and
FuzzChunkAssembly with a committed corpus. The assertions are chosen for
what each defect actually changes: bytes transferred rather than hit rate
for the window (a hit-rate assertion would have passed, since the wasted
entries were never hit and so never counted as misses), and the detector's
own contiguity state rather than GET counts for the hit-path blindness
(every byte was fetched exactly once either way).

internal/fuse ratchets 17 → 37, internal/cache 74 → 76.
The FUSE layer was missing most of its contract. There was no Setattr, so
chmod, chown, utimes, and truncate all answered ENOSYS; no Fsync, against a
documented guarantee that fsync makes data durable; no Statfs, which df
rendered as a zero-block filesystem and which go-fuse documents as required
for a working darwin mount; and no DirectoryNode.Getattr, which composed with
NullPermissions into mode 0000 on every directory — EACCES for every non-root
user, and the single defect that made v0.10.0 unusable rather than merely
unreliable.

Readdir truncated at 1000 entries twice over, once in the limit it passed and
once in the single ListObjectsV2 request underneath, and deduplicated only its
subdirectory branch while ObjectFS's own Mkdir marker guarantees two keys
yielding one entry name. Lookup collapsed every HeadObject error to ENOENT,
which Create then read as absence and wrote an empty object over a file that
was merely throttled.

The layer is now a translation shim over internal/vfs, which is what makes
these testable at all: 60 tests call a node method and assert on what is in
S3, where the only previous way in was a real mount.

Two defects surfaced from writing the assertions rather than from reading the
code:

The configured storage_tier never reached S3 on the shipped default path.
NewClientManager hardcoded CargoShip's StorageClass, and its
optimizeStorageClass falls back to exactly that field for an Archive with no
AccessPattern and no RetentionDays — every archive ObjectFS builds. With
CargoShip on by default, storage_tier: STANDARD_IA stored INTELLIGENT_TIERING
with no error, no log, and no functional symptom. Every layer in between
already agreed on the tier: ValidateWrite enforced its billing minimum, the
startup log named it, ConvertTierToStorageClass had a passing unit test. The
class an object is written with is chosen somewhere none of them look.

The harness itself failed roughly one run in six and blamed the wrong test.
httptest.Server.Close calls http.DefaultTransport.CloseIdleConnections
unconditionally, so with the recording proxy on the default transport, one
fixture's teardown broke in-flight requests belonging to every other parallel
fixture. Each proxy now owns its transport; 0 failures in 20 runs against
about 3 expected before.

Coverage floors ratchet up: internal/fuse 56 to 59 (toErrno from 16.2% to
97.3% — the package's whole error contract, previously reachable only through
whichever error an operation test happened to provoke), internal/storage/s3
71 to 73.

Closes #165, closes #166, closes #171
buildS3Config mapped six of s3.Config's thirty fields, so twenty-four
arrived at the backend zero-valued on every real mount: the storage tier,
the connection pool size, the retry limit, both network timeouts, the
multipart settings, the retry and circuit-breaker blocks, and the
parallel-read threshold. Each was a documented key in
examples/config.yaml, validated at load, then discarded at one function
(audit finding D12).

Two of those zeros were not merely inert. PoolSize zero reached
GetObjects and PutObjects as make(chan struct{}, 0) — an unbuffered
channel, not a small semaphore — so the first send blocked with no
receiver and a batch operation wedged the goroutine and whatever FUSE
request was above it. ParallelReadThreshold zero closed the gate on
parallel range GETs, which is the feature v0.10.0 was released for: the
code existed, had tests, and never ran outside them.

213319a is an instance of the same class rather than a separate story.
There the configured storage_tier was agreed on by every layer between
the file and S3 — ValidateWrite enforced its billing minimum, the startup
log named it, ConvertTierToStorageClass had a passing unit test — while
objects were stored as INTELLIGENT_TIERING, because the class was chosen
inside the transporter from a config built alongside. Same shape here: a
value the configuration names, that every layer between it and S3 agrees
about, which never arrives. Neither is visible to a test that mocks the
next layer down, because the mock restates what the caller believes.

The mapping is now one explicit assignment per field, ordered to match the
backend's struct declaration, and the four fields still unmapped each
carry their reason at the site rather than being left as an omission.
TestBuildS3ConfigMapsEveryConfiguredValue asserts output values against
literals rather than recomputing the formula — a check written as
`want := utils.ParseBytes(cfg.…ChunkSize)` agrees with any formula,
including one that reads the threshold into the chunk size.

The cost optimizer's mutex lands here rather than later, and the ordering
is the point. accessPatterns was a plain map written by RecordAccess from
both read paths, so concurrent reads of distinct objects wrote it from
several goroutines — a concurrent map write, which the runtime aborts the
process for, taking the mount and every open descriptor (M12). It was
latent only because MonitorAccessPatterns defaults false *and* this
mapping carried no part of the cost-optimization block, so the gate always
returned early. Fixing the plumbing is what makes it reachable. Nothing
now hands out a pointer into the map: RecordAccess mutates a pattern in
place and analyzeObject reads six of its fields, so returning the stored
pointer would move the race outside the lock while looking fixed.

Also: NewBackend's defaulting is exhaustive over the fields whose zero
value is not usable, which is what its doc comment already promised for
&s3.Config{Region: …} and did not deliver (M18); Validate rejects an
invalid storage_tier, a chunk size above the multipart threshold, and any
unparseable size, naming the YAML path in each message; utils.ParseBytes
is the only size parser left, replacing internal/adapter.parseSize, which
returned 1 GiB silently for anything it could not parse; and
configs/example.yaml now contains only keys that are read on the mount
path — the three that were not are gone rather than caveated.

Gate: go build, go vet, go test -race -count=1 -timeout 20m ./... all
clean; coverage gate reports 30 packages at or above their floor, with
internal/config 83→86, internal/storage/s3 73→79 and pkg/utils 81→82
ratcheted; make lint at 741 issues against a 747 baseline.

Verified by defeating the fix rather than by a passing test: stripping
RecordAccess's Lock/Unlock produced three DATA RACE reports and a failing
TestAccessPatternTrackingIsSafeUnderConcurrentReads; forcing
ParallelRead.Enabled false failed the two mapping tests naming
ParallelReadThreshold = 0; removing batchConcurrency's floor produced
`panic: makechan: size out of range`.

Refs #156
parallelGetObject called executeWithAccelerationFallback directly — no
retry, no circuit breaker, no health tracking — on exactly the reads big
enough to be worth retrying (audit findings D14 and M13). One transient
500 on one chunk of a 1 GiB read failed the whole read, and a real S3
outage was invisible to the component whose job is to notice one. Every
chunk now goes through getObjectRange, which is where that stack lives.

Three integrity properties it also owed the caller:

  - A short assembly is an error. The old code joined whatever came
    back, and HeadObject still reported the full size, so a missing tail
    read back as zeros. Both forms the shortfall takes are one error,
    which took a probe to establish: S3 clamps a range straddling the
    end of the object and refuses one starting past it, so a shrunken
    object produces short chunks at the boundary and 416s after it,
    decided purely by chunk alignment.
  - One ETag across every chunk. N ranged GETs are N points in time, and
    the whole-object SHA-256 cannot be checked against an assembled
    read, so this is a large read's only integrity evidence.
  - A failure cancels its siblings — measured at 7 MiB of an 8 MiB
    object fetched after the read had already failed.

Cancelling has a trap in it, and the obvious implementation is the wrong
one. errgroup.WithContext cancels with the failing goroutine's error as
the context's cause, and Go's HTTP client reports context.Cause in
preference to context.Canceled — so each abandoned chunk surfaced
carrying the *first* chunk's error as its own finding. One shrunken
object reported its single failure up to eight times into s3-reads,
against a threshold of three, degrading reads of objects that were
perfectly readable. The abandonment now uses an explicit cause that says
only what is true of the abandoned request.

translateError gains an InvalidRange arm for the same reason: a read
past the end of a file is the most ordinary pattern there is, and the
pessimistic default was counting three of them as a service failure.

The harness gains bounded fault injection — substrate injects by
probability, and "fail chunk 3 once, then succeed" is not expressible as
a probability — plus its own tests, which found that the raw SDK client
retries too, so a fault budget silently absorbed by a retry budget is a
test that passes for the wrong reason.

Mutation-tested: disabling any of the three mechanisms fails a test. The
sibling-cancellation test needed its budget tightened first — "not the
whole object" could never fail, since the chunk that failed serves no
bytes.
Audit finding H10. Only the part-failure path aborted, so the one path
with no abort was the one that leaked the whole object: Complete is the
last call, and by the time it fails every part has already landed. A 5
GiB write failing there left 5 GiB in the bucket.

The parts are invisible to every API a user is likely to check —
ListObjects does not show them, HeadObject reports the key absent — and
billed until a lifecycle rule reaps them. Nothing in ObjectFS has ever
called ListMultipartUploads, so from inside the filesystem the leak was
undiscoverable.

The abort is a single defer keyed on a completion flag rather than a call
per error path, because the defect was an error path that forgot rather
than an abort that was wrong. It runs on context.WithoutCancel with a
timeout of its own: a cancellation is the most common reason a large
upload fails, and an abort issued on the caller's canceled context is
never sent, which would have made abandoned parts a consequence of
shutting down cleanly.

Adds testaws.Fault.QueryKey, and it is worth saying why. The first
version of the regression test was green, and a mutation that deleted
the abort outright left it green — CreateMultipartUpload and
CompleteMultipartUpload are both a POST to /bucket/key, so a fault aimed
at Complete by method and path fired on the create, and a failed create
starts no upload for the test to find orphaned. Two of the three abort
tests were passing vacuously.

Mutation-tested: removing the abort fails all three abort tests,
reverting to the caller's context fails only the cancellation test, and
ignoring the completed flag fails only the control. That last one
corrected the control's premise — an abort after Complete does not
destroy the object, since Complete consumed the upload ID, so the flag
buys one saved request and no false leak warning rather than data
integrity. The test now asserts on the AbortMultipartUpload count,
which is the only thing that can see the difference.
Audit findings M19 and M20, plus a third defect found alongside them.

M19: Close closed prefetchQueue, whose senders are cache reads —
triggerPrefetch runs on every L1 Get, from arbitrary goroutines, with no
way to know when the last has returned. A send on a closed channel
panics, including inside a select with a default arm, so an unmount
racing a read killed the process; on a mount that is the filesystem
vanishing under every open descriptor. The queue is now never closed and
the workers retire on stopCh. Close is idempotent, where before it closed
stopCh unconditionally and panicked on its own second call.

M20: the token bucket refilled int64(elapsed.Seconds()) tokens while
assigning lastRefill = now regardless, so a call less than a second after
the previous one refilled nothing and destroyed the elapsed time. At 1 Hz
or faster it never refilled, and starting at the zero value it started
empty. A rate limiter that works when idle and not when busy is
backwards. Now nanosecond arithmetic, with lastRefill advancing only by
the span converted into tokens so the sub-token remainder carries.

Third: nothing called PredictiveCache.Close. MultiLevelCache had no
Close, and Adapter.Stop cleared the cache without releasing it — so
since the mount path enables prefetch unconditionally, every mount left
four workers and a ticker running for the life of the process.

Two findings came from writing the tests rather than from the audit.
Every pre-existing test in the package sets EnablePrefetch: false, which
is why all of this survived — so the first version of the M19 test
queued zero jobs and could not have detected the panic: predictions are
per-key and need three sequential accesses of that key, and rotating
distinct keys at offset 0 produces none. Measured 0 jobs that way, 14
with ascending offsets in one key. And the after-close guard was
initially another arm of the same select as the send, which a uniform
random choice wins only half the time: 25 of 64 reads still queued.

Six mutations, each caught by exactly the intended test.
GetObjects kept the first error and discarded it unless *every* key had failed:

    if firstError != nil && len(results) == 0 {
        return nil, firstError
    }
    return results, nil

So 999 keys fetched and one throttled returned a nil error. The map is the only
other channel a caller has, and a key missing from it reads as a nil slice — the
same value an absent object produces — so nowhere in the API could a caller tell
"this object does not exist" from "this GET was throttled and is worth retrying".
One key failing out of a thousand is both the likely case and the silent one.

GetObjects now returns what it fetched together with a non-nil error naming every
key it did not. That is the shape io.Reader has: a caller that can use partial
results reads the map, one that needs all of them checks the error. The failures
are joined rather than formatted into a message, so errors.As still reaches the
cause and a caller can ask whether the batch failed only on absent objects.

PutObjects gets the matching treatment. It has no partial-success channel, so its
error is the entire report: it now names every object that failed rather than the
first, states how many of the batch that was, and attempts all of them instead of
stopping — a caller cannot retry what it cannot learn was never tried.

The contract is written on pkg/types.Backend, where a second implementation can
read it, since this was a contract defect rather than a coding slip: there are no
production callers of either method today, and the next one to arrive would have
had nothing to read.

Six substrate-backed tests, each arranging the failure at the endpoint rather than
by stubbing the backend — what makes a partial batch partial is what the endpoint
did. Five mutations verified: restoring the old condition fails three tests,
returning an unconditional error fails the control, flattening the joined errors
into a string fails the inspectability test for each method, and making PutObjects
stop at the first failure fails on the objects that were never attempted.

internal/storage/s3 goes 79 → 81.8%, floor ratcheted to 81. Both raises this cycle
are error paths, which is where this package's coverage was thinnest and where its
defects were.

Audit finding H11. M17's other half needs no change: DeleteObject already treats
absence as a no-op through isNotFound, which covers both NoSuchKey and the NotFound
that HeadObject actually returns.
DeleteObject opens with a HeadObject, because the tier-constraint check needs the
object's age. That read's failure arm reported

    failed to get object metadata for deletion validation: ...

without naming the key, while the pool-failure arm three lines below had always
named it. It is the arm a bulk delete fails on, so `rm -r` over a thousand objects
left the operator with nothing to search for. The key was in the wrapped error's
context map but not in its rendered message, and the message is what gets logged.

Deleting a key that is not there needed no change — isNotFound already covers both
*s3types.NoSuchKey and the *s3types.NotFound that HeadObject actually returns, and
both wire codes — but nothing pinned the decision from the other side, which is the
half that is easy to get wrong once. Absence must be swallowed; a HEAD that
*failed* must not be. Reading a throttle as "already gone" would report a
successful delete for an object still sitting in the bucket, which is H11 one layer
down and worse here, because a caller told its delete succeeded has no reason to
look again.

Three tests: an absent key, a key deleted twice (the retry case — a delete whose
response was lost has to be reissuable, or a dropped packet becomes a permanent
error), and a HEAD failed with a 503 that outlasts the retry budget while the
object is still there. The last one asserts both halves separately, because "it
errored" and "it did not delete" are different claims and erroring *after* removing
the object would satisfy the first while being worse than the bug under test.

Three mutations verified: restoring the NoSuchKey-only check fails the absence
test, swallowing every HEAD failure fails the mirror, and dropping the key from the
message fails the naming assertion.

The M17 test that lived in backend_seam_test.go moved here to sit beside the case
that constrains it, and its comment saying the fix was still owed is gone with it.

One caution recorded in the test rather than fixed silently: the fault has to be
disarmed before the harness verifies the object survived, or the confirming HEAD is
throttled too and the test reports the object gone when it is merely unreadable —
an assertion answered by the fixture instead of by the code, the same shape as
targeting a multipart fault by method and path alone.

internal/storage/s3 82.1%, floor stays at 81.

Audit finding M17.
security.encryption.at_rest defaulted true and was read by nothing. A grep for
ServerSideEncryption, SSEKMS, or aws:kms across internal/ returned zero non-test
hits, while OBJECTFS.md documented a kms_key ARN two sections apart. Every object
went to S3 with no encryption header while the shipped config file said otherwise
— which is worse than no setting at all, because an operator who reads the file
has been told the review question is already answered.

The header is the whole behaviour, so this is implemented as one resolver and
three appliers rather than a boolean threaded through the write paths:

  - PutObject
  - CreateMultipartUpload — a multipart upload carries encryption on the create
    only; the part uploads inherit it
  - the CopyObject behind an attribute change
  - the CopyObject behind an automatic storage-tier transition

That last one is the one that matters most and the one with no test at all
before this. A copy does not inherit the source's encryption, so a tiering
transition would have moved an object off its key silently. It had no test
because analysis refuses any object younger than 30 days, and nothing could
plant an aged access pattern — hence SeedAccessPatternForTest.

The modes are off / sse-s3 / sse-kms, declared in internal/awsname so the
loader and the backend cannot disagree about which modes exist, and validated
at both config-load and NewBackend. off is not "unencrypted": S3 has applied
SSE-S3 unconditionally since January 2023, so off means "with S3's keys, not
requested by us," and it cannot satisfy an SSE-KMS requirement. An empty key
under sse-kms is refused rather than allowed, because S3 substitutes the shared
aws/s3 key, which cannot be audited or revoked separately from the data; a
caller who wants that key can name it as alias/aws/s3.

Bucket keys divert uploads around the CargoShip transporter, which has no
bucket-key field. Sending it an encryption configuration nobody asked for would
be this same defect with an extra step.

The in_transit and at_rest booleans are removed, not deprecated. The loader
rejects unknown keys, so a file still carrying them fails and names the key,
which is the only way the claim gets re-examined rather than silently dropped.

Verification: eight mutations, of which three survived a first pass and each
exposed a real gap — an always-bypass of CargoShip with no provenance
assertion, the untested tier-transition copy, and the buildS3Config mapping
that is the actual seam. All eight are killed now. testaws grew Request.Header
because the emulator models SSE nowhere: an object written with the header
reads back byte-identical to one written without, so only the recorded request
can fail for the right reason. Filed upstream as substrate#475.
Two independent defects, each of which hid the other. internal/adapter
constructed a metrics collector and never called Start, so the registry
was correct and unreachable: `monitoring.metrics.enabled: true` and
`global.metrics_port: 8080` were honored as far as building the counters,
the mount logged nothing amiss, and a scrape got connection refused. And
both SDK parsers matched on metric names no version of ObjectFS has ever
exported -- cache_hits, objectfs_cache_hits_total,
objectfs_io_read_operations_total -- so fixing either alone still yields
nothing.

Neither was visible to any test that inspected a struct, which is why
they shipped. A collector with no listener gathers into its registry
exactly like one with a listener; only a request over a socket tells them
apart. Nothing anywhere compared what an SDK expected against what the
server produced.

The contract is now executable. sdks/testdata/metrics-scrape.txt is a
real /metrics response captured from the collector;
TestSDKFixtureMatchesTheLiveScrape regenerates and compares it on every
Go run, both SDK suites parse the same file, and the new sdk-metrics CI
job runs them. Verified end to end: renaming cache_requests_total fails
the Go fixture test, and the regenerated fixture then fails 5 Python and
6 TypeScript tests.

Also here, because the same investigation reached them:

- RecordCacheHit had no caller anywhere in the repo, so
  objectfs_cache_requests_total carried misses only and a hit rate
  derived from it read zero on a perfectly-served workload.
- The SDKs' three invented metric sections are removed rather than
  faked. io is honestly empty: read and write are not recorded at any
  production call site, and reporting zeroes would misdescribe a working
  mount. Section keys are omitted when unmeasured -- an idle mount has
  served no cache request, and hitRate 0.0 reads as a cache that never
  hits.
- prometheus.ts extracts the parsing as free functions with no transport
  dependency. That is what makes it testable: the code sat inside
  MetricsCollector beside an axios client, so exercising it meant
  standing up a server, and nothing did.
- internal/testhttp, because both new wiring tests needed the same two
  helpers and the copies in the two files had already drifted apart in
  their failure messages.
- The M19 shutdown regression test waited a millisecond and assumed
  eight goroutines had accumulated predictions by then; it now waits for
  the condition. Its own vacuity check caught this, reporting correctly
  that no send had raced the close. Confirmed still to detect the defect.
- Both READMEs said port 9090. That number comes from
  monitoring.metrics_addr, which nothing reads.
The v0.10.0 audit found ~190 documentation overclaims. Most of this commit is
the correction, but the two most valuable things in it are code, and both were
found the same way: by trying to verify a claim instead of reading it.

Chasing "automatic re-enable after successful standard operations" in
docs/s3-acceleration.md surfaced an unsynchronized data race on
ClientManager.client and accelerationActive, written by DisableAcceleration
from any request goroutine and read by every other in-flight request. No lock
of any kind. The claim itself was also false — nothing calls the re-enable
path and Backend has no accessor to reach it — but the race is the finding.
Its window is widest exactly when it triggers: a bucket without the
acceleration configuration fails every request, so the disable path runs on
many goroutines at once, under load.

Second: TestDocumentedConfigYAMLMatchesTheSchema had been skipping the files
it exists to check. Its gate admitted a block only if it used a *top-level*
schema key, so five blocks rooted at a bare `s3:` — the right keys at the
wrong depth — were never checked, and carried four invented keys through the
exact test written to notice them. An admission test that decides what to
check is itself load-bearing; "the check passed" means nothing until you know
the check ran.

Two tests now hold ground that prose could not. The version test pins
CLAUDE.md's single-authority rule: five files claimed five different current
versions, none of them a lie when written, each correct at the moment someone
typed it. Correcting four numbers only resets that clock. It took three
patterns rather than one because the first found three stale claims and
widening it found four more — a narrow check that passes is
indistinguishable from a correct repository until you widen it.
TestVersionAndBuildInfo now builds the binary and compares `--version`
against the constant, where before it logged a checkmark beside a hardcoded
0.4.0 and asserted nothing.

The deletions are the other half. RACE_CONDITION_AUDIT.md concluded the
codebase was race-free; sixteen concurrency defects were filed after it,
mostly in files it individually blessed, and the race fixed above is a
seventeenth. It is deleted rather than corrected because it was cited: a
confidently wrong audit propagates. Eighteen inert fields on the two FUSE
config structs go the same way — settable, yaml-tagged, read by nothing, and
in two cases not implementable as written. MULTI_PROTOCOL_ROADMAP.md is
refiled as #181, its market projections dropped.

README.md gains the two tables whose absence made "POSIX-compliant" possible:
what works, what fails by design, what is missing, which tools will not run —
and what integrity is and is not guaranteed, with the change the remaining
write-path work will make, so the guarantee cannot shift silently.

Gates: gofmt clean, build clean, vet clean but for the pre-existing sdks/c
warning, full -race suite passing, lint at the 735 baseline, coverage gate
30 packages at or above floor.
Bumps the version constant, promotes the changelog, and turns the README banner
from "do not use v0.10.0" into "upgrade off it, and here is how to check your
bucket". The audit's findings are all in the 0.10.1 section already; what this
commit adds is the discovery that the release *machinery* would have mislabeled
or failed to build the artifact.

Three of seven matrix entries were guaranteed-red. internal/fuse now carries
//go:build linux || darwin and platform_unsupported.go fails the build by design
on anything else, so windows/amd64 and freebsd/amd64 could not produce a binary;
linux/armv7 fails separately and for a reason the build tags do not cover, since
0xFFFFFFFF does not fit a 32-bit int in safeIntToUint32. Three jobs failing on
every tag for reasons unrelated to the release is how a red job stops being read.
The matrix is now the four pairs that compile.

The version was not being injected. -X main.Version targeted a symbol that does
not exist — main.go declares `version` in a const block, which the linker cannot
rewrite — so every release ObjectFS has cut silently ignored the flag and shipped
whatever was hardcoded, correct only when someone remembered to edit it. Replaced
with a check that the tag and the constant agree, which is the right shape given
the constant is the documented single authority: assert the authority rather than
overwrite it and leave the source disagreeing with the artifact.

Releases were also built by a toolchain no CI job had run — the workflow pinned
Go 1.24 against go.mod's 1.26.0 — so the one build users download was the least
tested configuration here. Now read from go.mod.

Deletes both .goreleaser files. Two configs, same directory, invoked by nothing,
disagreeing on platforms, on which nonexistent symbol to inject the version into,
and on who owns the repo. One would have stamped "Scott Freedman
<[email protected]>" into every .deb and .rpm, against a LICENSE reading Scott
Friedman. release.yml is the path that actually ships; a second unexercised
definition of "how ObjectFS is released" is how the two came to diverge.

Substrate to v0.85.0. Two of its fixes land under this release's integrity work:
aws-chunked is no longer persisted as an object's Content-Encoding (substrate#428),
which is the header the read path now dispatches decoding on and fails closed
against, and HeadObject resolves task completions so HEAD agrees with GET
(substrate#457).

Full suite green with -race. Lint is 735 findings, unchanged from baseline — CI
gates new code via --new-from-merge-base and this commit adds no Go.
The lint job had never executed. golangci-lint-action@v6 refuses to install
golangci-lint v2 ("invalid version string 'v2.12.2'"), so the job errored out
in ~15s before reading a line of Go — on every commit in this release. A check
that dies during setup is worse than one that fails: it renders as a red job
beside other red jobs and gets attributed to something else.

The action is now install-only, with the binary invoked as shell in the three
steps that need it. Previously each step re-entered the action, and the
whole-repo informational step ran a bare `golangci-lint run` that was
`command not found` — masked by `|| true`, which made a missing binary and a
clean repo the same observation. The blocking step's --new-from-merge-base is
preceded by an explicit fetch of the base branch, since a pull_request checkout
fetches the merge ref and does not guarantee the base is among them.

That surfaced 70 findings in this branch's new code. Three were real:

- Two fixtures torn down while parallel subtests still used them. A
  `defer encoder.Close()` closed a zstd encoder out from under its parallel
  subtests, and a `defer cm.ReturnPooledClient(pooled)` handed a pooled client
  back to be redrawn while subtests still asserted on it. Both are now
  t.Cleanup. Neither had ever failed — the outcome depends on whether the
  runtime schedules a subtest before or after the parent's defer.

- Three property tests exploring a fraction of what they claim. `i < rng.IntN(7)`
  re-draws the bound every pass, so the loop ends as soon as one roll lands at
  or below i. Measured over 1M iterations: mean 3.000 → 2.016 operations, and
  6-operation programs 14.34% → 0.62%, a 23x under-sampling of exactly the
  longest sequences. Bound is now drawn once.

The rest were correct-but-deliberate code, suppressed with the reason recorded
at the site, plus two config-level exclusions where the rationale is identical
everywhere it applies: govet's shadow (23 findings, 23 false positives, all
`if err := f(); err != nil` — the form that prevents the bug it looks for) and
gosec G404 in tests (fixed PCG seeds exist so a CI counterexample reproduces
locally; crypto/rand cannot be seeded).

Verified: golangci-lint 0 issues on changed code, full -race suite green,
gofmt clean.
The `test` and `coverage` CI jobs had both been failing on a single go vet
warning: sdks/c/main.go's handle table converted an int64 index to and from
C.objectfs_client_t with unsafe.Pointer(uintptr(id)).

vet is right. The rule exists because the garbage collector may move an object
and cannot update a reference it cannot see is one, and vet has no way to
express "this pointer is a token." Both lines carried a //nolint:govet that had
never suppressed anything — go vet runs outside golangci-lint — and
.golangci.yml carried a path exclusion for that same reason, now removed since
the finding is gone rather than silenced.

The cast moved into two static inline functions in the cgo preamble. That makes
the property structural instead of asserted: the value never exists as a Go
pointer, so there is nothing for the collector to misinterpret.

While these jobs failed on a standing warning, a real test or coverage failure
in either was indistinguishable from it.

Verified: go vet clean, go build -buildmode=c-shared, and the C SDK's own suite
— 16 C assertions and 15 Python ctypes assertions, including the NULL-handle
arms that exercise the conversion. libobjectfs.h regenerated.
gopkg.in/yaml.v2 decodes a bare integer into a time.Duration as a raw
nanosecond count, silently. So `read: 30` — what someone writing a 30-second
timeout tries first — configured 30 nanoseconds, and a negative was accepted as
a negative duration.

Nothing downstream caught it. Every consumer defends against zero
(circuit.NewBreaker, Checker.checkLoop, Monitor.monitorLoop all substitute a
default at <= 0) and a small positive satisfies all of those guards.

FuzzConfigConstructsBackend found it on CI from a three-line document:

    network:
      timeouts:
        read: 2

The value becomes the transport's ResponseHeaderTimeout, so every request fails
before S3 can begin answering, and the mount dies inside NewBackend's health
check with "exceeded maximum number of attempts ... timeout awaiting response
headers". That names a network problem. The operator has a plausible number in
a file and an error pointing at their network — audit finding C1's shape again:
accepted by every layer that reads configuration, fatal at the layer that acts
on it, attributed to neither.

All ten durations in the schema are now checked, with a one-millisecond floor:
nothing in this schema is a setting anyone wants below it, and nothing the unit
trap produces falls above it. It refuses rather than clamps, because a clamp
substitutes a duration the operator did not choose and there is no reading of
30ns that is what they asked for. Zero stays valid and still means "use the
built-in default", so a partial config file works as before. The message states
the unit rule and shows the value they likely meant, since the fix is a suffix
and nothing about the file suggests nanoseconds.

A reflection test walks the config structs and fails for any time.Duration the
check does not cover. It earned its place immediately: it found
write_buffer.flush_interval, which the grep that produced the hand-written list
had missed because the field is declared with different alignment from its
neighbours.

Both shipped example configs now state the unit rule where an operator copies
from.

Verified: the counterexample passes, 1.14M further fuzz executions found
nothing new, full -race suite green, lint clean.
test and coverage were the only failing jobs on the release branch. Neither
was a flake, and neither reproduced on macOS — which is the finding, not an
inconvenience.

TestPrefetchDoesNotAmplifyReads failed in CI and passed locally because the
prefetcher and the reader issue byte-identical requests. A prefetch covers the
range the reader is predicted to want next, at the length of the read that
predicted it, so which one reaches S3 first is a race between a network round
trip and the application's next read(2). Idle, the prefetch wins and the
traversal transfers exactly the file; loaded, the reader wins and both fetch
the same bytes. CI measured 5,373,952 bytes across 41 GETs for a 3,145,728-byte
file: 24 reads plus 17 prefetches, every prefetch paid for twice. Reproduced on
linux/arm64 pinned to one CPU, then fixed by sharing one flight between
concurrent callers wanting the same range, so the byte count is a property of
the read pattern rather than of machine load. The cache re-check moved inside
the flight, since a caller that missed and then waited may find the bytes
already stored by the time it runs.

internal/network was below its coverage floor because the floor was measured on
the platform that does not compile the code. The package splits on //go:build:
macOS supplies a 24-line stub where Linux supplies 66 lines. Read on macOS it
was 100%; in CI, 86.9% — setTCPCongestion at 0%, newPlatformDialer at 20% with
its Control closure never invoked because nothing dialed, both procfs readers
missing their absent-file arms. The new linux-only tests dial real loopback so
the hook runs, read TCP_CONGESTION back to confirm the option took rather than
that the call was made, and point the procfs paths at fixtures. 98.8% now, and
the floor is set from Linux with the reason recorded: a per-package floor set on
one platform is a claim about a file set that platform does not compile.

internal/awsname had been failing the same gate for a related reason. Every
case in TestRegionIsResolvable sets AWS_CONFIG_FILE explicitly so the result
does not depend on the host — leaving the ~/.aws/config fallback, the arm that
runs in production, as the only untested path. Covered by redirecting HOME,
along with the UserHomeDir failure arm and a directory at AWS_CONFIG_FILE,
where the stat succeeds and only the IsDir check prevents handing the SDK an
unreadable path.

Verified on linux/arm64 in a container, which is where all three live: full
suite exit 0, coverage gate with no FAIL lines, 25 prefetch runs including 15
on a single CPU. x/sync/singleflight for the dedup; x/sys promoted to a direct
dependency for GetsockoptString, which the standard library does not have.
… file

Three CI jobs were red on 653e2c0. Two were real and shared a shape: a
property measured on one platform, or one scheduler, asserted as if it
held everywhere.

coverage — internal/health at 44.7% against a floor of 45. Locally it
measured 45.0%, deterministically, six runs in a row. The difference is
one two-statement block: startHTTPServer's bind-error arm, hit five times
at -cpu=8 and never at -cpu=1, which reproduces CI's 44.7% exactly.

Eight tests start a Monitor whose default Config enables the health
endpoint on the fixed port 8081. Each Start raced its siblings for that
one port; the first won and the rest took the error arm. So the package's
coverage was a function of machine load, and the floor had been set from
the luckier of the two numbers.

Lowering the floor would have hidden the finding underneath: the endpoint
a probe or a load balancer actually reads had never served a request in a
test. Its only coverage came from tests failing to bind it. The bind is
now split from the serving so a test can supply a listener on port 0, the
tests that are not about the endpoint no longer open one, and a new
checker_test.go pins what a probe depends on — 200 for a passing check,
503 for a failing one, the failing check named in the body, the port
released on Stop, and the bind failure staying non-fatal. 48.5% at every
-cpu value from 1 to 8.

lint — eleven findings, all in internal/network/congestion_linux_test.go,
which //go:build linux excludes from the darwin build. My local run
reported "0 issues." because golangci-lint had not compiled the file at
all. GOOS=linux golangci-lint run reproduces CI, and is what I should
have run when adding a platform-gated file to a package whose floor had
just been wrong for the same reason.

Nine were paralleltest. The cause was mine: the test redirected
package-level path variables, so no case could be parallel without racing
its sibling. Paths are constants again and the readers take one as a
parameter, so all six tests are parallel and the seam has no shadow. Two
were noctx, now ListenConfig.Listen and Dialer.DialContext. Fixing those
surfaced five more that only GOOS=linux sees, including a contextcheck on
code this commit adds — the shutdown deadline now derives from the
caller's context rather than context.Background, so a caller that has
given up does not get five more seconds of drain.

fuzz-smoke (difftest/FuzzOperationSequence) — not a defect. Exit 143,
"The runner has received a shutdown signal", at 45s of a 60s budget: the
runner was reclaimed. 90s locally finds no counterexample. It needs a
re-run, not a change.

Verified: full linux suite as non-root (exit 0), coverage gate on a real
linux profile (network 98.8/98, health 48.5/48), golangci-lint clean
under both GOOS=linux and darwin, local -race suite green across 32
packages, gofmt/build/vet clean.
Two consecutive CI runs failed fuzz-smoke on ./internal/difftest with
"fuzzing process hung or terminated unexpectedly while minimizing: EOF",
each naming a different input and writing it to testdata/fuzz/. Every
input so written replays green, because none of them was the problem.

go test -fuzz runs one worker process per CPU. Each is an independent Go
runtime that sizes its heap against total machine memory, since none of
them knows the other three exist. FuzzOperationSequence allocates hard —
every iteration is a real read-modify-write over a real HTTP endpoint —
so four workers reached 6 GB RSS within four seconds and the cgroup
OOM-killed one. Reproduced in a 7 GB container: oom_kill 1, "signal:
killed".

The first failure was written off as runner preemption, which exit 143
and a shutdown-signal message support. What it did not explain was 24
seconds of `execs: 1443 (0/sec)` with all four workers idle followed by
recovery at 39s. That is page thrash and TIME_WAIT drain, not a hang.

GOMEMLIMIT=768MiB per worker. The memory was garbage the collector had
no pressure signal to reclaim, not live data, so the cap costs nothing
and returns the time that went into thrash — verified with the exact CI
command, coverage-guided, in a container tighter than the runner:

  before: 1443 execs,  3 new interesting, OOM-killed at ~40s
  after: 24679 execs, 48 new interesting, exit 0, peak 3.2 GB

Set for every target, not just the one that died: the cause is the
per-worker runtime's view of memory, which they all share. A target that
allocates less never reaches the limit.

Measured alternatives at the same 45s budget — 384MiB: 1.4 GB peak,
13.5k execs; 1536MiB: 5.7 GB peak, 26.1k execs. The knee is at 768.
TestPrefetchStopsAtEndOfFile failed in CI reporting 17408 bytes for a
16384-byte file. It did not reproduce locally in ten runs, at -cpu=1/2/4,
in the whole package, or in a linux container — but 17408 is 16384 + 1024,
exactly one read, which is not what a flake looks like.

The singleflight this replaces was keyed on (path, offset, length), on the
stated grounds that a prefetch and the read it anticipates are byte-identical
"by construction". They are not. prefetchLength floors the prefetch at
ReadAheadConfig.WindowSize, so a reader whose reads are smaller than the
window gets a prefetch that is a strict superset of its next read — and two
overlapping-but-unequal ranges hash to different keys and collapse into
nothing. Every earlier measurement used 128 KiB reads against the 64 KiB
default, where the floor never engages and the ranges really are equal, so
the case went unexercised until a 16 KiB file read in 1 KiB steps transferred
27,648 bytes: 1.7x, entirely duplicate.

Containment subsumes equality and answers all four GETs in that trace from
one transfer. It leaves a third case, the one neither direction of
containment covers: a prefetch whose range *contains* an in-flight read. The
read holds fewer bytes than the prefetch wants, so nothing can serve it —
and it is what a reader that wins the race produces every time. performPrefetch
now advances its start past any in-flight fetch covering its first byte.

Trimming rather than skipping, and that is the whole distinction: skipping
outright also transfers exactly the file, by never prefetching at all. The
same traversal went to 16 GETs, one per read, read-ahead contributing
nothing. Trimmed it is 8, the tail fetched once and ahead of the reader.

The test grows the no-pause pacing as a second case. Its 20 ms sleeps were
what hid this locally — the test asserted the right property from the start
and CI's load removed the mask — plus an assertion that the GET count stays
below the read count, so a future prefetch that stands off instead of
trimming fails here rather than passing on byte count alone.

Also: the recording proxy now closes its upstream connections before the
emulator shuts down. http.Server.Shutdown grants a connection in StateNew a
hardcoded five-second grace (go.dev/issue/22682), and the proxy's transport
parks exactly one whenever concurrency opens a second connection the winner
did not need. That was 5.44s of teardown on a 7ms test, appearing and
vanishing with the test's pacing rather than with anything it asserted. The
whole suite now runs in the time internal/fuse alone used to take.
Every release this project has cut failed, and v0.10.0's published release page carries zero
downloadable assets. The mechanism was the job order: `create-release` ran first and every other
job depended on it for an `upload_url`, so the irreversible half of a release happened before
anything had been compiled. When darwin/arm64 failed, the other six matrix entries were cancelled
with it and the page was already up.

Now `build` produces artifacts, `publish` needs them, and a failed build leaves no release at all —
recoverable by fixing the build and re-pushing the tag, where an empty page is not. `gh release
create` attaches every asset in the same call that creates the release, which also retires
`actions/create-release@v1` and `actions/upload-release-asset@v1`: both archived, both on Node 12,
and the `upload_url` they passed between jobs was itself why the release had to exist first.

The notes come from the CHANGELOG section for the tag rather than a `git log` subject dump, and a
missing section fails the release instead of falling back to something worse. Sections past the
API's body limit are summarized with a link to the full text — this release's own is 175 KB, which
would have failed the publish step after the artifacts were built and the image pushed.

The vulnerability scan now runs against the artifact about to be published; it used to `wget` the
asset from the release page, so it could only scan what users could already download.

`security.yml` stops publishing releases. It was "Security & Release", triggered on `tags: [v*]`,
and carried its own build/docker/release jobs — a second workflow racing this one for the same tag,
publishing with `generate_release_notes: true` and building linux only. It never actually raced,
for a reason worth writing down rather than relying on: GitHub set it to `disabled_inactivity` in
January 2026, which disables every trigger, so re-enabling it for its weekly scan would have armed
the duplicate silently.

Three jobs are deleted rather than repaired, each recorded in place so it does not return in the
same shape: `update-packages` echoed "Would update the Homebrew formula" and reported success for
work it did not do; `update-docs` deployed to GitHub Pages, which is not enabled here, and wrote
`.md` files behind `.html` links; `notify` asserted five completed tasks as unconditional text.

Verified: both container manifests now carry a matching binary (ELF `0xb7` under arm64, `0x3e`
under amd64) and the tag/version assertion passes on v0.10.1; the notes extraction was run against
the real CHANGELOG; the job graph references only jobs that exist; full suite green, 32 packages.
@scttfrdmn
scttfrdmn merged commit e969ff7 into main Aug 2, 2026
19 checks passed
scttfrdmn added a commit that referenced this pull request Aug 2, 2026
Neither of these is caused by the pin fix. Both were latent, and fixing the pin
is what let CI get far enough to run into them.

## gosec SARIF upload rejected the whole file

`Analysis upload status is failed` / `locationFromSarifResult: expected artifact
location`, three times. gosec emits three G115 integer-conversion findings with
`"artifactLocation": {}` — no file path at all — and GitHub rejects the entire
submission, discarding the other 45 findings with them.

They come from `sdks/c/main.go`, which is cgo: gosec analyses the generated
intermediate and cannot map the location back to a real file. Reproduced locally,
exactly 3 of 48 results affected.

The existing jq step already stripped `fixes` for the same class of reason. It now
also drops results with no resolvable location, taking 48 → 45 with the three bad
ones gone and every real finding preserved. Dropped rather than back-filled with a
placeholder path: inventing a location would pin a finding to a line that has
nothing to do with it. The G115 conversions in sdks/c are worth a hand audit, and a
SARIF entry pointing at the wrong file is not how to remember that.

First observation of this, because the workflow was `disabled_inactivity` from
January 2026 until it was rewritten in #191 — the `fixes` deletion was carried
forward untested along with the rest of the file.

## pkg/memmon fell below its coverage floor on a YAML-only commit

Which is a real finding, not a flake to paper over.

The package measured 51.0% or 50.6% run to run against a floor of 51 — zero
margin. CI passed on main at e969ff7 and failed on the same tree 12 minutes later.
Reproduced locally: 3 of 12 runs at 50.6%.

The variance was one statement, `monitor.go:279` — the memory-growth alert branch
in analyzeMemory — which fired only when the test's own allocations happened to
push `Alloc` past the threshold between two samples. Garbage-collector timing.

The larger half of the finding is why that branch was timing-dependent:

    alerts := monitor.GetAlerts()
    if len(alerts) == 0 {
        t.Log("No alerts generated (may be normal if memory growth is small)")
    }

TestMemoryMonitor_MemoryGrowthDetection allocated 100 MB to trigger growth
detection and then accepted either outcome. It asserted nothing — deleting the
entire growth-detection branch left it green. That is the defect class this whole
release exists to fix, in the test suite rather than in the code.

Replaced with three tests that assert:

  - MemoryGrowthDetection — seeds baselineSample/currentSample so the threshold
    comparison is the only variable. Four cases: over threshold alerts, under is
    silent, exactly at threshold is silent (the comparison is `>`, and which one it
    is decides whether a monitor configured at its steady-state growth rate alerts
    continuously or never), and shrinking does not alert. Asserts the alert carries
    BaselineMem, CurrentMem, and GrowthPct — an alert saying something grew without
    saying from what to what is not actionable.
  - AnalyzeMemoryNeedsTwoSamples — pins the early return for all three incomplete
    states. Comparing a sample to itself would report 0% growth as a fact rather
    than as an absence of data.
  - LiveSampling — keeps the real Start/sample/Stop loop under test, asserting only
    what is deterministic there (sampling happens, a baseline is established) and
    polling to a deadline instead of sleeping a guessed interval.

Result: 15 consecutive runs measure 51.9% exactly, the growth branch is covered on
every one, and analyzeMemory goes 87.0% → 95.7%.

Floor left at 51 per the file's stated policy — measured, rounded down — so it now
clears with margin rather than landing on the number. The note above it records
what happened, because a gate with zero margin is what made this visible at all.

Verified: gofmt clean · go vet clean · golangci-lint --new-from-merge-base 0 issues
· full `go test -covermode=atomic ./...` as CI runs it → coverage-gate reports all
30 packages at or above their floor.
scttfrdmn added a commit that referenced this pull request Aug 2, 2026
`go-licenses check ./...` failed on `modernc.org/mathutil`. Two things are wrong
with that, and both point the same way.

**It is a test-only dependency.** The path is
internal/testaws → substrate → sqlite → libc → mathutil, and
`go list -deps ./cmd/objectfs` contains zero modernc.org packages. It ships in
nothing. License compliance is a question about distributed artifacts, so a check
scoped to `./...` is asking about code no user receives.

**The finding is also wrong on its own terms.** mathutil has a LICENSE file
containing a textbook BSD-3-Clause — all three clauses verbatim,
Apache-2.0-compatible. go-licenses cannot classify it because the text is
reflowed, wrapping mid-clause instead of matching its matcher's expected layout.

So the alternative fix was an allowlist entry asserting a license on someone
else's behalf, which this project has no standing to do, versus scoping the check
to the artifact whose licensing anyone can actually be bound by. Scoped.

Verified: `go-licenses check ./cmd/objectfs` exits 0, and mathutil was the only
unclassified license in the whole graph — so this narrows what is checked without
suppressing any other finding.

Never reached before now for the same reason as the other two fixes in this
branch: the workflow was `disabled_inactivity` from January 2026 until #191, and
the govulncheck step ahead of it failed on every run until the toolchain pin was
fixed. Each fix has been uncovering the next step that had never executed.
scttfrdmn added a commit that referenced this pull request Aug 2, 2026
* fix(ci): pin trivy-action to a tag that exists

`aquasecurity/[email protected]` does not resolve. Every tag that action
publishes is v-prefixed — v0.26.0 through v0.36.0 — and I pinned it without the
`v` in both workflows.

An unresolvable action fails at "Set up job", before any step runs, so there are
no step logs to read and the failure presents as an infrastructure problem rather
than a typo. On the v0.10.1 tag it took down `Security Scan Release`, which
`publish` gates on, so the release did not publish.

That much is the restructure working as designed: all four Build jobs succeeded —
the first time in this project's history — and no release page exists, where
v0.10.0 published an empty one from a worse failure. Fixing forward rather than
loosening the gate.

Pinned to v0.36.0 (published 2026-04-22) rather than v0.28.0, verified to accept
`scan-type`/`scan-ref` and to forward them to the trivy CLI. The equivalent scan
was run locally against a freshly built stripped linux/amd64 binary first:
`trivy rootfs --format sarif` exits 0 and writes valid SARIF with two results.

Those two results are real and are now recorded as issue work, not silently
absorbed: GHSA-xmrv-pmrh-hhx2 (MODERATE, CVSS 5.9) in the pinned
aws-sdk-go-v2 — an EventStream header decoder that panics on a malformed frame.

Also corrects the job comment above it. It claimed a finding "blocks the release",
which this configuration does not do: trivy-action's `exit-code` has no default,
so findings annotate via SARIF and the step passes. Left that way deliberately and
said why — gating on a scan whose first output nobody had seen would make this
release contingent on a dependency bump it does not carry. A comment that
overstates what a gate does is the same defect class this release exists to fix.

* fix(ci): unblock the two gates the trivy fix made visible

Neither of these is caused by the pin fix. Both were latent, and fixing the pin
is what let CI get far enough to run into them.

## gosec SARIF upload rejected the whole file

`Analysis upload status is failed` / `locationFromSarifResult: expected artifact
location`, three times. gosec emits three G115 integer-conversion findings with
`"artifactLocation": {}` — no file path at all — and GitHub rejects the entire
submission, discarding the other 45 findings with them.

They come from `sdks/c/main.go`, which is cgo: gosec analyses the generated
intermediate and cannot map the location back to a real file. Reproduced locally,
exactly 3 of 48 results affected.

The existing jq step already stripped `fixes` for the same class of reason. It now
also drops results with no resolvable location, taking 48 → 45 with the three bad
ones gone and every real finding preserved. Dropped rather than back-filled with a
placeholder path: inventing a location would pin a finding to a line that has
nothing to do with it. The G115 conversions in sdks/c are worth a hand audit, and a
SARIF entry pointing at the wrong file is not how to remember that.

First observation of this, because the workflow was `disabled_inactivity` from
January 2026 until it was rewritten in #191 — the `fixes` deletion was carried
forward untested along with the rest of the file.

## pkg/memmon fell below its coverage floor on a YAML-only commit

Which is a real finding, not a flake to paper over.

The package measured 51.0% or 50.6% run to run against a floor of 51 — zero
margin. CI passed on main at e969ff7 and failed on the same tree 12 minutes later.
Reproduced locally: 3 of 12 runs at 50.6%.

The variance was one statement, `monitor.go:279` — the memory-growth alert branch
in analyzeMemory — which fired only when the test's own allocations happened to
push `Alloc` past the threshold between two samples. Garbage-collector timing.

The larger half of the finding is why that branch was timing-dependent:

    alerts := monitor.GetAlerts()
    if len(alerts) == 0 {
        t.Log("No alerts generated (may be normal if memory growth is small)")
    }

TestMemoryMonitor_MemoryGrowthDetection allocated 100 MB to trigger growth
detection and then accepted either outcome. It asserted nothing — deleting the
entire growth-detection branch left it green. That is the defect class this whole
release exists to fix, in the test suite rather than in the code.

Replaced with three tests that assert:

  - MemoryGrowthDetection — seeds baselineSample/currentSample so the threshold
    comparison is the only variable. Four cases: over threshold alerts, under is
    silent, exactly at threshold is silent (the comparison is `>`, and which one it
    is decides whether a monitor configured at its steady-state growth rate alerts
    continuously or never), and shrinking does not alert. Asserts the alert carries
    BaselineMem, CurrentMem, and GrowthPct — an alert saying something grew without
    saying from what to what is not actionable.
  - AnalyzeMemoryNeedsTwoSamples — pins the early return for all three incomplete
    states. Comparing a sample to itself would report 0% growth as a fact rather
    than as an absence of data.
  - LiveSampling — keeps the real Start/sample/Stop loop under test, asserting only
    what is deterministic there (sampling happens, a baseline is established) and
    polling to a deadline instead of sleeping a guessed interval.

Result: 15 consecutive runs measure 51.9% exactly, the growth branch is covered on
every one, and analyzeMemory goes 87.0% → 95.7%.

Floor left at 51 per the file's stated policy — measured, rounded down — so it now
clears with margin rather than landing on the number. The note above it records
what happened, because a gate with zero margin is what made this visible at all.

Verified: gofmt clean · go vet clean · golangci-lint --new-from-merge-base 0 issues
· full `go test -covermode=atomic ./...` as CI runs it → coverage-gate reports all
30 packages at or above their floor.

* docs(changelog): record the three CI fixes in 0.10.1

The trivy pin, the gosec SARIF filter, and the memmon test that asserted
nothing. All three are in the tree the v0.10.1 tag will point at, so they
belong in that section rather than in Unreleased.

The memmon entry leads with what the test did rather than with the coverage
number it tripped, because the flake was the smaller half of the finding: a
test that allocates 100 MB to trigger detection and then accepts either
outcome is the same defect class as the seam bugs this release exists to fix,
located in the test suite instead of the code.

* fix(deps): build with go1.26.5 and bump aws-sdk-go-v2 past GHSA-xmrv-pmrh-hhx2

govulncheck reported **20 vulnerabilities**, 19 of them in the Go standard
library. Closes #195.

## The toolchain was pinned to a patch release five behind

`go.mod` carried only `go 1.26.0`, and `actions/setup-go` with
`go-version-file: go.mod` reads that line as an *exact version spec*. CI logged
it plainly once the scan finally ran:

    Setup go version spec 1.26.0
    go version go1.26.0 linux/amd64

So every job in every workflow — including the four that build release binaries —
compiled with go1.26.0, while go1.26.5 had been out for some time. The 19
advisories were not defects in this code; they were shipped by it:

    crypto/tls        fixed in 1.26.5   (2 advisories)
    crypto/x509       fixed in 1.26.2 / 1.26.4   (6)
    net/http          fixed in 1.26.3
    net/http/httputil fixed in 1.26.3
    net, net/textproto, html/template, archive/tar   (the rest)

`crypto/x509` and `crypto/tls` are on the path to S3 on every request, and
`net/http/httputil` is what `internal/testaws` builds its recording proxy from.

Adding an explicit `toolchain go1.26.5` fixes it: setup-go prefers `toolchain`
over `go` when both are present, and the `go` line stays what it should be — the
language minimum, not a build pin. That distinction is the actual bug; one
directive was doing two jobs and the wrong one won.

Verified: 19 standard library advisories → **0**.

## The AWS SDK bump

Which left one finding, the one filed as #195:

    GO-2026-5764 / GHSA-xmrv-pmrh-hhx2  (MODERATE, CVSS 5.9)
      aws-sdk-go-v2/aws/protocol/eventstream  v1.7.1  → v1.7.8
      aws-sdk-go-v2/service/s3                v1.88.4 → v1.97.3

A malformed EventStream frame with an out-of-range header type byte panics the
decoder and terminates the host process. For a library that is one failed request;
for a FUSE mount it unmounts the filesystem under every open fd, and buffered
writes not yet flushed are gone. Same failure shape as the shutdown panics fixed
under M15/M16/M19 this release, which is why those were treated as integrity bugs.

Done here rather than deferred because the alternative was releasing with a known
advisory and a scan configured not to mention it, and because the collision #195
anticipated did not happen: smithy-go moved only v1.24.0 → v1.24.2, not to the
v1.26.0 the pricing work expects, so the two bumps do not conflict.

Nine minor versions of `service/s3` is enough surface to want real evidence, not a
green `go build`:

  - `go test -race -count=1 ./...` — full suite, not -short: **zero failures**
  - `internal/testaws` and `internal/difftest` included, which is the part that
    mattered. They assert on wire-level behavior — headers sent, ranges requested,
    bytes transferred — so an SDK bump is precisely the change that could move them
  - `AWS_PROFILE=aws AWS_REGION=us-west-2 go test -race -tags=integration
    ./internal/storage/s3/...` against real S3: ok
  - coverage-gate: all 30 packages at or above their floor
  - gofmt clean, go vet clean, golangci-lint --new-from-merge-base 0 issues
  - govulncheck: **0 vulnerabilities**

* docs(changelog): record the toolchain pin and the SDK bump

Both close real advisories in the shipped artifact, so they belong in 0.10.1
rather than deferred: 19 stdlib advisories from a toolchain CI pinned five
patch releases behind, and the EventStream decoder panic that would unmount a
filesystem under every open fd.

* fix(ci): scope the license check to what we actually distribute

`go-licenses check ./...` failed on `modernc.org/mathutil`. Two things are wrong
with that, and both point the same way.

**It is a test-only dependency.** The path is
internal/testaws → substrate → sqlite → libc → mathutil, and
`go list -deps ./cmd/objectfs` contains zero modernc.org packages. It ships in
nothing. License compliance is a question about distributed artifacts, so a check
scoped to `./...` is asking about code no user receives.

**The finding is also wrong on its own terms.** mathutil has a LICENSE file
containing a textbook BSD-3-Clause — all three clauses verbatim,
Apache-2.0-compatible. go-licenses cannot classify it because the text is
reflowed, wrapping mid-clause instead of matching its matcher's expected layout.

So the alternative fix was an allowlist entry asserting a license on someone
else's behalf, which this project has no standing to do, versus scoping the check
to the artifact whose licensing anyone can actually be bound by. Scoped.

Verified: `go-licenses check ./cmd/objectfs` exits 0, and mathutil was the only
unclassified license in the whole graph — so this narrows what is checked without
suppressing any other finding.

Never reached before now for the same reason as the other two fixes in this
branch: the workflow was `disabled_inactivity` from January 2026 until #191, and
the govulncheck step ahead of it failed on every run until the toolchain pin was
fixed. Each fix has been uncovering the next step that had never executed.

* docs(changelog): record the license-check scoping

Same pattern as the other CI entries in this release: a gate that had never
run, failing on the first thing it saw, which turned out to be a test-only
dependency and a false positive on a reflowed BSD-3-Clause.
@scttfrdmn
scttfrdmn deleted the v0.10.1-integrity branch September 20, 2026 05:25
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