The Windows read_file_bounded path was implemented together with #3 using
a single CreateFileW handle. This adds the #9 acceptance coverage and
documents the contract:
- The size is checked before allocation and every chunk is re-checked, so
growth after the initial size check still fails with limit_exceeded and
never returns partial contents.
- Windows shares read/write/delete, so another process may append,
rename or replace the path while a background read is pending; the
read continues from the opened handle and sees one coherent version.
- Tests: empty, binary, Unicode path, exact limit, over limit before
reading, and (POSIX) a stream that grows past the limit mid-read.
- IdSequence<Tag, Rep> is per-instance, copyable and restorable, so two
worlds in one process allocate independently and a saved high-water
mark replays exactly.
- next()/next_batch() check exhaustion before mutating; failed requests
leave the sequence and application records untouched. Batches are
all-or-nothing.
- High-water only moves forward: erased records keep their ids retired.
- Fixed-width Rep (default uint64_t) plus an explicit exhausted flag make
saved state canonical and portable; restore() rejects impossible state.
- 10 standalone tests cover independence, erase/restore, copy replay,
atomic batches, exhaustion, final-boundary batches and invalid state.
- RequestLedger<Payload, Result, PayloadEqual> keys idempotent host
requests by (epoch, trusted client, request id).
- check() admits the first request, replays a recorded result for an
exact repeat (including a rejected outcome), reports in_progress while
the request is still running, rejects a changed payload and rejects
keys from an obsolete/future epoch before side effects.
- record() stores the caller-defined result exactly once; results are
never overwritten.
- Capacity/admission/archival is explicit: entries are never evicted
within an epoch (capacity_exceeded instead), and advancing the epoch
clears memory. An old request number therefore cannot execute a second
time after cleanup.
- 8 tests: replay, rejected outcome, payload conflict, delayed retry
after newer operations, epoch rollover, capacity pressure, in-flight
state/immutable result and non-advancing epoch rejection.
- Publication<T>: single-writer, multi-reader publication of complete
immutable values. acquire() returns a retainable Snapshot; a retained
snapshot stays coherent across any number of later publishes and keeps
the value alive until the last reader releases it.
- publish() is compare-and-publish over one atomic (value + version)
state: an expected epoch must match, and the new version must advance
(higher epoch, or same epoch with higher revision). Rejected publishes
leave the last good publication untouched, so a failed preparation
cannot corrupt readers.
- publish_next()/publish_epoch() convenience helpers.
- 7 tests: retained snapshots, stale-epoch rejection, non-advancing
revision, epoch reset, last-reader resource release, failed
preparation preservation and concurrent reader coherence.
- resolve_packages() takes caller-supplied package descriptions (id,
exact version, content digest, exclusive capabilities, dependency
ranges) plus selected root ids and returns an exact dependency set.
- Deterministic: canonical input ordering, descending SemVer candidate
order and canonical requirement order make the result invariant under
permutation of installed/selected input.
- Frozen PackageIdentity compares build metadata and content digest in
addition to SemVer precedence, so equal-precedence rebuilds are never
conflated; ambiguous same-id/same-precedence inputs are rejected.
- Actionable diagnostics carry kind, input package, field
(e.g. dependencies[1].range) and related id: missing dependency,
incompatible version, cycle, ambiguity, competing exclusive providers.
- Bounded package/edge/search-node limits with backtracking search.
- 13 standalone tests cover closure, order invariance, diagnostics,
backtracking, cycles, capabilities, frozen identity and limits.
- replace_file/atomic_write gain a Win32 implementation: exclusive
CREATE_NEW staging in the destination directory, WriteFile loop,
FlushFileBuffers for durable_sync, MoveFileExW(MOVEFILE_REPLACE_EXISTING
[| MOVEFILE_WRITE_THROUGH]) for atomic publication and a parent-directory
flush for durability.
- read_file_bounded/write_file implemented on Windows so the contract is
usable and testable there.
- Documented Windows guarantees per durability level, including the
application-crash vs power-loss distinction and post-rename failure
reporting (sync_parent + visible_on_disk + durability_unknown).
- Added a portable contract test (first creation, replacement, Unicode
name, pre-publication faults preserving old contents, post-publication
fault reporting, no staging leftovers, live destination never deleted)
and a concurrent-writer atomicity test.
- NEW Async/Retry.hpp: retry_async drives RetryState with the TimerQueue's
injected clock, awaits backoff via sleep_until, resumes only after a clean
sleep (any sleep error ends the retry), preserves success after stop,
supports Task-returning and move-only callables
- Tests: AsyncRetry (15), DeadlineDomains blocking-retry manual-clock case
Review: W11-REVIEW-B1b READY (deviation accepted; doc fix applied by root)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>