Skip to content

Centralize response cache policy - #61

Open
BradNut wants to merge 2 commits into
developmentfrom
issue-60-response-cache-policy
Open

Centralize response cache policy#61
BradNut wants to merge 2 commits into
developmentfrom
issue-60-response-cache-policy

Conversation

@BradNut

@BradNut BradNut commented May 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a server-only response cache module for cached JSON reads/writes and cache-control TTL policy
  • move Articles and Bandcamp album endpoints behind the shared cache interface
  • cover cache hit, TTL fallback, miss, disabled cache, Redis unavailable, and write expiry behavior

Validation

  • SENTRY_AUTH_TOKEN=test BANDCAMP_USERNAME=test WALLABAG_CLIENT_ID=test WALLABAG_CLIENT_SECRET=test WALLABAG_USERNAME=test WALLABAG_PASSWORD=test pnpm check
  • SENTRY_AUTH_TOKEN=test BANDCAMP_USERNAME=test WALLABAG_CLIENT_ID=test WALLABAG_CLIENT_SECRET=test WALLABAG_USERNAME=test WALLABAG_PASSWORD=test pnpm test:unit run
  • pnpm biome lint src/lib/server/responseCache.ts src/lib/server/responseCache.test.ts src/lib/services/articlesApi.ts src/routes/api/bandcamp/albums/+server.ts

Closes #60

@github-actions

github-actions Bot commented May 13, 2026

Copy link
Copy Markdown

🌿 Fallow

✅ No code issues · ✅ No duplication · ⚠️ 5 health findings

See inline review comments for per-finding details.

Complexity (5 functions above threshold)
File Function Severity Cyclomatic Cognitive CRAP Lines
bandcamp/albums/+server.ts:8 GET high 7 5 56.0 ! 45
lib/server/responseCache.ts:57 readCachedJson moderate 6 5 42.0 ! 36
lib/services/articlesApi.ts:100 <arrow> moderate 5 4 30.0 ! 18
lib/services/articlesApi.ts:131 fetchArticlesApi moderate 5 3 30.0 ! 29
lib/services/articlesApi.ts:120 buildFallbackResponse moderate 5 2 30.0 ! 10

4 files, 19 functions analyzed (thresholds: cyclomatic > 20, cognitive > 15, CRAP >= 30.0)

Codebase health

Metric Value
Maintainability 91.5 / 100
Avg complexity 3

Issue counts scoped to files changed since 4a755ef · health metrics reflect the full codebase

@sonarqubecloud

Copy link
Copy Markdown

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