Repository navigation
refactor(frontend): route last 2 clients through canonical ApiClient — AdvancedControl + Secrets (#12363 Phase 1) - #12583
Merged
Merged
Conversation
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
This was referenced Jul 26, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Thinking Path
#12363 (single-transport guarantee) was already ~75% delivered by #12152, which routed 6 of 8 frontend HTTP clients through the canonical
utils/ApiClient.ts. This PR finishes the transport half by migrating the last 2 outliers so every client shares one transport (centralised base-URL resolution, auth-token injection, org-context headers). Kept strictly behaviour-neutral.What Changed
autobot-frontend/src/utils/AdvancedControlApiClient.ts(imports ~L12–15,request<T>~L191–222, POST bodies): replacedfetchWithAuthwithapiClient.rawRequest, mirroring the existing thin-typed-wrapper pattern inVisionMultimodalApiClient.ts/FeatureFlagsApiClient.ts(the "thin typed wrapper refactor(frontend): fold VisionMultimodal + FeatureFlags clients into shared apiClient (#11682 Tier-2) #12152" comment). Dropped the localgetBaseUrl()(base-URL now resolved by the singleton) and stopped hand-stringifying request bodies (rawRequest JSON-serialises objects).getConfigretained for the WS-URL helpers.rawRequest(single-shot) is used deliberately instead ofapiClient.get()—get()would add retry + 401-auto-logout, a behaviour change reserved as a separate owner decision (see Follow-up).autobot-frontend/src/utils/SecretsApiClient.{js,d.ts}→SecretsApiClient.ts: folded the hand-written.d.tstypes into a single typed.ts(already correctly wrappingapiClient). Identical runtime behaviour and identical import surface — the namedsecretsApiClientexport, the default class export, and all public types are preserved, so no caller changes were needed. This is a 1:1 format conversion, not a code deletion.Callers confirmed unchanged via grep:
useAdvancedControl.ts/AdvancedControlView.vuefor the former;SecretVault.vue,SecretsManager.vue,HostSelectionDialog.vue,ProjectBrowserView.vuefor the latter (all import only the namedsecretsApiClient).The other 6 already-consolidated clients, raw-fetch files, and generated types were intentionally untouched.
Verification
vue-tsc --noEmit -p tsconfig.app.json→ clean (exit 0).vitest runonuseAdvancedControl.test.ts+HostSelectionDialog.test.ts→ 22 passed (exit 0).fetchWithAuthin AdvancedControl (only a comment), and no explicit.js/.d.tsimport references to the converted Secrets module.Model Used
Claude Opus 4.8
Follow-up
Remaining phases of #12363 are out of scope here:
fetch/fetchWithAuthcall-sites).apiClient's retry + 401-auto-logout semantics (switching fromrawRequest/single-shot toget/post/...). That is a deliberate behaviour change and is left to the owner.Refs #12363
Closes #12582