Skip to content

fix: [FME-17257]: point fme.spec.yaml at real v4 FME endpoints - #111

Draft
puthrayaharness wants to merge 4 commits into
mainfrom
worktree-fme-spec-fix
Draft

fix: [FME-17257]: point fme.spec.yaml at real v4 FME endpoints#111
puthrayaharness wants to merge 4 commits into
mainfrom
worktree-fme-spec-fix

Conversation

@puthrayaharness

@puthrayaharness puthrayaharness commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

fme.spec.yaml pointed every FME command at the wrong API (/v3/..., entity-wrapped responses). Fixed feature_flag against the real /fme/internal/api/v4/... API, then extended the spec with segment, fme_environment, segment:definition, segment:definition_keys using the same pattern.

feature_flag fixes

Issue Fix
Paths used /v3/feature-flag... /fme/internal/api/v4/...
GET/list assumed entity-wrapped Dropped .entity (it.entity.Xit.X)
POST/PATCH responses are entity-wrapped ({"entity":..., "governance":...}) item_expr: it.entity on mutation commands
flags["traffic-type"] parsed as flags.traffic - type under expr-lang Bracket access
Field drift: killedisKilled, no modifiedAt on definitions it.isKilled; created reads it.createdAt
update feature_flag --set description=... had no mutable field Added mutable_path: description

New resources

Noun Commands Notes
segment list/get/create/update/delete Addressed by name, like feature_flag
fme_environment list/get/create/update/delete Named fme_environment, not environment — that noun/alias belongs to the CD module. Addressed by UUID (it.id), not name
segment:definition list/get/create/update/delete Scoped by --env; list has no parent-id requirement (env-scoped, not segment-scoped)
segment:definition_keys list, execute ...:definition_keys_add/_remove Response is {"keys": [...], "governance": ...} (no entity) → item_expr: it.keys. Dedicated fields_noun: segment_definition_keys for raw string items

Soft-archive delete confirmed live: DELETE returns 200 with no body; subsequent GET on an archived segment/segment_definition returns 404.

Test plan

Area Status
go test ./..., modules/har, check:specs:main ✅ pass
pkg/specloader/fme_spec_test.go ✅ new coverage: list/get feature_flag/fme_environment/segment, list segment:definition/segment:definition_keys (incl. --envenvironment_id, fields_noun override)
feature_flag full lifecycle, fme_environment CRUD, segment CRUD, segment:definition list ✅ live-verified against qa.harness.io
segment:definition create/update/delete, definition_keys_add/_remove ⚠️ request shape confirmed correct against the merged backend route/DTOs, but blocked by RBAC (403 forbidden) on the test PAT — not exercised end-to-end

Caveats

  • segment:definition writes: confirmed against the backend repo that the route (POST/PATCH/DELETE .../segment-definitions/{name}, environment_id query param, keys/keys/remove body/response shapes) matches this spec exactly. The 403s are legitimate RBAC (CREATE/EDIT/DELETE permission on segment-definitions for that project/environment), not a spec or rollout issue — the qa test account needs a role grant to exercise these live.
  • Pre-existing gap, not fixed here: update feature_flag:definition --set trafficAllocation=... fails "unknown or read-only field" — MutableFields only reads noun-level fields, not a noun-variant's fields_extra. Needs a registry/spec engine change; out of scope.

Manual verification

harness list feature_flag --profile qa
harness create feature_flag cli-smoke-test --traffic-type user --profile qa
harness execute feature_flag:archive cli-smoke-test --profile qa
harness delete feature_flag cli-smoke-test --force --profile qa

harness list fme_environment --profile qa
harness create fme_environment cli-smoke-env --profile qa
harness update fme_environment <env-uuid> --set production=true --profile qa
harness delete fme_environment <env-uuid> --force --profile qa

harness create segment cli-smoke-segment --traffic-type user --profile qa
harness list segment:definition --env <env-uuid> --profile qa
harness delete segment cli-smoke-segment --force --profile qa

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
@CLAassistant

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 sign our Contributor License Agreement before we can accept your contribution.


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.

Deepak Puthraya added 3 commits August 12, 2026 15:15
…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
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