An epoch cannot order two writes an owner makes inside it
Two defects from review of 1c8b292.
Replacement checked the ownership epoch and nothing that ordered two writes made
inside one, so an owner could replay its own earlier record: a cohort installed
at tick 1,000 holding 50 picojoules accepted its own tick-900 record holding 100,
restoring inventory the installed one had already spent. A cohort now carries a
revision that strictly increases within an epoch, and a repeated revision is
refused as well as an older one, because a write has to be strictly later rather
than merely not earlier. A newer epoch may restart the series, since re-acquiring
ownership begins a new one, but the interval boundary is checked independently of
both, so neither advancing a revision nor re-acquiring ownership rewinds
simulated time. A later revision at the same boundary stays legitimate: that is a
correction, not a rewind.
The implicit move emptied a cohort's age classes while keeping its habitat,
genome and owner, so a moved-from record was exactly the invalid cohort create
refuses to build, and the registry accepted through a move what it rejects
through construction. The type is copy-only now, so a move decays to a copy and
the source stays whole. ADR-0030 made the genome copy-only for this same reason
in M3.1; the precedent existed and was not applied when this type was written.
Both fixes were confirmed load-bearing by reverting each alone. Removing either
ordering check fails the new regression. Removing the copy declarations fails to
compile, and not only through the static assertion: with that also removed, MSVC
proves the code after the class-count check unreachable, having established that
a moved-from vector is empty and the check always throws. That is a compile-time
proof rather than an execution, so the runtime path was checked separately under
ASan, where the same mutation exits 1.
Release 34/34, analysis, ASan 34/34 and clang-format all ran and passed here.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -319,3 +319,16 @@ invariants rather than a byte layout. All nine construction and registry guards
|
||||
were confirmed load-bearing by removing each one and observing the suite fail.
|
||||
Native Release, analysis, ASan and formatting passed 34/34; Linux CI has not run
|
||||
yet.
|
||||
|
||||
Review of `1c8b292` found two defects, both fixed with regressions confirmed to
|
||||
fail without their fix. Replacement checked the ownership epoch but nothing that
|
||||
ordered two writes inside one: a record installed at tick 1,000 holding 50
|
||||
picojoules could be replaced by its own earlier tick-900 record holding 100,
|
||||
restoring inventory the installed one had already spent. Cohorts now carry a
|
||||
revision that strictly increases within an epoch, and the interval boundary is
|
||||
checked independently, so neither advancing a revision nor re-acquiring ownership
|
||||
rewinds simulated time. Separately, the implicit move emptied a cohort's age
|
||||
classes while keeping its identities, and the registry then accepted through a
|
||||
move exactly what `create` rejects by name; the type is now copy-only, as ADR-0030
|
||||
already made the genome for the same reason. That precedent existed and should
|
||||
have been applied when the type was written.
|
||||
|
||||
Reference in New Issue
Block a user