Skip to content

Reduce cached token restore complexity to fix CI - #6535

Merged
rdimitrov merged 1 commit into
mainfrom
rdimitrov/check-main-ci
Sep 8, 2026
Merged

rdimitrov merged 1 commit into
mainfrom
rdimitrov/check-main-ci

Conversation

@rdimitrov

Copy link
Copy Markdown
Member

Summary

Latest main (c4f6cb4a3) fails Go linting because tryRestoreFromCachedTokens has cyclomatic complexity 18, exceeding the limit of 15. Extract legacy token migration persistence into a private helper, reducing the function's complexity to 14 while preserving token verification order, authorization-server binding, fallback values, and error handling.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test) — running locally
  • E2E tests (task test-e2e)
  • Linting (task lint-fix) — passed with CI's golangci-lint v2.13.2
  • Manual testing (describe below)

Existing cached-token migration tests exercise the extracted path and verify the persisted issuer and token endpoint binding. Code review confirmed this is a behavior-preserving extraction.

Does this introduce a user-facing change?

No.

Extract migration persistence to bring cached token restoration below the cyclomatic complexity limit and unblock main CI without changing behavior.

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
@github-actions github-actions Bot added the size/XS Extra small PR: < 100 lines changed label Sep 8, 2026
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.71%. Comparing base (c4f6cb4) to head (58d9290).

Files with missing lines Patch % Lines
pkg/auth/remote/handler.go 70.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6535      +/-   ##
==========================================
+ Coverage   78.67%   78.71%   +0.04%     
==========================================
  Files         777      777              
  Lines       76686    76687       +1     
==========================================
+ Hits        60334    60367      +33     
+ Misses      16347    16315      -32     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rdimitrov
rdimitrov merged commit 6f73212 into main Sep 8, 2026
48 checks passed
@rdimitrov
rdimitrov deleted the rdimitrov/check-main-ci branch September 8, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants