Skip to content

feat: add ordered --add field mutations - #255

Merged
sawka-harness merged 1 commit into
mainfrom
sawka/add-mutation
Sep 29, 2026
Merged

sawka-harness merged 1 commit into
mainfrom
sawka/add-mutation

Conversation

@sawka-harness

Copy link
Copy Markdown
Collaborator

Design

When builtin set is enabled, the CLI exposes set, del, and add together without inspecting endpoint strategies or field types. A command-local pflag collector preserves every explicit operation in flag order; positional sets follow explicit flags. The field-type mutator receives the operation kind and owns its semantics: map additions insert without overwriting (same value is idempotent; a conflicting value errors), string-set additions ensure membership, and scalar additions error. The KV update path applies the same ordered map operations. Legacy SetArgs and DelArgs views remain for existing consumers. Body construction normalizes a touched field once, applies all of its operations, and encodes once before writing; an error prevents the write.

Validation

Direct mutation-body table tests cover map and set additions, existing/conflicting values, empty values, invalid operands, opposite operation orders, preserving unrelated fields, and no input mutation. A separate lifecycle test checks repeated additions across one normalization/encoding pass. Existing KV tests now include ordered mixed operations and a conflict that prevents PUT. A focused Cobra-context test checks interleaved flag capture and positional precedence. go test ./... -count=1 and task check:specs:main passed; the spec check emitted only the existing pr_label/repo_label warnings. No live API mutation was performed.

Also records the agreed test-selection guidance in AGENTS.md: test plausible non-obvious failures rather than mechanical pass-through.

@sawka-harness
sawka-harness merged commit 8af7263 into main Sep 29, 2026
1 check passed
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