Skip to content

Update edge-api openapi spec#2503

Draft
sitole wants to merge 1 commit intomainfrom
chore/sync-edge-api-openapi-spec
Draft

Update edge-api openapi spec#2503
sitole wants to merge 1 commit intomainfrom
chore/sync-edge-api-openapi-spec

Conversation

@sitole
Copy link
Copy Markdown
Member

@sitole sitole commented Apr 27, 2026

Updated edge-api spec with removed deprecated service discovery endpoint.

Updated edge-api spec with removed deprecated service discovery endpoint.
@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 27, 2026

PR Summary

Medium Risk
Removes an API endpoint and schema fields, which can break downstream consumers relying on the deprecated route, standby status, or mem_cache. No in-repo references were found to the removed generated client methods, reducing immediate integration risk.

Overview
Updates the Edge API OpenAPI spec and regenerated Go client to remove deprecated surface area, including dropping the /v1/service-discovery/nodes/orchestrators endpoint and its generated client methods/types, and trimming schema fields/enums by removing ClusterNodeStatus value standby and SandboxMetric.mem_cache (plus minor description formatting tweaks).

Reviewed by Cursor Bugbot for commit d206ad5. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d206ad58ef

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 251 to 252
// MemTotal Total memory in bytes
MemTotal int64 `json:"mem_total"`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep mem_cache on edge SandboxMetric

Removing mem_cache from edge.SandboxMetric breaks existing callers that still read this field when adapting edge metrics (for example packages/api/internal/clusters/resources_remote.go maps m.MemCache and v.MemCache). After this change, building the API module fails with an undefined-field error, so the edge spec/client update is not compatible with current consumers.

Useful? React with 👍 / 👎.

@@ -251,9 +248,6 @@ type SandboxMetric struct {
// DiskUsed Used disk space in bytes
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Compilation break: Removing mem_cache from edgeapi.SandboxMetric will cause a build failure in packages/api/internal/clusters/resources_remote.go, which reads m.MemCache (line 69) and v.MemCache (line 102) off values of type edgeapi.SandboxMetric. The field no longer exists in the generated struct after this PR, so the api package will not compile. The internal spec/openapi.yml and its generated api.gen.go still declare memCache as a required field on SandboxMetric, so the fix needs to either keep mem_cache in the edge spec (with the edge populating it), or remove it from the public spec and update resources_remote.go accordingly.

Comment on lines 248 to 253
// DiskUsed Used disk space in bytes
DiskUsed int64 `json:"disk_used"`

// MemCache Cached memory (page cache) in bytes
MemCache int64 `json:"mem_cache"`

// MemTotal Total memory in bytes
MemTotal int64 `json:"mem_total"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Removing the MemCache field from edge.SandboxMetric (here in generated.go and in spec/openapi-edge.yml) breaks compilation of the api package: packages/api/internal/clusters/resources_remote.go still reads this field at line 69 (MemCache: m.MemCache, where m is an edgeapi.SandboxMetric returned by V1SandboxMetricsWithResponse) and at line 102 (MemCache: v.MemCache, where v is an edgeapi.SandboxMetric from V1SandboxesMetricsWithResponse). go build ./packages/api/internal/clusters/... fails with m.MemCache undefined (type edge.SandboxMetric has no field or method MemCache). Either keep mem_cache in the edge spec, or drop the two MemCache assignments in resources_remote.go (and also drop MemCache from the public api.SandboxMetric schema for consistency).

Extended reasoning...

What the bug is

This PR drops the MemCache field from the edgeapi.SandboxMetric struct (in packages/shared/pkg/http/edge/generated.go lines 248-253) and the corresponding mem_cache property from spec/openapi-edge.yml. However, the API service still reads MemCache from values of that exact type in packages/api/internal/clusters/resources_remote.go, so the api package will no longer compile.

The specific code path

In packages/api/internal/clusters/resources_remote.go:

  • GetSandboxMetrics (line 69): raw := *res.JSON200 where res comes from V1SandboxMetricsWithResponse, so raw is []edgeapi.SandboxMetric. The loop for i, m := range raw then constructs api.SandboxMetric{ ..., MemCache: m.MemCache, ... }.
  • GetSandboxesMetrics (line 102): raw := *res.JSON200 from V1SandboxesMetricsWithResponse, so raw.Sandboxes is map[string]edgeapi.SandboxMetric. The loop for sbxID, v := range raw.Sandboxes constructs api.SandboxMetric{ ..., MemCache: v.MemCache, ... }.

Both reads target the field this PR deletes. The destination api.SandboxMetric.MemCache still exists in packages/api/internal/api/api.gen.go, so the api schema is unchanged — it's only the source field on edgeapi.SandboxMetric that is gone.

Why existing code doesn't prevent it

The cursor[bot] summary said "no in-repo references were found" for the removed surface area, but it missed these two field reads. They live in a sibling Go package (packages/api/internal/clusters) that consumes the edge client; a name-grep for MemCache wouldn't have ruled out a struct-field read on the edge type. The only other place that uses MemCache is resources_local.go, but that one reads from the unrelated clickhouse.Metrics type and still compiles fine.

Impact

Hard build break for the api service. The api package won't compile, blocking the whole binary, which means the api can't be built or shipped while consuming a remote (BYOC) cluster path. This is a merge blocker, not a runtime quirk.

Step-by-step proof

  1. Apply this PR (MemCache removed from edge.SandboxMetric in generated.go and mem_cache removed from openapi-edge.yml).
  2. Run go build ./packages/api/internal/clusters/....
  3. Compiler emits:
    packages/api/internal/clusters/resources_remote.go:69:21: m.MemCache undefined (type edge.SandboxMetric has no field or method MemCache)
    packages/api/internal/clusters/resources_remote.go:102:21: v.MemCache undefined (type edge.SandboxMetric has no field or method MemCache)
    
    (Multiple verifiers reproduced this exact output.)

How to fix

Two clean options:

  1. Keep mem_cache in the edge spec — revert the SandboxMetric.mem_cache removal in spec/openapi-edge.yml and the corresponding field in generated.go, leaving the consumers alone. This is the safest if the field is still expected over the wire.
  2. Drop MemCache consistently — in this same PR, remove the two MemCache: ..., lines in resources_remote.go (and ideally also drop MemCache from api.SandboxMetric in spec/openapi.yml / regenerate api.gen.go, plus update resources_local.go so the public api type stops carrying a field that's never populated for remote clusters).

@sitole sitole marked this pull request as draft April 27, 2026 09:59
Comment thread spec/openapi-edge.yml
- healthy
- draining
- unhealthy
- standby
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jakubno did some work here and this is not correct change. Let's wait on fixing before this pr is merged.

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