Normalize picked update fields and send sparse PATCH bodies - #256
Merged
Merged
Conversation
7 tasks done
sawka-harness
pushed a commit
that referenced
this pull request
Sep 30, 2026
…-f) support for feature_flag and segment (#257) * feat: [FME-17257]: add fme:owners and fme:tags field types for feature_flag Supersedes the object_set-based approach from cli#244/#245, which the team decided against (see docs/mutation.md, merged via #247-#256). This wires feature_flag's owners/tags collections into the new per-module field_type handler framework instead. - New modules/fme package, registered in main-harness.go: fme:owners and fme:tags handlers (Normalize/Mutate/Encode), following the Normalize -> Mutate (per --add/--del op, in CLI order) -> Encode lifecycle. - feature_flag's owners/tags fields get mutable_path + field_type; the update command's update_body_pick now carries both collections so a mutation can preserve the other members (merge-PATCH replaces the whole array). - Owners support add/del by "user:<email>", "user:<id>", or "group:<identifier>", matching v4's OwnerReferenceInput write shape and the email support added in Main #12882. Existing GROUP owners picked up from a GET cannot be re-encoded (v4's read side returns a group's name, never its identifier), so encodeOwners errors clearly instead of dropping the group or sending a broken request -- a known limitation until the server returns it (documented in docs/mutation.md). - Tags support add/del by name; Encode strips the read-only id before writing, since v4's TagReferenceInput only accepts {name}. - segment is intentionally untouched in this change; same treatment follows in a separate pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix: [FME-17257]: preserve existing GROUP owner identifier on write v4's read shape carries a GROUP owner's identifier under "id" (the same key USER owners use), not a separate "identifier" field — confirmed live against qa0. encodeOwners required "identifier" and had no fallback, so any flag with a GROUP owner became permanently stuck on the next owners edit. Fall back to "id" when "identifier" is absent, and match on it too. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * feat: [FME-17257]: extend fme:owners and fme:tags to segment Follow-up to #257 — wires the same fme:owners/fme:tags field types (no new Go code needed, they're already generic) into the segment noun: mutable_path + field_type on tags/owners, and update_body_pick widened to carry both collections so add/del preserves the other's members under merge-PATCH. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * feat: [FME-17257]: add file-body (-f) support and flag_sets mutability for feature_flag and segment - create/update feature_flag and create/update segment now accept file_body (-f) as an alternative to building the request from flags - dropped required: true from --traffic-type (feature_flag, segment create) and --segment-type (segment create), matching metric's existing required-flag fix, so a file body alone can satisfy them; update segment keeps --segment-type required since it is a query-param used for routing, not a body field a file could supply - added fme:flag_sets field type (modules/fme/flagsets.go) so --add/--del flag_sets.<id> can manage a feature flag definition's flag set associations, keyed by id per FlagSetReference Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 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.
Summary
Validation