Skip to content

coreapi: land vendored Core spec refresh before #2561 - #2575

Merged
gtrrz-victor merged 3 commits into
mainfrom
alex/cli-vendored-spec-split
Sep 24, 2026
Merged

gtrrz-victor merged 3 commits into
mainfrom
alex/cli-vendored-spec-split

Conversation

@khaong

@khaong khaong commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

https://entire.io/gh/entireio/cli/trails/1415

Why

COR-1947 splits the vendored Core API spec/client refresh out of #2561. Merge this PR first, then #2561's diff against main shrinks by itself; do not rebase or force-push #2561.

What

Cherry-pick of 7bcc02f3b (coreapi: refresh the vendored core spec) onto main. The commit is 30 files: 18 under internal/coreapi (vendored spec, normalized spec, generated ogen client, normalization/docs/tests) at +45,144/−20,249, and 12 handwritten CLI files at +72/−36 (net +36). The CLI changes are required adaptations to generated response/request types; separating them would not compile.

Most caller changes unwrap create/delete response wrappers, use the shared grant body, distinguish branch-rule update from read models, and use MirrorRequestResult. Observable compatibility changes are intentional: org/project create JSON can include the server's deprecated commitToken; read models tolerate new invitation/member enums and missing capabilities fields from older Core deployments. The other three commits on #2561 (org invite/accept commands and token disclosure fixes) are not included.

Verification

  • Cherry-pick applied cleanly; stable patch ID matches the source commit. Vendored spec paths: main 64 → refreshed 79.
  • GOFLAGS=-p=2 go generate ./internal/coreapi/... against the committed vendored spec: exit 0, zero working-tree/index diff. No fresh upstream spec download and no manual merge of generated code.
  • MISE_GLOBAL_CONFIG_FILE=/tmp/cor-1947-mise-global.toml GOFLAGS=-p=2 mise run check: exit 0 (fmt, lint, race unit/integration, Vogon 56/56, Roger Roger 4/4). Temporary external mise config activates the already installed gotestsum 1.13.0 for nested canary invocations; no repo config change.
  • mise run lint on the final formatted tree: 0 issues; git diff --check and working tree clean.

A textually merged generated openapi.json on entire.io#4693 passed review but failed CI as out of date; regenerating changed it by +37/−1. The zero-diff idempotence check above is specifically to avoid that failure mode here.

Review order

Merge this before #2561. No changes to #2561's branch or PR are made here.


Note

Medium Risk
Touches create/delete/grant and repo provisioning paths against a large regenerated client; risk is mitigated by normalization and tests for unknown read-model enums and optional fields.

Overview
Vendored Core OpenAPI refresh with regenerated internal/coreapi ogen client (new routes for invitations, people rosters, Depot CI, CI deliveries, and more) plus spec normalization so mixed-version servers still decode.

Handwritten CLI follow-ups keep existing commands compiling and behaving: org/project/repo create unwrap Created*Headers.Response; delete ignores new no-content return types; project/repo grants share grantAccessBody / GrantAccessBody; repo create maps CreatedRepo → Repo via JSON for readiness polling; branch protection patches use BranchRuleUpdate; mirrors use MirrorRequestResult and renamed mirror-request provider enums (legacy CreateMirror dropped from the client).

Forward-compat extends spec/normalize.go and tests so invitation/member role/status enums and create-response capabilities/provider fields do not break listings or creates against older Core.

Reviewed by Cursor Bugbot for commit 53c5a26. Configure here.

Refresh spec/core.openapi.json from the control plane and regenerate the
client. The spec has moved on since the last vendor: it adds the org
invitation routes COR-1744 needs, and it also reshapes surfaces the CLI
already calls.

What changed on the wire, and what each needed here:

  - create and delete now return an X-Entire-Commit-Token response header,
    so ogen wraps their results. Unwrap at the call sites; `org create` and
    `project create` keep printing the object, whose --json now also carries
    the deprecated commitToken field the server sends.
  - CreateRepo returns CreatedRepo, a twin of Repo with that extra field.
    The readiness poll and the creation report both work on Repo, so convert
    once at the boundary.
  - GrantProjectAccessInputBody and GrantRepoAccessInputBody collapsed into
    one GrantAccessBody whose provider pair is optional, because the route
    now also takes an accountId. The CLI always sends the pair.
  - BranchRule split into a read model and BranchRuleUpdate for patches.
  - createMirror and getPermissions are gone. The mirror flow already posts
    to the async createMirrorRequest route and only borrowed CreatedMirror
    to carry three fields home; MirrorRequestResult already holds them.

Membership and Invitation ship role and status as enums, and the create
responses repeat their read models' required capabilities. Both are the
cases readModelEnumFields and readModelOptionalFields exist for: the CLI
only prints these values, so a value added later must display rather than
fail the whole listing. Add the entries and lock them in with tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PLWcdMjoLpAaiATYzY3v74
Copilot AI lite review requested due to automatic review settings September 24, 2026 02:38
@khaong
khaong requested a review from a team as a code owner September 24, 2026 02:38

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

The broad generated API refresh affects multiple CLI flows, and a documentation correction remains outstanding.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Refreshes the vendored Core API specification and generated client, with required CLI updates for new response and request types.

Changes:

  • Regenerates the Core API client and compatibility normalization.
  • Updates create/delete, grants, mirrors, and branch protection flows.
  • Refreshes related tests and generated API metadata.
File Description
internal/​coreapi/​UPSTREAM.md Documents compatibility workarounds; correct the documented grant command.
internal/​coreapi/​spec/​normalize.go Adds enum and optional-field normalization.
internal/​coreapi/​repo_readiness_test.go Adapts repository creation tests.
internal/​coreapi/​oas_validators_gen.go Regenerates schema validators.
internal/​coreapi/​oas_security_gen.go Regenerates security mappings.
internal/​coreapi/​oas_request_encoders_gen.go Regenerates request encoders.
internal/​coreapi/​oas_parameters_gen.go Regenerates request parameters.
internal/​coreapi/​oas_operations_gen.go Regenerates operation definitions.
internal/​coreapi/​oas_interfaces_gen.go Adds refreshed response interfaces.
internal/​coreapi/​oas_defaults_gen.go Regenerates request defaults.
internal/​coreapi/​oas_cfg_gen.go Updates generated configuration.
internal/​coreapi/​client_test.go Tests forward-compatible enum decoding.
cmd/​entire/​cli/​repo.go Adapts repository create/delete handling.
cmd/​entire/​cli/​repo_readiness.go Converts created repositories to read models.
cmd/​entire/​cli/​repo_protection.go Uses updated branch-rule models.
cmd/​entire/​cli/​repo_protection_test.go Updates protection test fixtures.
cmd/​entire/​cli/​repo_mirror.go Uses refreshed mirror request types.
cmd/​entire/​cli/​repo_mirror_test.go Updates mirror provider tests.
cmd/​entire/​cli/​repo_mirror_request_test.go Updates mirror request assertions.
cmd/​entire/​cli/​repo_mirror_probe.go Returns refreshed mirror results.
cmd/​entire/​cli/​project.go Adapts project create/delete responses.
cmd/​entire/​cli/​org.go Adapts organization create/delete responses.
cmd/​entire/​cli/​grant.go Uses the shared grant request body.
cmd/​entire/​cli/​grant_test.go Updates grant role tests.
Files not reviewed (8)
  • internal/coreapi/oas_cfg_gen.go: Generated file
  • internal/coreapi/oas_defaults_gen.go: Generated file
  • internal/coreapi/oas_interfaces_gen.go: Generated file
  • internal/coreapi/oas_operations_gen.go: Generated file
  • internal/coreapi/oas_parameters_gen.go: Generated file
  • internal/coreapi/oas_request_encoders_gen.go: Generated file
  • internal/coreapi/oas_security_gen.go: Generated file
  • internal/coreapi/oas_validators_gen.go: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/coreapi/UPSTREAM.md Outdated
Entire-Checkpoint: 01M38NDB76KW0RBGCKX7CX1742
@khaong

khaong commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Entire-Checkpoint: 01M39JB34RP7Q4EFVK1ADWYVBD
@khaong

khaong commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 53c5a26. Configure here.

@gtrrz-victor
gtrrz-victor merged commit 01b0f79 into main Sep 24, 2026
17 of 19 checks passed
@gtrrz-victor
gtrrz-victor deleted the alex/cli-vendored-spec-split branch September 24, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants