Drop failed runtime prototype uploads. - #6548
Open
rhailrake wants to merge 4 commits into
Open
Conversation
Comment on lines
+501
to
+524
| private void ValidatePrototype( | ||
| Type kind, | ||
| string id, | ||
| MappingDataNode mapping, | ||
| YamlValidationContext context) | ||
| { | ||
| var validationMapping = mapping; | ||
| if (mapping.Has("type")) | ||
| { | ||
| // Runtime-loaded mappings still include "type"; field validation already knows the prototype kind. | ||
| validationMapping = mapping.Copy(); | ||
| validationMapping.Remove("type"); | ||
| } | ||
|
|
||
| var errors = _serializationManager.ValidateNode(kind, validationMapping, context) | ||
| .GetErrors() | ||
| .ToArray(); | ||
|
|
||
| if (errors.Length == 0) | ||
| return; | ||
|
|
||
| var errorText = string.Join("\n", errors.Select(x => x.ErrorReason)); | ||
| throw new PrototypeLoadException($"Validation failed for {kind}({id})\n{errorText}"); | ||
| } |
Contributor
There was a problem hiding this comment.
I need to inspect this in more detail.
Contributor
Author
There was a problem hiding this comment.
No problem. I also added a regression case for a partially valid upload to verify that the previously accepted prototype state is restored after a failure.
rhailrake
marked this pull request as draft
August 6, 2026 04:46
rhailrake
marked this pull request as ready for review
August 6, 2026 05:04
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.
Fixes #6502.
Runtime prototype uploads now fail as a transaction: bad uploads are dropped before being added to replay state or broadcast to clients.
If loading an upload partially mutates prototype state before failing, the prototype manager is reset and previously accepted uploads are reapplied. Strict reload validation is used for uploads so validation-only failures are rejected too, while normal prototype reload behavior remains unchanged.