Stop SourceBaselines exposing the identity's own storage - #72
Merged
Merged
Conversation
ImmutableCollectionsMarshal.AsArray on the returned ImmutableArray gave the live backing array, so any caller could rewrite an identity's baselines and change its equality and hash in place. The identity now keeps a private array and SourceBaselines returns a copy. No API change. The new test fails against the previous implementation. Closes #55 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
faa-part-107 156, hoyle-backgammon 560, srd-52-combat 250: all pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Closes #55.
ReplayCompatibilityIdentity.SourceBaselinesreturned the identity's internalImmutableArray.ImmutableCollectionsMarshal.AsArrayon it gave the live array, so any caller could rewrite the baselines and change equality and the hash in place, with no reflection. The type documented this as unfixable.It was fixable. The identity now keeps a private array, and the property returns a copy on each read. There is no API change.
Writing_through_the_exposed_baselines_cannot_rewrite_the_identity: it fails against the previous implementation and passes now.docs/calibration/0.4.0.mdis updated.release-checks.pydry run passes.🤖 Generated with Claude Code