fix(api-kit): resolve CI failures and sonar issues in develop→master PR#3
Merged
fix(api-kit): resolve CI failures and sonar issues in develop→master PR#3
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to unblock the develop → master merge by addressing CI failures and Sonar-related issues in the API kit (client implementation, tests, and CI workflows).
Changes:
- Tighten API client types and behavior (notably
ErrorInterceptortyping and header normalization). - Update tests to be less coupled to Axios mock call internals and to clean up global stubs.
- Adjust CI workflows for npm audit/Sonar execution and add stricter publish-time tag validation; bump Axios dependency.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/api/createApiClient.types.ts |
Changes ErrorInterceptor type to ApiError and adds corresponding import. |
src/api/createApiClient.ts |
Adds normalizeHeaders and applies it to request/response header handling. |
src/api/createApiClient.test.ts |
Updates token-header assertion strategy; moves global unstub cleanup into afterEach. |
package.json |
Bumps axios dependency version. |
package-lock.json |
Updates lockfile to reflect dependency changes / regenerated metadata. |
.github/workflows/release-check.yml |
Updates audit flag, adds fork-guard for Sonar steps, and changes Sonar test configuration. |
.github/workflows/publish.yml |
Adds validation that the version tag points to HEAD before publishing. |
Comment on lines
+56
to
+64
| TAG_COMMIT=$(git rev-list -n 1 "$TAG" 2>/dev/null || echo "") | ||
| HEAD_COMMIT=$(git rev-parse HEAD) | ||
|
|
||
| if [[ "$TAG_COMMIT" != "$HEAD_COMMIT" ]]; then | ||
| echo "❌ ERROR: Tag $TAG does not point to HEAD" | ||
| echo " Tag points to: $TAG_COMMIT" | ||
| echo " HEAD is: $HEAD_COMMIT" | ||
| exit 1 | ||
| fi |
| export type RequestInterceptor = (request: InterceptedRequest) => InterceptedRequest; | ||
| export type ResponseInterceptor = (response: InterceptedResponse) => InterceptedResponse; | ||
| export type ErrorInterceptor = (error: Error) => void; | ||
| export type ErrorInterceptor = (error: ApiError) => void; |
Comment on lines
+53
to
+57
| const normalized: Record<string, string> = {}; | ||
| for (const [key, value] of Object.entries(source)) { | ||
| if (Array.isArray(value)) { | ||
| normalized[key] = value.map((item) => String(item)).join(', '); | ||
| } else if (value != null) { |
| @@ -63,10 +64,12 @@ jobs: | |||
| -Dsonar.organization=${{ env.SONAR_ORGANIZATION }} | |||
| -Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} | |||
| -Dsonar.sources=src | |||
Comment on lines
+39
to
+62
| function normalizeHeaders(headers: unknown): Record<string, string> { | ||
| if (!headers || typeof headers !== 'object') { | ||
| return {}; | ||
| } | ||
|
|
||
| const source = | ||
| 'toJSON' in headers && typeof (headers as Record<string, unknown>).toJSON === 'function' | ||
| ? (headers as { toJSON(): Record<string, unknown> }).toJSON() | ||
| : headers; | ||
|
|
||
| if (!source || typeof source !== 'object') { | ||
| return {}; | ||
| } | ||
|
|
||
| const normalized: Record<string, string> = {}; | ||
| for (const [key, value] of Object.entries(source)) { | ||
| if (Array.isArray(value)) { | ||
| normalized[key] = value.map((item) => String(item)).join(', '); | ||
| } else if (value != null) { | ||
| normalized[key] = String(value); | ||
| } | ||
| } | ||
| return normalized; | ||
| } |
Zaiidmo
added a commit
that referenced
this pull request
Apr 14, 2026
* chore: scaffolding the repo * Release/v0.1.0 readme changeset (#1) * feat: add createApiClient factory with typed HTTP methods wrapping axios * feat: add composable interceptor system and built-in auth token injector to ApiClient * feat: add ApiError class and configurable retry with exponential backoff * Revert "feat: add ApiError class and configurable retry with exponential backoff" This reverts commit 2d7c8f3. * Reapply "feat: add ApiError class and configurable retry with exponential backoff" This reverts commit db3568d. * feat: add ApiError class and configurable retry with exponential backoff * test: add comprehensive test suite for ApiClient with ApiError, retry backoff, and interceptor coverag * docs: add README with full API documentation and changeset for v0.1.0 * fix(api-kit): resolve CI failures and sonar issues in develop→master PR (#3) --------- Co-authored-by: Zaiidmo <zaiidmoumnii@gmail.com>
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
Why
Checklist
npm run lintpassesnpm run typecheckpassesnpm testpassesnpm run buildpassesnpx changeset) if this affects consumersNotes