Skip to content

fix(api-kit): resolve CI failures and sonar issues in develop→master PR#3

Merged
Zaiidmo merged 1 commit intodevelopfrom
fix/api-kit-pr-issues
Apr 14, 2026
Merged

fix(api-kit): resolve CI failures and sonar issues in develop→master PR#3
Zaiidmo merged 1 commit intodevelopfrom
fix/api-kit-pr-issues

Conversation

@Omaiiima
Copy link
Copy Markdown
Contributor

@Omaiiima Omaiiima commented Apr 14, 2026

Summary

  • What does this PR change?

Why

  • Why is this change needed?

Checklist

  • Added/updated tests (if behavior changed)
  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run build passes
  • Added a changeset (npx changeset) if this affects consumers

Notes

  • Anything reviewers should pay attention to?

@Omaiiima Omaiiima requested a review from a team as a code owner April 14, 2026 12:33
Copilot AI review requested due to automatic review settings April 14, 2026 12:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 ErrorInterceptor typing 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 Zaiidmo merged commit b502655 into develop Apr 14, 2026
5 checks passed
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>
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.

3 participants