Skip to content

fix: [FME-17257]: public FME v4 paths and CLI gap fixes - #113

Draft
ravindraharness wants to merge 6 commits into
harness:mainfrom
ravindraharness:fix/fme-cli-public-path-and-gaps
Draft

fix: [FME-17257]: public FME v4 paths and CLI gap fixes#113
ravindraharness wants to merge 6 commits into
harness:mainfrom
ravindraharness:fix/fme-cli-public-path-and-gaps

Conversation

@ravindraharness

@ravindraharness ravindraharness commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Rebased onto Deepak's latest #111 (a922091: public /fme/api/v4 paths, fields_noun for definitions, required-array flags, --set traffic_allocation).

This PR adds only what #111 does not:

  • Parse RFC 7807 detail in API errors so env delete hasDependents shows token IDs.
  • MutableFields includes command fields_extra (engine), not only noun fields.
  • Help text on delete fme_environment for API-token dependents.

Test plan

  • go test ./pkg/client/ ./pkg/registry/ ./pkg/specloader/
  • Rebased onto pull/111/head; no duplicate /internal/ path rewrite

Deepak Puthraya added 5 commits August 12, 2026 14:40
pkg/spec/fme.spec.yaml declared feature_flag/feature_flag:definition
commands against /v3/feature-flag... paths with entity-wrapped JSON, but
the live FME API is /fme/internal/api/v4/... and returns flat items with
no entity wrapper. Swap the path prefix, drop every it.entity indirection,
and fix the killed->isKilled and modifiedAt->createdAt field drift so list
and get actually work against the real API.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

AI-Session-Id: 20b23a2d-5d3f-4d25-9879-167a341599d4
AI-Tool: claude-code
AI-Model: unknown
…pe flag

Live verification against qa.harness.io surfaced two more real-API drifts
beyond the read-path fixes in the previous commit:

- POST/PATCH responses for feature_flag and feature_flag:definition wrap
  the resource in {"entity": {...}, "governance": {...}}, unlike the flat
  GET/list shape. item_expr now reads it.entity on every create/update/
  archive/unarchive/kill/restore/reallocate command.
- `flags.traffic-type` parsed as `flags.traffic - type` under expr-lang
  (hyphens aren't valid in identifiers), so create_body_init silently
  dropped trafficType from the POST body. Switched to bracket indexing
  (flags["traffic-type"]), matching the convention already used for
  hyphenated flags elsewhere in the codebase.

Also added mutable_path to feature_flag's description field — update
feature_flag had zero mutable fields declared, so `--set` always failed
with "unknown or read-only field" regardless of path.

Verified live: full create/update/archive/unarchive/delete lifecycle for
feature_flag, and create/list/get/update/kill/restore/reallocate/delete
for feature_flag:definition, against qa.harness.io project puthraya with
a disposable flag (cleaned up after). go test ./... and modules/har's
suite both pass.

Known follow-up not fixed here: `update feature_flag:definition --set
trafficAllocation=...` (the example in the command's own help text)
still fails — MutableFields only reads noun.Fields, not the definition's
fields_extra, so there's no way to expose a definition-specific mutable
field without a registry/spec engine change. Out of scope for this
mechanical spec fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

AI-Session-Id: 20b23a2d-5d3f-4d25-9879-167a341599d4
AI-Tool: claude-code
AI-Model: unknown
…n FME v4 commands

Extends the v4-shaped fme.spec.yaml with segment (CRUD), fme_environment
(CRUD; named to avoid colliding with the CD module's "environment" noun),
segment:definition (CRUD, scoped by --env), and segment:definition_keys
(list/add/remove) commands, following the same real-API-verified approach
used for feature_flag. Live-verified against qa.harness.io: fme_environment
and segment full CRUD, and segment:definition list. segment:definition
writes and the keys add/remove commands could not be live-verified in this
session due to an in-progress backend rollout (PR #12644) causing
intermittent 403/405 responses; the request shapes are believed correct
based on the 403 responses matching the documented error contract.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

AI-Session-Id: 20b23a2d-5d3f-4d25-9879-167a341599d4
AI-Tool: claude-code
AI-Model: unknown
…dation

fields_noun belongs on CommandSpec, not nested under endpoint: — the
embedded-spec loader rejected the file with strict YAML unmarshaling
("field fields_noun not found in type spec.EndpointSpec"), failing
"Build, Test & Validate Specs" in CI. Also suppresses the expected
"missing get_id_expr" warning on segment:definition_keys (raw string
items have no id), following the same get_id_expr: "-" convention used
elsewhere in the repo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

AI-Session-Id: 20b23a2d-5d3f-4d25-9879-167a341599d4
AI-Tool: claude-code
AI-Model: unknown
…ay-flag bug, blank definition fields

Backend dropped /internal/ from all FME v4 endpoint paths
(/fme/internal/api/v4/... -> /fme/api/v4/...); update all commands and
regression tests accordingly.

Live end-to-end testing against qa.harness.io surfaced two further bugs:

- buildctx.go's required-flag check called cmdctx.GetString on every flag
  regardless of type, but is_array/is_multi flags are stored as []string in
  FlagValues, so GetString always returned "" and any required+is_array (or
  is_multi) flag was permanently rejected as missing. Only
  segment:definition_keys_remove's --keys combined required+is_array, so
  this was a latent, previously-unexercised engine bug. Fixed the check to
  branch on flag type, with a regression test.

- get/create/update/kill/restore/reallocate feature_flag:definition and
  get/create/update segment:definition rendered blank fields (Name,
  Description, Traffic Type, ...) because they fell back to the base
  feature_flag/segment noun fields, which don't apply to a definition's
  shape. Added dedicated feature_flag_definition and segment_definition
  nouns (mirroring the existing segment_definition_keys pattern) and wired
  them via fields_noun. Also added fields_noun to
  segment:definition_keys_add/_remove, which had the same issue, and fixed
  update feature_flag:definition's --set traffic_allocation (was
  undocumented/unmapped, causing "unknown or read-only field").

update segment:definition still returns an intermittent 500 from the
backend on a minimal, correct merge-patch body — confirmed backend-side,
no CLI/spec change addresses it.

AI-Session-Id: 20b23a2d-5d3f-4d25-9879-167a341599d4
AI-Tool: claude-code
AI-Model: unknown
@CLAassistant

CLAassistant commented Aug 13, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ Deepak Puthraya
❌ ravindraharness


Deepak Puthraya seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@ravindraharness
ravindraharness marked this pull request as draft August 13, 2026 21:42
@ravindraharness
ravindraharness force-pushed the fix/fme-cli-public-path-and-gaps branch from 8a6c7d9 to 0b076c3 Compare August 13, 2026 21:43
Rebased onto Deepak's latest harness#111 (public /fme/api/v4 paths, fields_noun
definitions, required-array flags). Remaining CLI-only: RFC 7807 detail
in API errors, MutableFields includes fields_extra, env-delete help for
hasDependents/API tokens.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ravindraharness
ravindraharness force-pushed the fix/fme-cli-public-path-and-gaps branch from 0b076c3 to 12035fe Compare August 13, 2026 21:57
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.

2 participants