R-BA: delete the unreachable to.schemaId tiebreak from both edge comparators

Soul could not construct a selection where To.SchemaId decides the
EdgesFor/page_edges order once From, Role and To.RecordKey already
tie, but flagged that as a claim, not a proof - the same shape of
argument that was wrong twice before on this comparator (R-AT).

Traced instead of asserted: TryResolveReferenceTarget (C#) and
resolve_reference_target (Rust) resolve a reference purely from the
citer's schema, the role, and the record key, against the evaluation's
own fixed candidate index (byKey/by_key) - no edge- or caller-specific
input steers which candidate wins. Once From and Role tie (pinning the
citer's schema and the declared target type/leaves) and To.RecordKey
also ties, the resolved row - schema included - is forced identical by
construction, in both runtimes, every time. No mutation can distinguish
it because no input can, so it was deleted rather than recorded as
"equivalent": a component nothing can distinguish is a line every
future reader must reason about for no behavioural gain.

Deletes the To.Descriptor.SchemaId/to.schema_id() ThenBy/then_with from
CultNetSelectionEvaluator.EdgesFor and selection.rs's page_edges sort,
and updates the comments (in-code and the Survivor 5 test block) that
described the old five-key chain.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-23 09:08:55 +02:00
commit 492dd0e754
3 changed files with 43 additions and 19 deletions

View file

@ -1837,8 +1837,18 @@ pub fn select<R: Row + Clone>(
// whole batch. A selection carrying both `cites` and `cited` puts edges from both functions
// into one `Vec`, and each edge already knows which end (R-V: (schemaId, recordKey)) is the
// page row that produced it (`EdgeAnchor`): `cites` anchors on the citer (`from`), `cited`
// anchors on the citee (`to`). Order is deterministic: page-row order, then (from, role, to)
// in code-point order - never a `HashMap`'s iteration order.
// anchors on the citee (`to`). Order is deterministic: page-row order, then (from, role,
// to.record_key) in code-point order - never a `HashMap`'s iteration order.
//
// R-BA (docs/cultnet-selection-cut.md, "Soul, the merge gate, fourth pass"): `to.schema_id`
// used to sit last in this tiebreak and has been deleted. `resolve_reference_target` (this
// file) resolves purely from `(role, record_key)` against the evaluation's own fixed `by_key`
// and `target_leaves(role)` - neither depends on which edge or which `from` is asking - so
// within one evaluation the same `(role, record_key)` pair always resolves to the same row,
// schema included. That means once `from`, `role` and `to.record_key` already tie, `to.schema_id`
// is forced equal; no input can make it decide an order the earlier four keys did not already
// decide. Soul verified no construction breaks this (a component that cannot be distinguished
// by any input is a line every future reader must reason about for no behavioural gain).
let page_edges = if selection.has_hop() {
let page_position: HashMap<(&str, &str), usize> = page
.iter()
@ -1861,7 +1871,6 @@ pub fn select<R: Row + Clone>(
.then_with(|| a.from.schema_id().cmp(b.from.schema_id()))
.then_with(|| a.from.record_key().cmp(b.from.record_key()))
.then_with(|| a.role.cmp(&b.role))
.then_with(|| a.to.schema_id().cmp(b.to.schema_id()))
.then_with(|| a.to.record_key().cmp(b.to.record_key()))
});
kept