← Back to Pull requests

chore: replace go-cache with apimachinery expiring cache #3562

Open
unknown opened this pull request with 182 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 06, 2026 16:07 UTC
Author

Description

Replace github.com/patrickmn/go-cache with k8s.io/apimachinery/pkg/util/cache.Expiring and drop go-cache from go.mod.

  • go-cache starts a janitor goroutine that can not be stopped (no Close), which leaks in tests, goleak checks and synctest bubbles (https://github.com/patrickmn/go-cache/issues/166, https://github.com/patrickmn/go-cache/issues/185).

  • go-cache looks unmaintained (last commit 2019, open PRs without review).

  • go-cache reads the wall clock; Expiring takes an injected clock, so the drift, consistency, lifecycle and reboot history caches now follow it.

  • Expiring has no goroutine; it evicts expired entries inline on Set.
  • Expiries are unchanged; each SetDefault became Set with a named TTL constant. Expiring has no Flush, so the drift instance type check cache is held in an atomic.Pointer and Reset swaps in a fresh cache, which stays race free.

    How was this change tested?

    go test on the modified packages, then make test.

    AI Disclosure <!-- Per https://www.kubernetes.dev/docs/guide/pull-requests/#ai-guidance. Only check the boxes that apply. -->

  • I used AI assistance to help produce this contribution.

  • I have verified the AI generated code prior to submission.

  • I will engage with review comments directly and will not use AI to write my replies.
  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    Diff: 182 lines (+136 / -46) across 2 files Reviewer: AlexanderYastrebov Review duration: 8116m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 182 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.312
    Real PR Conversation Timeline
    1 comments
    "Review active on #3562"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.6% (MEDIUM) · Higher = larger blast radius
    35.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.0% · Safe to merge
    19.0%