-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add GitHub API caching #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Link to #11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 issues found across 15 files
Prompt for AI agents (all 7 issues)
Understand the root cause of the following 7 issues and fix them.
<file name="src/config/schema.ts">
<violation number="1" location="src/config/schema.ts:115">
Schema allows unsupported cache storage values ('filesystem', 'redis'), which will silently fall back to memory at runtime. Consider restricting to supported options or adding validation/warnings for all unsupported values.</violation>
</file>
<file name="src/github/client.ts">
<violation number="1" location="src/github/client.ts:105">
Current user cache key should not depend on org; use a stable owner like SELF_CACHE_OWNER to avoid duplicate entries.</violation>
<violation number="2" location="src/github/client.ts:530">
Use error.status to detect 403 instead of parsing the error message string when deciding whether to log.</violation>
<violation number="3" location="src/github/client.ts:561">
Brittle 403 detection via error.message.includes('403'); check error.status instead to reliably handle permission-denied responses.</violation>
</file>
<file name="src/cache/memory-storage.ts">
<violation number="1" location="src/cache/memory-storage.ts:8">
Returning 0 on serialization failure defeats size-based eviction; non-serializable entries won’t count toward the budget, risking unbounded memory growth.</violation>
</file>
<file name="src/cache/cache-manager.ts">
<violation number="1" location="src/cache/cache-manager.ts:23">
stableStringify collapses Date/Map/Set/RegExp (and similar) to '{}' causing cache key collisions; handle these types explicitly or use a JSON replacer.</violation>
<violation number="2" location="src/cache/cache-manager.ts:177">
TTL override is not validated; NaN/Infinity produce non-expiring entries. Guard override with Number.isFinite before using it.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
📊 Build ReportBundle Size: 1.15 KB Details
Generated for commit 8999731 |
|
Added the link to #11 in the PR description. |
|
@cubic-dev-ai addressed the cache review feedback:\n- tighten cache storage support to only and reject unsupported values during validation.\n- hardened cache key generation and TTL handling (stable serialization, invalid TTL guard).\n- ensured size-based eviction counts non-serializable entries.\n- current user cache now uses a stable namespace and GitHub 403 responses rely on codes. |
|
@cubic-dev-ai addressed the cache review feedback:
|
Summary
Closes #11
Testing
Summary by cubic
Adds a configurable GitHub API caching layer to cut rate-limit usage and speed up repeated requests. Caching is optional, uses in-memory storage by default, and is wired into the CLI, config, and GitHubClient with safe invalidation on writes.
New Features
Migration
cache:
enabled: true
ttl:
default: 900