feat(runs): prune empty setting messages before storing - #7937
Merged
Merged
Conversation
Signed-off-by: davidlin20dev <davidlin20.dev@gmail.com>
Signed-off-by: davidlin20dev <davidlin20.dev@gmail.com>
3 tasks
pingsutw
approved these changes
Aug 31, 2026
This was referenced Sep 1, 2026
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.
Tracking issue
Related to #7775. This closes task 2.1 (proto to protojson transformers), in a smaller form than the RFC specced. Related to #7932.
Why are the changes needed?
Task 2.1 asked for two transformers around stored protojson:
Hydrateon read andPruneInheritedon write. Most of that job turned out to be built into the serialization layer already:Hydrateis a no-op.INHERITis the proto3 zero value, and the nil-safe getters return it for absent fields, so a field missing from stored JSON already reads back asINHERIT. So there is nothing to implement.protojson.Marshalalready omits zero scalars and nil messages. The one gap: a client can spellINHERITas an empty message ("defaultQueue": {}), and that form is stored verbatim and echoed back byGetSettingsForEdit.The empty-message form changes no behavior (both forms read back identically), but it makes stored bytes depend on client phrasing. The Phase 2 exit criteria pins exact response bytes against
settings_customer_flow.md, which needs one canonical stored form. This PR adds the missing piece and drops the rest of 2.1.What changes were proposed in this pull request?
pruneSettingsinruns/service/settings_prune.go, called byCreateSettingsandUpdateSettingsright before marshaling:protoreflectand clears every message field with nothing populated inside it. NewSettingsfields are covered automatically.UNSETsurvives: its state field is populated, so only truly empty messages are removed.How was this patch tested?
settings_prune_test.go: removal at every nesting depth, an empty map wrapper,UNSETkept, a value kept next to an empty sibling, clean settings unchanged, and a nil guard.proto.Equal, since protojson output bytes are deliberately unstable.Labels
Check all the applicable boxes