Skip to content

Refactor: Align CUE compatibility caching with pkg/cache #161

Open

Description

@roguepikachu

Is your feature request related to a problem? Please describe.
cue/upgrade keeps its own LRU for template compatibility checks (cue/upgrade/cache.go: lruCache, keyed by the SHA-256 of the template, with its own eviction loop). pkg now has a shared LRU, cache.LRUStore (cache/lru.go, #138), so there are two LRU implementations in the same module to maintain.

Describe the solution you'd like
Back the compatibility cache with cache.LRUStore and delete the private lruCache, keeping behaviour the same:

  • --cue-compatibility-cache-size / CompatibilityCacheSize still sets the entry limit, and InitCompatibilityCache can still be called more than once (tests do), stopping the previous store's sweeper.
  • Size 0 disables the cache today (put returns early when capacity is 0). LRUStore treats MaxSize <= 0 as unlimited, so 0 needs handling explicitly.
  • Entries expire an hour after they were last used (CacheEntryTTL, refreshed on every hit). LRUStore's TTL counts from when the entry was stored, so either refresh the entry on a hit or add sliding expiry to LRUStore; say which in the PR.
  • Tests cover both of those, plus eviction at the size limit.

Describe alternatives you've considered
Leaving both LRUs in place: works, but two caches with slightly different rules is what this tidies up.

Additional context
Moved from kubevela/workflow#256. Once this is released, workflow and kubevela pick it up with their next pkg bump; nothing to change on their side.

Activity

  1. added
    type/enhancement
    on Aug 24, 2026
  2. changed the title [-]Decision: No workflow change for CUE compatibility cache (pkg/cue/upgrade)[/-] [+]Consider aligning CUE compatibility caching with pkg/cache (if needed)[/+] on Aug 24, 2026
  3. changed the title [-]Consider aligning CUE compatibility caching with pkg/cache (if needed)[/-] [+]Refactor: Align CUE compatibility caching with pkg/cache[/+] on Aug 24, 2026
  4. added
    good first issue
    help wanted
    on Aug 24, 2026
  5. rahimuddin140 commented on Oct 17, 2026

    @rahimuddin140

    Hi! I'm new to open source and was reading this issue about aligning the CUE compatibility caching with the shared pkg/cache surface. The workflow-side work being mostly a dependency bump plus smoke tests sounds nicely scoped, and I like that it avoids duplicating the cache inside workflow. I'd love to take this on — would a PR be welcome?

  6. added
    type/refactor
    area/cue
    area/cache
    priority/nice-to-have
    and removed
    type/enhancement
    help wanted
    on Nov 21, 2026
  7. briankane commented on Nov 21, 2026

    @briankane
    Member

    Sorry for the slow reply on this. It's moved from workflow to pkg and the scope has changed: it's now just the pkg side (see the updated description), with a couple of behaviour details to watch. Still keen? If so it's yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/cachearea/cuegood first issuepriority/nice-to-havetype/refactor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions