Pick the assignment a replayed hand-off withdraws by content
A hand-off's derived withdrawal read whichever stewardship `stewardships_of` listed first. While the withdrawal is being derived the hand-off's own is excluded from what stands, so two assignments are in force at once: the one this hand-off withdrew, and whatever stewards the repo now. Key order does not tell them apart -- once a repo has changed hands ten times, `n11` sorts before `n2` -- so replaying an old hand-off derived a second withdrawal of a standing assignment and died on the identity collision instead of answering with its first receipt. `stewardship_of` now takes the stewardship whose withdrawal already carries this hand-off's key, the same content match the ruling's answer and the receiving side's assignment already use, and falls back to the one in force. The comment claiming at most one is ever in force said the opposite of what the exclusion does; it is gone. `later_than`'s resolution arm is deleted. Nothing could reach it: the Q19 cap refuses a withdrawal whose subject is a resolution of a resolution before the reinstatement rule asks what stands later, so the arm was dead and the entry Soul wrote against it could not fail. Dead code with a test that cannot reach it is what subtraction is for -- an arm no caller enters is a rule nobody can break and nobody can rely on, and leaving it would have bought a green mutation line for a branch the machine never runs. The two doc sentences that named the resolution scope go with it. Four fixtures close gaps where the code was right and the suite could not tell it from something weaker: a ruling answering a reopened question takes the next sequence rather than reproducing the withdrawn answer's; a cut spec's revisions are read within its own cut, so cut B's second does not block reinstating cut A's first; `later_in_force` counts only what stands, and reads the batch, so an assignment derived beside a withdrawal still blocks it. Entries H62-H67 pin all six. H1-H67 killed by their own tests, M0 green; 46 tests pass with no warnings; `cargo check --workspace` clean. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
7b6773020d
commit
1bcb7ceb3e
2 changed files with 246 additions and 11 deletions
|
|
@ -7,7 +7,14 @@
|
|||
# left: the sequences a replay re-derives (H52-H54), the withdrawal that would
|
||||
# re-raise an earlier record over a later one (H55-H56), the gap a sequence
|
||||
# rule must refuse (H57-H58), and three rules the suite could not tell apart
|
||||
# from weaker ones (H59-H61). Run through Epiphany's harness from this repo:
|
||||
# from weaker ones (H59-H61). H62-H67 are the second pass's own: the
|
||||
# assignment a replayed hand-off withdraws, picked by content rather than key
|
||||
# order (H62-H63), and four more rules the suite could not tell apart from
|
||||
# weaker ones (H64-H67). Run through Epiphany's harness from this repo:
|
||||
#
|
||||
# Soul's Y7 -- `later_than`'s resolution arm returning `false` -- has no entry
|
||||
# here and can have none: the arm is deleted. It was dead code behind the Q19
|
||||
# cap, so no test could reach it and no mutation of it could fail.
|
||||
#
|
||||
# H32 is re-anchored to the same follow-up: its A4 half is unreachable now
|
||||
# that a derived write takes the sequence after the batch's own records, so a
|
||||
|
|
@ -740,5 +747,69 @@ impl MindStore for OwnedRedbMessagePackBackingStore {
|
|||
let sequence = 1;
|
||||
'@
|
||||
}
|
||||
@{
|
||||
Id = 'H62'
|
||||
Rule = 'stewardship_of: the assignment a hand-off withdraws is picked by key order, so a replay after ten transfers withdraws whichever sorts first.'
|
||||
Test = 'admission::tests::a_source_side_replay_withdraws_the_assignment_it_withdrew'
|
||||
File = 'crates/huginn-mind/src/admission.rs'
|
||||
Old = @'
|
||||
let candidates = self.stewardships_of(mind, repo, hand_off_key);
|
||||
hand_off_key
|
||||
.and_then(|hand_off| {
|
||||
candidates.iter().find(|(key, _)| {
|
||||
self.resolutions().any(|(_, resolution)| {
|
||||
resolution.subject.kind == PipelineKind::Stewardship
|
||||
&& resolution.subject.id.0 == *key
|
||||
&& matches!(&resolution.outcome, ResolutionOutcome::Withdrawn { reason } if reason.0 == hand_off)
|
||||
})
|
||||
})
|
||||
})
|
||||
.or_else(|| candidates.first())
|
||||
.copied()
|
||||
'@
|
||||
New = @'
|
||||
self.stewardships_of(mind, repo, hand_off_key).first().copied()
|
||||
'@
|
||||
}
|
||||
@{
|
||||
Id = 'H63'
|
||||
Rule = 'stewardship_of: H62''s weaker half, any withdrawal of a candidate identifies it, whatever hand-off gave the reason.'
|
||||
Test = 'admission::tests::a_source_side_replay_withdraws_the_assignment_it_withdrew'
|
||||
File = 'crates/huginn-mind/src/admission.rs'
|
||||
Old = ' && matches!(&resolution.outcome, ResolutionOutcome::Withdrawn { reason } if reason.0 == hand_off)'
|
||||
New = ' && { let _ = hand_off; matches!(&resolution.outcome, ResolutionOutcome::Withdrawn { .. }) }'
|
||||
}
|
||||
@{
|
||||
Id = 'H64'
|
||||
Rule = 'derive: the ruling''s resolution matches any answer of the question, whichever ruling answered it.'
|
||||
Test = 'admission::tests::a_ruling_answering_a_reopened_question_takes_the_next_sequence'
|
||||
File = 'crates/huginn-mind/src/admission.rs'
|
||||
Old = ' matches!(outcome, ResolutionOutcome::Answered { by } if by.kind == K::Ruling && by.id.0 == staged.key)'
|
||||
New = ' matches!(outcome, ResolutionOutcome::Answered { .. })'
|
||||
}
|
||||
@{
|
||||
Id = 'H65'
|
||||
Rule = 'later_than: a cut spec is sequenced within its campaign, not within its cut.'
|
||||
Test = 'admission::tests::a_reinstatement_reads_the_revisions_of_its_own_cut'
|
||||
File = 'crates/huginn-mind/src/admission.rs'
|
||||
Old = ' other.campaign == base.campaign && other.cut == base.cut && other.revision > base.revision'
|
||||
New = ' other.campaign == base.campaign && other.revision > base.revision'
|
||||
}
|
||||
@{
|
||||
Id = 'H66'
|
||||
Rule = 'later_in_force: a later record blocks a reinstatement whether or not it still stands.'
|
||||
Test = 'admission::tests::a_withdrawn_later_assignment_does_not_block_a_reinstatement'
|
||||
File = 'crates/huginn-mind/src/admission.rs'
|
||||
Old = ' self.of_kind(kind).find(|(key, other)| later_than(base, other) && self.in_force(kind, key)).map(|(key, _)| key)'
|
||||
New = ' self.of_kind(kind).find(|(key, other)| later_than(base, other)).map(|(key, _)| key)'
|
||||
}
|
||||
@{
|
||||
Id = 'H67'
|
||||
Rule = 'later_in_force: the image only, so a later record landing in the same batch does not block.'
|
||||
Test = 'admission::tests::a_reinstatement_is_blocked_by_an_assignment_in_its_own_batch'
|
||||
File = 'crates/huginn-mind/src/admission.rs'
|
||||
Old = ' self.of_kind(kind).find(|(key, other)| later_than(base, other) && self.in_force(kind, key)).map(|(key, _)| key)'
|
||||
New = ' self.image.iter().filter(|held| held.kind == kind).map(|held| (held.key.as_str(), &held.document)).find(|(key, other)| later_than(base, other) && self.in_force(kind, key)).map(|(key, _)| key)'
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue