Repository navigation
terni: Measurement::accumulate keeps both losses through a Failure - #2
Merged
Merged
Conversation
…ate drops the other side's loss on Failure The arm `(Failure(e, l), _) | (_, Failure(e, l)) => Failure(e, l)` keeps only the failing side's loss. The spec (prism/docs/spec/imperfect.md, "What must never happen") forbids composition dropping loss and a failure's earlier cost being thrown away; accumulate's own docstring says "Loss combines." Tests, in self-then-other order (same as the Partial+Partial arm): - Partial(l1) + Failure(e, l2) → Failure(e, l1 ⊕ l2), and the mirror order - Failure(a, l1) + Failure(b, l2) → Failure(a, l1 ⊕ l2): first error wins, as the existing arm already does - total stays absorbing: Partial(total) + Failure(e, 3) currently gives 3 - law over u64, usize, Vec<String>, String, ConvergenceLoss, (u64, Vec) Red against the unchanged implementation: 5 failing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G8bTSUPSTntzPWqYHKMepf
…ate carries both losses through a Failure Only the Failure arm changes. The error is unchanged (self's error if self failed, so the first wins when both fail); the loss is now self_loss.combine(other_loss), the same order as Partial+Partial. A Success side contributes zero, so Failure+Settled keeps its loss by the identity law. total stays absorbing: Partial(total) + Failure(e, 3) is now Failure(e, total). Mutants checked: restoring the drop fails 5 tests; swapping the combine order in the self-failed arm fails 3. fmt, clippy --all-targets -D warnings, cargo test --workspace (226 + 22 + 4 doc) clean. Line coverage 97.34 % (main 97.28 %, gate 99 % is older debt). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G8bTSUPSTntzPWqYHKMepf
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.
Measurement::accumulatedropped the other side's loss onFailure, breaking "composition never drops loss" and the absorbingtotal. Red first; the first error still wins; the loss isl1.combine(l2). Property test over six loss types.Merged by prism-Reed at Alex's request ("Regarding the merges. You can do that.").
🤖 Generated with Claude Code
https://claude.ai/code/session_01G8bTSUPSTntzPWqYHKMepf