Skip to content

chore: sync infra OpenAPI specs#285

Open
e2b-generated-code-auto-fixer[bot] wants to merge 1 commit intomainfrom
chore/sync-infra-specs
Open

chore: sync infra OpenAPI specs#285
e2b-generated-code-auto-fixer[bot] wants to merge 1 commit intomainfrom
chore/sync-infra-specs

Conversation

@e2b-generated-code-auto-fixer
Copy link
Copy Markdown
Contributor

This PR syncs OpenAPI specs from e2b-dev/infra:

  • spec/openapi.infra.yaml
  • spec/openapi.dashboard-api.yaml

It also regenerates dependent TypeScript API types and applies formatting/lint autofixes.


This PR was automatically created by the sync-infra-specs workflow.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Apr 1, 2026 3:49pm
web-juliett Ready Ready Preview, Comment Apr 1, 2026 3:49pm

Request Review

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: 837b7439b9

ℹ️ 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".

- cpuUsedPct
- memUsed
- memTotal
- memCache
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep SandboxMetric fixtures type-compatible

Adding memCache as a required field makes SandboxMetric immediately stricter for all generated TypeScript consumers, but this commit does not update existing metric fixtures (for example in src/__test__/unit/sandbox-monitoring-chart-model.test.ts), so type-checking now reports missing memCache on those objects. If the intent is a non-breaking schema sync, mark memCache optional until all producers/fixtures are updated, or include those fixture updates in the same change.

Useful? React with 👍 / 👎.

Comment on lines +2348 to 2352
* Format: int64
* @description Cached memory (page cache) in bytes
*/
memCache: number
/**
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Adding memCache: number as a required field to SandboxMetric breaks the existing unit test at src/__test__/unit/sandbox-monitoring-chart-model.test.ts. The baseMetric fixture is typed as Omit<SandboxMetric, 'timestampUnix' | 'cpuUsedPct' | 'memUsed' | 'diskUsed'>, which leaves memCache required but baseMetric only provides timestamp, cpuCount, memTotal, and diskTotal. Every SandboxMetric[] array in the test file also spreads baseMetric and adds back only the four omitted fields, never memCache, causing TypeScript compilation failures throughout the test suite. Fix by adding memCache to baseMetric and to the Omit union, or by providing memCache in every individual test object.

Extended reasoning...

What the bug is and how it manifests

This PR adds memCache: number as a required field to the SandboxMetric schema in both spec/openapi.infra.yaml and the generated src/types/infra-api.types.ts (lines 2348-2352). While that correctly reflects the updated OpenAPI spec, it inadvertently breaks the unit test file src/__test__/unit/sandbox-monitoring-chart-model.test.ts, which constructs test fixtures against the SandboxMetric type.

The specific code path that triggers it

The test file imports SandboxMetric from @/server/api/models/sandboxes.models, which re-exports InfraComponents['schemas']['SandboxMetric'] -- exactly the type modified by this PR. The test defines a shared baseMetric constant typed with a satisfies expression. Before this PR, the Omit type removed four fields (timestampUnix, cpuUsedPct, memUsed, diskUsed), leaving { timestamp, cpuCount, memTotal, diskTotal } as the required keys -- which baseMetric satisfied. After this PR, memCache is required in SandboxMetric but is NOT in the Omit list, so it remains required in the resulting type. baseMetric does not include memCache, causing a TypeScript compile error on the satisfies expression.

Why existing code does not prevent it

The Omit list was written before memCache existed. There is no mechanism to automatically synchronise the omit list with new required fields added to the schema. When memCache was appended to the required array in the OpenAPI spec (and thus the generated TypeScript), the test fixtures were not updated in tandem.

What the impact would be

Every SandboxMetric[] array in the test file spreads baseMetric and then adds back only timestampUnix, cpuUsedPct, memUsed, and diskUsed. None of the individual metric objects supply memCache, so all of them also fail type-checking as SandboxMetric. The TypeScript compiler will reject the entire test file, blocking tsc --noEmit checks and any CI step that compiles the test suite.

Step-by-step proof

  1. After this PR, SandboxMetric has required fields: timestamp, timestampUnix, cpuCount, cpuUsedPct, memUsed, memTotal, memCache, diskUsed, diskTotal.
  2. Omit<SandboxMetric, 'timestampUnix' | 'cpuUsedPct' | 'memUsed' | 'diskUsed'> yields an object with required fields: timestamp, cpuCount, memTotal, memCache, diskTotal.
  3. baseMetric only provides timestamp, cpuCount, memTotal, diskTotal -- memCache is absent.
  4. The satisfies check fails: TypeScript reports that memCache is missing in baseMetric.
  5. Each test array entry spreads baseMetric and adds timestampUnix, cpuUsedPct, memUsed, diskUsed -- still lacking memCache -- so all SandboxMetric[] typed arrays also fail.

How to fix it

Either add 'memCache' to the Omit union in the test (requiring each individual spread object to supply memCache), or add memCache: 0 to baseMetric and keep the Omit list as-is. The latter is simpler and most consistent with the existing pattern.

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.

1 participant