Skip to content

PP-2963: Fix package vulnerabilities and add logic tests - #71

Merged
sergak01 merged 3 commits into
developfrom
pp-2963
Mar 12, 2026
Merged

PP-2963: Fix package vulnerabilities and add logic tests#71
sergak01 merged 3 commits into
developfrom
pp-2963

Conversation

@sergak01

@sergak01 sergak01 commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

PP-2963: Fix package vulnerabilities and add logic tests

Summary

This PR addresses package vulnerabilities across the project and test apps, plus adds unit tests for token and content-encoding helper logic.


Changes

1. Package Vulnerability Fixes

Root package:

  • Updated file-type from ^19.6.0 → ^21.3.1 (fixes GHSA-5v7r-6r5c-r473)
  • Fixed svgo, rollup, immutable, minimatch, tar via npm audit fix

Test projects (test-commonjs, test-nextjs, test-nextjs-cjs):

  • Added overrides for file-type and minimatch
  • Updated direct dependencies (file-type, svgo, rollup in test-nextjs)
  • Ran npm audit fix

Result: All projects report 0 vulnerabilities.

2. Logic Tests

tests/unit/lib/token.helper.spec.ts (25 tests):

  • getTokenErrorInfo — 401, 403, 412 (session expired vs auth failed), unknown status, message fallbacks
  • isTokenError and isSessionExpiredError — status and message variants
  • logTokenError — logger calls, context prefix, suggestions

tests/unit/lib/content-encoding.helper.spec.ts (17 tests):

  • decodeContent / encodeContent — gzip, brotli, deflate, default/unknown encoding
  • Round-trip tests for each encoding

3. Implementation Fixes (discovered via tests)

content-encoding.helper.ts: Fixed swapped deflate logic — decode now uses inflateSync (decompress), encode uses deflateSync (compress)

token.helper.ts: Extended session-expired check to handle both "session expired" and "session has expired"; isSessionExpiredError returns false when response.data is missing (was returning undefined)


Testing

  • npm run test:unit — 137 tests passing
  • npm run test:integration — 31 tests passing
  • npm audit — 0 vulnerabilities

Checklist

  • No breaking changes
  • Tests added/updated
  • Vulnerabilities resolved

sergak01 added 3 commits March 2, 2026 12:14
Release v0.15.0-beta.1: develop → main
- Add token.helper.spec.ts: getTokenErrorInfo, isTokenError, isSessionExpiredError, logTokenError
- Add content-encoding.helper.spec.ts: decodeContent, encodeContent, round-trip
- Fix content-encoding: swap deflate encode/decode (inflateSync/deflateSync)
- Fix token.helper: match 'session has expired', return false when data missing
@sergak01 sergak01 self-assigned this Mar 12, 2026
@coderabbitai

coderabbitai Bot commented Mar 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4c2fd63d-91bd-434b-b71b-4d59f1876176

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pp-2963

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sergak01
sergak01 merged commit 5cf2874 into develop Mar 12, 2026
3 checks passed
@sergak01
sergak01 deleted the pp-2963 branch March 12, 2026 12:10
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.

1 participant