Check the context an offer records, not the list it produced

Selection established that a context was unchanged by regenerating the
candidate list and comparing it. That cannot establish it. Four of nine
operators is only 126 distinct lists, so different contexts draw the same
one routinely, and an offer from event 1 was accepted under event 239.

An offer now records what produced it: the parent's identity and digest,
and the context itself. Selection compares those directly, before
anything else. Because the context and parent then determine the draw, a
list that still differs means the offer itself was altered, which is now
reported as its own error rather than as a context having moved.

The regression searches for a context whose draw collides with the
offer's and asserts that such a collision exists rather than assuming
one, then requires selection to reject it. It was confirmed to fail
against the previous implementation.

One expectation of mine was wrong and is now stated correctly: rewriting
an offer's recorded context to name the colliding one is accepted, and
should be. Those candidates genuinely are what that context draws, so the
result is a legitimate offer for it rather than a forgery. The check is
that the recorded context matches the current one, not provenance.
Editing a candidate remains caught, as an altered offer.

Native Release, clang-tidy analysis, ASan and format checks pass 20/20.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-23 15:37:13 -04:00
co-authored by Claude Opus 5
parent 5497f4d74c
commit badd28fe9b
5 changed files with 134 additions and 46 deletions
+11 -5
View File
@@ -55,11 +55,17 @@ reserves nothing. Cost is not invented here: it is the successor's own maintenan
and mass under ADR-0032, derived from the same rules as the parent's, so a
candidate carries a consequence rather than a price this ADR made up.
`select_mutation` takes the candidates that were offered, regenerates them from
the context, and refuses unless the whole list still matches. A changed context is
rejected outright rather than silently answered with a different mutation. Only
then is the immutable successor built, with a caller-allocated identity, the
parent recorded, and M3.1 validating it once more.
An offer therefore records what produced it: the parent's identity and digest, and
the context itself. `select_mutation` compares those against the current ones
first, and only then regenerates the list. A candidate list cannot stand in for
that comparison, because a small catalog yields few distinct lists and two
different contexts draw the same one often; comparing lists alone would accept a
stale offer. A changed context is rejected outright rather than silently answered
with a different mutation. Because the context and parent then determine the draw,
a list that still differs means the offer itself was altered, which is reported as
its own error rather than as a context having moved. Only then is the immutable
successor built, with a caller-allocated identity, the parent recorded, and M3.1
validating it once more.
## Alternatives Considered
+17
View File
@@ -620,6 +620,23 @@ and its successor checked to validate, to record parent 7, and to survive a
decode; the reported maintenance and mass are checked to equal what
`metabolic_budget` charges that successor.
Review of `5497f4d` found one defect (2026-09-23): selection established a
stale context by comparing regenerated candidate lists, which cannot establish it.
Four of nine operators is only 126 distinct lists, so different contexts draw the
same list routinely, and an offer from event 1 was accepted under event 239. An
offer now records the parent's identity and digest and the context itself, and
selection compares those directly before anything else. Because they then
determine the draw, a list that still differs means the offer was altered, which
is now its own error rather than a context having moved.
The regression searches for a context whose draw collides with the offer's,
asserts that such a collision exists rather than assuming it, and requires that
selection still rejects it. It was confirmed to fail against the previous
implementation. Rewriting the offer's recorded context to name the colliding one
is checked to be accepted, and should be: those candidates genuinely are what that
context draws, so the result is a legitimate offer for it rather than a forgery.
Editing a candidate is checked to be caught as an altered offer.
No organism mutates and no fixture calls any of this. Candidate count, context
window, mutation cost as a game rule, inherited versus acquired expression, NPC
mutation and recombination remain open and are not settled here. Golden