Repository navigation
feat(cas): cache blob existence checks for uploads - #3562
Conversation
Cache positive existence results in the Artifact CAS, namespaced by organization and backend, so repeated uploads of the same evidence skip the secrets manager and the storage backend. Backend clients loaded for uploads are reused for a short time in process memory. The cache uses NATS KV when available and an in-memory LRU otherwise, and can be turned off or tuned through the CAS config and the Helm chart. Implements R-001 to R-009 of spec issue-3543. Refs #3543 Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 9b6de27d-6322-4cf7-8e72-5e56d858c783
PR validation — ✅ 3 passing
AI Session Checks — 🟡 80% ·
|
| Avg score | Sessions | Failing policies | Attribution | Files | Lines | Total Duration |
|---|---|---|---|---|---|---|
| 🟡 80% | 1 | 100% AI / 0% Human | 18 | +934 / -195 | 1h24m59s |
🟡 80% — 100% AI — ⚠️ 1 policies failing
-
Oct 8, 2026 10:10 UTC · 1h24m59s · $18.78 · 560 in / 210.9k out · claude-code 2.1.294 (claude-opus-5-5)
Change Summary
-
- Adds Artifact CAS upload-side existence caching and backend-client reuse.
- Uses NATS KV when available, with memory fallback when NATS is absent or bucket setup fails.
- Removes the proposed configuration knobs, leaving the cache always on with a fixed 24h TTL.
- Adds and reruns cache-focused tests, including fallback and tenant-isolation mutation checks.
AI Session Overall Score
-
🟡 80% — Well-verified work, but planning and requirement drift deserve review.
AI Session Analysis Breakdown
-
🟢 92% · verification
-
🟢 AI validated the change with repeated suite runs and mutation checks. · High Impact
🟢 88% · solution-quality
-
🟢 Cleanup moved fallback logic into the shared cache constructor, not a caller special case. · High Impact
🟡 72% · user-trust-signal
-
No notes.
🟡 68% · alignment
-
🟠 Two user corrections were needed to remove config knobs and keep the spec out of this PR. · Medium Severity
💡 After a second boundary change, ask the AI to restate the final contract before more edits land.
🟡 65% · context-and-planning
-
🟢 AI read the issue and merged spec before the first implementation edits. · Medium Impact
🟠 The feature started from an issue URL with no visible shared plan for a large multi-phase change. · Medium Severity
💡 For issue-sized work, require a short visible plan before the first code edit.
abstained · scope-discipline
-
🟡 Scope discipline was not assessed because the final diff stat was unavailable after several reverts. · Low Severity
Missing criteria: scope-discipline
-
File Attribution
████████████████████100% AI / 0% Human
Policies (4, 1 failing)
Status Policy Material Messages ✅ Passed ai-config-ai-agents-allowedai-coding-session-9b6de2- ✅ Passed ai-config-no-dangerous-commandsai-coding-session-9b6de2- ⚠️ Failedai-config-no-secretsai-coding-session-9b6de2Secret (generic-password) detected in session content [turn=762, source=tool_result, line=10]: INF redacted secrets from the AI coding session before upload count=50 rules=["generic-[REDACTED:generic-password]"] ✅ Passed ai-config-mcp-servers-allowedai-coding-session-9b6de2- -
Security Checks — ✅ 5 passing
✅ secret-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | secrets-detection |
- |
✅ sast-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | owasp-top10-2025 |
- |
| ✅ Passed | sast |
- |
| ✅ Passed | cwe-top25 |
- |
| ✅ Passed | cwe-top26-40-cusp |
- |
Scans not applied (3)
| Scan | Reason |
|---|---|
vulnerability-scan |
no manifest/lockfile changed |
github-actions-scan |
no workflow files changed |
iac-scan |
no IaC files changed |
Security context
This change touches code with 15 recorded security-fix advisories. These are pointers to what past fixes established, not findings in this diff, and they never fail the check.
View in Chainloop ↗ · How this works ↗
Powered by Chainloop and Chainloop Trace
There was a problem hiding this comment.
All reported issues were addressed across 18 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Share one backend client cache between services, collapse the client reload retry into a loop, move the NATS to memory fallback into casexistence.New, and simplify the cache tests. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 9b6de27d-6322-4cf7-8e72-5e56d858c783
Remove the existence cache settings from the CAS config and the Helm chart. The cache is always on with a 24h lifetime, in NATS KV when available and in memory otherwise, also when the NATS bucket cannot be set up at startup. Record the build-time decisions in spec issue-3543 (R-010, D-010 to D-013). Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 9b6de27d-6322-4cf7-8e72-5e56d858c783
There was a problem hiding this comment.
All reported issues were addressed across 13 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
The spec amendment for issue-3543 moves to its own spec PR. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 9b6de27d-6322-4cf7-8e72-5e56d858c783
Implements spec issue-3543. Closes #3543.
When an upload starts for evidence that is already stored, the Artifact CAS now answers from a cache of positive existence results instead of reading credentials from the secrets manager, building a storage client, and asking the backend. Repeated uploads of the same evidence, from
chainloop attestation addor the trace push, return after the first round trip. The CLI and the API do not change.Differences from the spec, to be recorded in a separate spec amendment:
This change was written with AI assistance (Claude Code).
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri