Skip to content

chore: move apiversion package into tools/foas#1309

Merged
yelizhenden-mdb merged 2 commits into
mainfrom
CLOUDP-413371-2
Jun 15, 2026
Merged

chore: move apiversion package into tools/foas#1309
yelizhenden-mdb merged 2 commits into
mainfrom
CLOUDP-413371-2

Conversation

@yelizhenden-mdb

@yelizhenden-mdb yelizhenden-mdb commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

What this introduces

Branch 2 of 4 in splitting tools/cli into a library (tools/foas) + binary (tools/cli). Builds on #1308 (now merged). This is the pilot move: it relocates one package — apiversion — to prove out the cross-module wiring before moving the rest.

Changes

  • Moved tools/cli/internal/apiversion/tools/foas/apiversion/ (4 files: version.go, stabilitylevel.go, + tests). Package name unchanged (package apiversion).
  • Rewrote imports in all 20 cli callers from …/tools/cli/internal/apiversion to …/tools/foas/apiversion.
  • Deleted tools/cli/pkg/apiversion/ — a thin re-export wrapper with zero importers (dead code; the whole point of tools/foas is to be the public surface).
  • Wired the module dependency in tools/cli/go.mod:
    require github.com/mongodb/openapi/tools/foas v0.0.0
    replace github.com/mongodb/openapi/tools/foas => ../foas
    
    go.work resolves foas locally during dev/CI; the replace covers GOWORK=off (GoReleaser).
  • go mod tidy surfaced that apiversion (and its tests) pull in kin-openapi and testify, so tools/foas now declares those directly — hence the new tools/foas/go.sum and regenerated tools/go.work.sum.

Verification

This PR only moves the apiversion package (no logic change; package name and behavior unchanged; the expected-output specs committed in the repo are untouched). The foascli binary is consumed by several release/generation workflows (release-cli, release-spec, release-changelog, generate-openapi, changelog-report, required-spec-validations, api-versions-reminder), so behavioral parity is verified end-to-end:

CI (Linux) — all green on this PR:

Check Result
e2e-tests (builds foascli, runs commands, compares output against the expected specs committed in the repo) ✅ pass
build (foascli + foas-lib) ✅ pass
lint (both modules) ✅ pass
unit-tests (ubuntu + macos, both modules) ✅ pass

Local (macOS) — second, independent signal:

  • apiversion-dependent e2e tests (split, changelog, versions) → ok …/test/e2e/cli 157.001s (exit 0)

Because the e2e suite drives the real binary and compares its output against the expected specs committed in the repo (via an oasdiff structural comparison that must come back empty), passing e2e proves the CLI produces the same output as before — the consuming workflows are unaffected.

Next branches

  • Branch 3 — move breakingchanges, changelog, openapi, pointer; delete tools/cli/pkg/ entirely
  • Branch 4 — CI & release wiring (rename code-health-foascli.ymlcode-health-foas-cli.yml with a tools/foas/** trigger; add release-foas-lib.yml)

@yelizhenden-mdb yelizhenden-mdb changed the title feat(foas): move apiversion package into tools/foas chore: move apiversion package into tools/foas Jun 15, 2026
Branch 2 of the cli/foas split. Moves the apiversion package from tools/cli/internal/apiversion into the tools/foas library, updates all 20 cli callers to import from tools/foas/apiversion, deletes the dead tools/cli/pkg/apiversion wrapper, and adds the require + replace directives to tools/cli/go.mod.
@yelizhenden-mdb yelizhenden-mdb marked this pull request as ready for review June 15, 2026 14:12
@yelizhenden-mdb yelizhenden-mdb requested a review from a team as a code owner June 15, 2026 14:12

@andmatei andmatei left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@yelizhenden-mdb yelizhenden-mdb merged commit 35f3284 into main Jun 15, 2026
17 checks passed
@yelizhenden-mdb yelizhenden-mdb deleted the CLOUDP-413371-2 branch June 15, 2026 14:44
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