Skip to content

feat: wire native FME segment update and segment definition keys - #832

Open
ravindraharness wants to merge 8 commits into
harness:mainfrom
ravindraharness:fme-v4-remaining-segment
Open

feat: wire native FME segment update and segment definition keys#832
ravindraharness wants to merge 8 commits into
harness:mainfrom
ravindraharness:fme-v4-remaining-segment

Conversation

@ravindraharness

@ravindraharness ravindraharness commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #806 for the remaining Harness-native FME segment surface. fme_segment already had list/get/create/delete; this PR adds update and wires membership keys onto fme_segment_definition execute actions. Legacy fme_segment_keys list/update are unchanged. Native org_id+project_id on fme_segment_keys is rejected with a pointer to those execute actions (not a silent NYI).

Dual-mode routing — this PR only

Resource Legacy (workspace_id) Harness-native (org_id+project_id)
fme_segment — (Harness-native only, as in #806) list/get/create/update/delete
fme_segment_definition — (Harness-native only) list/get/create/update/delete + execute list_keys / add_keys / remove_keys
fme_segment_keys list/update (v2) rejected — use fme_segment_definition execute actions

Native contracts

  • fme_segment.updatePATCH /fme/api/v4/segments/{name} with Content-Type: application/merge-patch+json. Body: description / tags / owners.
  • fme_segment.create — wire body matches CreateSegmentRequest (name, trafficType, optional description/tags/owners). Kind is segmentType: STANDARD | LARGE | RULE_BASED (FME_SEGMENT_KINDS; case is canonicalized). If callers pass type, MCP validates locally and omits it on the wire (not a Java field). Native POST uses skipScopeBodyInjection.
  • KeysGET/POST .../segment-definitions/{name}/keys and POST .../keys/remove, query environment_id, pagination limit/offset. Empty add_keys only when replace=true.
  • Delete 400 hasDependents — definition delete fails while membership keys remain. Sequence: remove_keys (or add_keys + replace=true + empty keys) → delete definition → delete segment.

Key implementation changes

  • src/registry/toolsets/feature-flags.ts plus tests/README.
  • src/registry/scope-utils.tsrequireHarnessNativeSegmentScope now rejects workspace_id (including mixed with org/project) and does not offer workspace_id as an alternative. No registry/index.ts, types.ts, or prompt changes.
  • README Feature Flags matrix: fme_segment update; fme_segment_definition execute list_keys, add_keys, remove_keys.

Type of Change

  • New feature

Checklist

  • Unit: tests/registry/fme-segment-native-only.test.ts + tests/registry/feature-flags.test.ts
  • pnpm docs:check (README matrix matches registry)

Coding Standards (registry-driven MCP model)

  • No new server.registerTool() calls
  • Existing feature-flags toolset extended
  • operationPolicy on every new/changed endpoint
  • Shared response extractors
  • identifierFields and scope declared
  • No console.log() in src/

Test plan

  • Unit: native update merge-patch; keys list/add/remove; workspace_id rejected on native-only ops
  • Live QA: create → update → definition create → add/list/remove keys → delete definition → delete segment

ravindraharness and others added 2 commits August 17, 2026 23:12
Native segment PATCH and definition key execute actions were the remaining v4 gaps after harness#806; point native fme_segment_keys callers at those actions instead of advertising a fake NYI native keys resource.

Co-authored-by: Cursor <cursoragent@cursor.com>
Harness NG orgIdentifier/projectIdentifier injection made v4 create and key-mutation JSON fail validation.

Co-authored-by: Cursor <cursoragent@cursor.com>
@CLAassistant

CLAassistant commented Aug 17, 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.

❌ cursoragent
❌ ravindraharness
You have signed the CLA already but the status is still pending? Let us recheck it.

ravindraharness and others added 5 commits August 17, 2026 23:27
CreateSegmentRequest has no type field, and Jackson rejects unknown JSON. Keep local type validation when callers pass it.

Co-authored-by: Cursor <cursoragent@cursor.com>
Reviewers would see describe() still requiring type after the wire omit, and add_keys allowed empty keys without replace=true. README matrix now matches the new update and key execute actions so docs:check passes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Java now requires segment_type on list and segmentType on create; omitting kind or sending JSON type 400s.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep deprecated standard/rule-based segments native-rejected and segment_keys as not-yet-implemented, matching the first dual-mode PR. New fme_segment ops stay org/project-only and reject workspace_id.

Co-authored-by: Cursor <cursoragent@cursor.com>
List already rewrote standard to STANDARD; create exact-matched
uppercase only, so the same agent input 400ed on POST.
@ravindraharness
ravindraharness marked this pull request as ready for review August 20, 2026 14:38
Comment thread src/registry/toolsets/feature-flags.ts Outdated
Remove the added Harness-native key management note from the
fme_segment_keys resource description for now.

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
responseExtractor: passthrough,
description: "Delete a segment by name.",
description:
"Delete a segment by name. MCP does not gate on kind; the backend STANDARD-store lookup 404s for LARGE/RULE_BASED names. Returns 400 hasDependents if any environment definition or flag still references it — delete definitions (after clearing keys) first.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncessary statement -

MCP does not gate on kind;

responseExtractor: passthrough,
description: "Delete a segment by name.",
description:
"Delete a segment by name. MCP does not gate on kind; the backend STANDARD-store lookup 404s for LARGE/RULE_BASED names. Returns 400 hasDependents if any environment definition or flag still references it — delete definitions (after clearing keys) first.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the unnecessary "MCP does not gate on kind;" clause from the fme_segment delete description in commit a6a2a36. The description still notes the backend STANDARD-store lookup behavior and the hasDependents dependency ordering.

@puthrayaharness

Copy link
Copy Markdown
Contributor

@cursor Review this PR in detail and align with the rest of the recent changes. Resolve merge conflicts
Also merge these changes into this PR - #833

Update the PR title/description post merge.

@cursor

cursor Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Skipping Bugbot: Bugbot could not find a matching SCM installation for this repository. Please reinstall the GitHub/GitLab installation and/or remove the installation from non-Bugbot accounts. Visit the Bugbot dashboard to update your settings.

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.

4 participants