Skip to content

Normalize picked update fields and send sparse PATCH bodies - #256

Merged
sawka-harness merged 2 commits into
mainfrom
sawka/cli-custom-mutate
Sep 29, 2026
Merged

sawka-harness merged 2 commits into
mainfrom
sawka/cli-custom-mutate

Conversation

@sawka-harness

Copy link
Copy Markdown
Collaborator

Summary

  • Normalize present mutable fields from update_body_pick before applying mutations.
  • Build GET-then-PATCH requests from changed fields only, preserving explicit clears and body params; leave PUT bodies full.
  • Document custom field handlers and mutation behavior for FME agents, and update tests for sparse merge-PATCH.

Validation

  • go test ./pkg/registry ./pkg/cmdctx ./pkg/specloader -count=1
  • task check:specs:main (specs ok; existing list pr_label and list repo_label warnings)

@sawka-harness
sawka-harness merged commit 7168f6f into main Sep 29, 2026
1 check passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant