Skip to content

feat(sdk): regenerate vendored SDK to the 1.6.0 API surface (#150) - #151

Open
brandonrc wants to merge 3 commits into
mainfrom
feat/sdk-1.6.0-regen
Open

feat(sdk): regenerate vendored SDK to the 1.6.0 API surface (#150)#151
brandonrc wants to merge 3 commits into
mainfrom
feat/sdk-1.6.0-regen

Conversation

@brandonrc

Copy link
Copy Markdown
Contributor

Summary

Phase 0 of the CLI 1.6.0 epic (#149): regenerate the vendored SDK against the Artifact Keeper v1.6.0 OpenAPI spec, fix the resulting drift, drop the #98 spec-fidelity workarounds, and bump the version to 1.6.0. This is the foundation the feature PRs build on, so it compiles and tests clean.

SDK regeneration

  • sdk/src/generated_sdk.rs was rewritten by cargo run -p xtask -- generate from the v1.6.0 openapi.json. The large generated-file diff is the SDK regen (progenitor output, // This file is generated ... Do not edit.), not hand edits.
  • New operation tag: re-exported ClientProjectsExt in sdk/src/lib.rs (the only new Client*Ext trait; all other 37 tags unchanged). No new top-level types needed beyond the whole-module types re-export.
  • SDK crate version tracks the API at 1.6.0.

Drift fixed (new 1.6.0 request fields, all optional)

  • CreateRepositoryRequest / UpdateRepositoryRequest gained 12 optional fields (apt_*, custom_user_agent, debian, npm_*, project_id, trusted_gpg_key, versioning_enabled) — set to None in repo.rs (CLI flags for these land in follow-up feature PRs).
  • CreateSamlConfigRequest / UpdateSamlConfigRequest / SamlConfigResponse gained map_groups_to_groups — threaded through sso.rs (None in request builders, false in the test fixture).
  • Test fixtures updated for new required response fields: RepositoryResponse now requires has_trusted_gpg_key + versioning_enabled; SamlConfigResponse requires map_groups_to_groups. Accepted the repo_show_json insta snapshot (adds the two new fields to JSON output).

#98 workarounds — dropped (spec now correct)

Verified against the v1.6.0 spec, then switched from raw HTTP to the strict generated SDK methods:

Workaround Spec evidence (v1.6.0) Action
service_account.rs create (200-vs-201) POST /api/v1/service-accounts declares 201 Droppedcreate_service_account(); updated the old handler_create_accepts_200 test to handler_create_rejects_non_201
email_subscriptions.rs subscribe (201) POST /api/v1/repositories/{key}/email-subscriptions declares 201 Droppedcreate_subscription(); test mock now returns 201
lifecycle.rs update PATCH (schema rename) PATCH /api/v1/admin/lifecycle/{id} body is now UpdateLifecyclePolicyRequest (with priority), returns 200 Droppedupdate_lifecycle_policy()

Kept (out of scope by design)

Verification (matches CI: .github/workflows/ci.yml)

  • cargo check --workspace — pass
  • cargo build --workspace — pass
  • cargo fmt --all -- --check — pass
  • cargo clippy --workspace -- -D warnings — pass (the exact CI clippy invocation)
  • cargo test --workspace2024 passed, 0 failed

Note: cargo clippy --all-targets surfaces pre-existing warnings in test-only code (e.g. empty_line_after_doc_comments, dead-code in tests/common) that exist on main and are not part of the CI clippy gate (CI runs without --all-targets); no new warnings are introduced by this change.

Closes #150
Refs #149

Phase 0 of the CLI 1.6.0 epic (#149): regenerate the bundled SDK from the
Artifact Keeper v1.6.0 OpenAPI spec, fix the resulting drift, drop the #98
spec-fidelity workarounds, and bump the version to 1.6.0.

- Regenerated sdk/src/generated_sdk.rs via `cargo xtask generate` (large diff)
- Re-exported the new `ClientProjectsExt` tag trait in sdk/src/lib.rs
- Filled new 1.6.0 optional request fields (repo APT/npm/Debian/versioning/
  project options, SAML group mapping) as None in repo/sso initializers
- Dropped #98 workarounds now that the spec is correct: service-account create
  (201), email-subscriptions subscribe (201), lifecycle update
  (UpdateLifecyclePolicyRequest) now call the strict SDK methods
- Bumped cli + sdk crates to 1.6.0; added CHANGELOG [1.6.0] entry

Closes #150
Refs #149
@sonarqubecloud

Copy link
Copy Markdown

The regenerated 1.6.0 SDK is strict about status codes and required
response fields, so E2E must run against a >=1.6.0 backend; the old
1.4.0 pin returns 200 where the SDK now expects 201 and omits the new
required RepositoryResponse fields. Matches the CLI 1.6.0 version
coupling (do not run ak 1.6.0 against a pre-1.6.0 backend).
The `build_client_with_valid_token` / `_with_empty_token` / `_different_urls`
tests build a client and assert success, but did not hold the shared
`ENV_LOCK`. Other tests (in `transport` and the custom-CA tests in this
module) set the process-global `AK_CA_CERT` to invalid/garbage paths under
that lock. Run in parallel, a clean-state build test could observe the
polluted var, load the bad CA, and fail with `AkError::CaCert` — a
non-deterministic failure that surfaces on slower/contended CI runners.

Acquire `ENV_LOCK` and clear `AK_CA_CERT` at the start of each of the three
tests, matching the pattern already used by the custom-CA tests in this file,
so they always see a clean CA state.
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.

Phase 0: regenerate vendored SDK to 1.6.0 spec + drop #98 workarounds + version bump

1 participant