Skip to content

Adopt fw-capi typed includes: roles include=space, quota-delete jobs, decoder sweep, isolation segments - #5443

Merged
norman-abramovitz merged 6 commits into
cloudfoundry:developfrom
nabramovitz:feature/adopt-typed-includes
Jun 12, 2026
Merged

Adopt fw-capi typed includes: roles include=space, quota-delete jobs, decoder sweep, isolation segments#5443
norman-abramovitz merged 6 commits into
cloudfoundry:developfrom
nabramovitz:feature/adopt-typed-includes

Conversation

@nabramovitz

Copy link
Copy Markdown
Contributor

Summary

Adoption wave for fw-capi v3.216.8-typed-includes.2 (typed query options + typed included-block decoders + relationship-unset fix).

1. Roles include=space — delete the /v3/spaces fan-out

listRolesForUsers now requests include=space on /v3/roles and resolves each space role's parent org from the response's included block. The chunked listSpacesByGUIDs fallback (GH#5439 lineage) is deleted: at admin scale (2,500+ spaces) this was 25+ extra requests per page load — now zero. Both consumers (getNativeUsers, getNativeCurrentUserRoles) verified live against a real CF: an admin with 2,505 space roles renders fully-named org/space buckets from the single paged roles drain.

2. Quota-delete job surfacing

Org/space quota deletes returned bare 204s that swallowed the CF job reference. Both now follow the route-delete async contract: 200 fast-path envelope / 202 tracked-job handoff, with writeWithJob on the frontend so the post-delete refresh can't race the delete. Live-verified end-to-end (create 201 → delete 200 fast-path → clean refresh).

3. Typed included-decoder sweep

Eight hand-rolled json.RawMessage decoders across the service reads replaced with the typed XIncludedFrom helpers + one shared keyByGUID map-builder. Block-level soft-fail (warn + empty maps, never 502). Net −97 lines. Also fixes stale comments that misdescribed the offerings/brokers include behavior.

4. Isolation segments (green-field)

Never built in Stratos (verified by git archaeology — only V2-era type fields existed). Adds the read tier: GET /pp/v1/cf/isolation_segments/{cnsi} list + detail, StIsolationSegment DTO, and an optional isolation_segment_guid field on the space-update body that chains the V3 relationship PATCH ("" = unassign via explicit {"data":null} — required the fork's relationship-unset fix, norman-abramovitz/fw-capi#3).

Verification

  • Full make check gate green
  • Backend suite green against the tagged pin (wire-asserting httptest coverage for every new contract: include=space on the request line, zero /v3/spaces hits, quota-delete fallback/error paths, iso-segment assign/unassign bodies)
  • Live-verified via make dev against a real CF foundation (users/roles at 2,505-space admin scale, quota create/delete round-trip, services/marketplace name resolution, isolation segments endpoint)

Brings the typed include/fields/embed/purge query options, typed
XIncludedFrom decoders, and the relationship-unset {"data":null} fix
(fork PR #3) into jetstream.
listRolesForUsers now requests include=space on /v3/roles and returns
a spaceGUID-to-orgGUID map decoded from the included block, so both
getNativeUsers and getNativeCurrentUserRoles resolve a space role's
parent org in-band. Deletes the chunked listSpacesByGUIDs fallback
(GH#5439 lineage: 25+ extra requests at admin scale and request-line
fragility) — zero extra requests now. Wire-asserting tests pin
include=space on the request and zero /v3/spaces hits.

Live-verified against a real CF: admin with 2,505 space roles renders
fully-named org/space buckets from the single paged roles drain.
Org/space quota deletes returned a bare 204 that swallowed the CF job
reference. Both handlers now mirror deleteNativeRoute: 200 fast-path
envelope on quick resolve, 202 + tracked job handoff otherwise (kinds
cf.org_quota.delete / cf.space_quota.delete), bare-202 fallback when
async wiring is absent. Frontend deleteQuota paths switch to
writeWithJob so the post-delete refresh polls the job to terminal
instead of racing a still-running delete.

Live-verified: create 201, delete 200 fast-path, list refreshes clean.
Eight per-file json.RawMessage decoders across the service reads
collapse onto the capi typed helpers plus one shared keyByGUID
map-builder. Soft-fail moves from per-entry to block level (warn +
empty maps, never 502 the page). Also corrects stale comments: the
offerings handler was already decoding Included, and the brokers
handler batch-fetches spaces because CAPI rejects ?include= on
/v3/service_brokers. Net -97 lines.

Live-verified: instance plan/space names and offering broker names
resolve on the services and marketplace pages.
Green-field (verified never built — only V2-era type fields existed):
GET /pp/v1/cf/isolation_segments/{cnsi} list + detail handlers on the
org-quotas template, StIsolationSegment DTO, route registration. The
space update handler accepts an optional isolation_segment_guid body
field and chains the V3 relationship PATCH — empty string unassigns
(explicit {"data":null}, requires fork tag .2), absent leaves the
relationship untouched.

Live-verified: endpoint returns the foundation's shared segment.

@norman-abramovitz norman-abramovitz left a comment

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.

LGTM

@norman-abramovitz
norman-abramovitz merged commit a9efbc5 into cloudfoundry:develop Jun 12, 2026
12 checks passed
@nabramovitz
nabramovitz deleted the feature/adopt-typed-includes branch June 12, 2026 19:39
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