fix(evolution): 🐛 bound the epoch-stamp mark by combined_size - #267
Draft
diagonal-hamiltonian wants to merge 2 commits into
Draft
fix(evolution): 🐛 bound the epoch-stamp mark by combined_size#267diagonal-hamiltonian wants to merge 2 commits into
diagonal-hamiltonian wants to merge 2 commits into
Conversation
resolve_self_queries marked under `found[j] < op_size`, where op_size is the store size read at resolve_range_ entry, but epoch_ is sized to combined_size -- the store size at engine construction. Once the store has grown, op_size > combined_size and the mark writes past the end of epoch_, into vector slack, which is why nothing caught it. Guard on combined_size, matching the cross-rank twin resolve_incoming (Resolve.h:153). Latent, not live: the sole marking pass is is_leader_pass, and run_exchange(true, ...) resolves self queries before both insert paths, so today the two sizes coincide. Reordering the passes breaks it. Dropping such a mark is result-neutral, not merely in-bounds. Both is_marked readers (:406, :482) read scan-source indices out of `fused`, built at :562-565 before the engine is constructed at :592-598, so every index reaching is_marked is < combined_size. A mark at or above it is unreadable. The test constructs the out-of-bounds ordering rather than asserting the accident: begin_gate(6) then combined_size=4, so query 2 resolves to found=5 against op_size=6 and the unfixed code writes epoch_[5]. Verified by mutation -- reverting the guard fails the case deterministically.
|
Docs preview: https://pr-267.monoprop-docs.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Summary
Bounds the epoch-stamp mark in
resolve_self_queriesbycombined_sizeso it can no longer writepast the end of
epoch_.fix/epoch-stamp-bounds-guard92e352b, 1 commit one0c528e, 2 files+69/−2.
resolve_self_queriesmarks underfound[j] < op_size— the store size read atresolve_range_entry — butepoch_is sized tocombined_size, the store size at engineconstruction. Once the store has grown,
op_size > combined_sizeand the mark writes past theend of
epoch_, into vector slack. Silently. This matches what the cross-rank twinresolve_incoming(Resolve.h:153) already does.is_leader_pass, andrun_exchange(true, …)resolves self queries before both insert paths, so today the two sizes coincide. Reordering the
passes breaks it. Pre-dates perf(evolution): ⚡ halve the follower-marking epoch stamp #259 and is kept out of it deliberately.
is_markedreaders(
:406,:482) read scan-source indices out offused, built at:562-565before the engineis constructed at
:592-598— so every index reachingis_markedis< combined_size, and amark at or above it is unreadable.
begin_gate(6)thencombined_size=4, so query 2 resolves tofound=5againstop_size=6andthe unfixed code writes
epoch_[5]. Mutation-verified — reverting the guard fails the casedeterministically.
Changes
resolve_self_queriesbycombined_size, matchingresolve_incoming's existing guard.is_leader_pass, never presentsop_size > combined_size; the guard protects against reordering the passes, not against a livebug.
begin_gate(6),combined_size=4) instead of relying on today's coincidental sizing.Measurement
No campaign and no table here: the only marking pass is
is_leader_pass, once per pass, so oneadded comparison on that path cannot move a timing. Gates:
ctest -L unit217/217,-L serial216/216.
Relationship to the open PRs
Independent of #259 and #263 — no stacking needed. Pre-dates #259 and is deliberately kept out of it
so the stamp-narrowing story there stays one mechanism. Verified per-file against both heads: one
conflict hunk against each, in
cpp/tests/evolution_detail_tests.cpponly, from adjacent testinsertions.
Engine.hitself merges clean against #263 even though that PR edits the same file —different regions.
Checklist
docs/,CONTRIBUTING.md) if neededCHANGELOG/ release notes updated if applicableAI/LLM disclosure
Important
By opening this PR I confirm that I have read CONTRIBUTING.md and I agree to the terms of the Contributor License Agreement.
Warning
If you're contributing on behalf of your employer, contact cla@algorithmiq.fi to arrange a Corporate CLA.