feat(sdk): regenerate vendored SDK to the 1.6.0 API surface (#150) - #151
Open
brandonrc wants to merge 3 commits into
Open
feat(sdk): regenerate vendored SDK to the 1.6.0 API surface (#150)#151brandonrc wants to merge 3 commits into
brandonrc wants to merge 3 commits into
Conversation
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
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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.rswas rewritten bycargo run -p xtask -- generatefrom the v1.6.0openapi.json. The large generated-file diff is the SDK regen (progenitor output,// This file is generated ... Do not edit.), not hand edits.ClientProjectsExtinsdk/src/lib.rs(the only newClient*Exttrait; all other 37 tags unchanged). No new top-level types needed beyond the whole-moduletypesre-export.1.6.0.Drift fixed (new 1.6.0 request fields, all optional)
CreateRepositoryRequest/UpdateRepositoryRequestgained 12 optional fields (apt_*,custom_user_agent,debian,npm_*,project_id,trusted_gpg_key,versioning_enabled) — set toNoneinrepo.rs(CLI flags for these land in follow-up feature PRs).CreateSamlConfigRequest/UpdateSamlConfigRequest/SamlConfigResponsegainedmap_groups_to_groups— threaded throughsso.rs(Nonein request builders,falsein the test fixture).RepositoryResponsenow requireshas_trusted_gpg_key+versioning_enabled;SamlConfigResponserequiresmap_groups_to_groups. Accepted therepo_show_jsoninsta 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:
service_account.rscreate (200-vs-201)POST /api/v1/service-accountsdeclares201create_service_account(); updated the oldhandler_create_accepts_200test tohandler_create_rejects_non_201email_subscriptions.rssubscribe (201)POST /api/v1/repositories/{key}/email-subscriptionsdeclares201create_subscription(); test mock now returns 201lifecycle.rsupdate PATCH (schema rename)PATCH /api/v1/admin/lifecycle/{id}body is nowUpdateLifecyclePolicyRequest(withpriority), returns200update_lifecycle_policy()Kept (out of scope by design)
artifact.rssingle_put_uploadraw PUT (streaming body — progenitor can't model it) and all chunked/multipart raw paths inchunked_upload.rs/import.rs/admin.rs(xtask strips multipart endpoints).lifecycle.rscreate_policyraw POST — separate justification (backendCreatePolicyRequestshape), not a Backend/OpenAPI success-status mismatch (200 vs 201) breaks the strict SDK on create endpoints (artifact push, service-account create, ...) #98 item.Verification (matches CI:
.github/workflows/ci.yml)cargo check --workspace— passcargo build --workspace— passcargo fmt --all -- --check— passcargo clippy --workspace -- -D warnings— pass (the exact CI clippy invocation)cargo test --workspace— 2024 passed, 0 failedNote:
cargo clippy --all-targetssurfaces pre-existing warnings in test-only code (e.g.empty_line_after_doc_comments, dead-code intests/common) that exist onmainand 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