Skip to content

fix(cache): recover from corrupt scalar entries - #2828

Open
HandSonic wants to merge 1 commit into
OtterMind:mainfrom
HandSonic:fix/cache-corrupt-fallback
Open

fix(cache): recover from corrupt scalar entries#2828
HandSonic wants to merge 1 commit into
OtterMind:mainfrom
HandSonic:fix/cache-corrupt-fallback

Conversation

@HandSonic

@HandSonic HandSonic commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Related issue

N/A - no matching issue was found.

Summary

A malformed scalar JSON entry escaped CacheManage before the configured fallback loader could run, so the same cache key remained unusable for its TTL. This change catches scalar deserialization failures, removes only the corrupt key, and lets the existing fallback path rebuild and cache a valid value.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Commands and results:
    • Red test reproduced Fastjson JSONException: input end before fallback.
    • Focused CacheManageTest: 6 tests passed.
    • Domain-core reactor after rebase: 228 domain-core tests passed; dependency modules passed.
    • Backend reactor package: succeeded.
    • Fork code and CodeQL checks: rerunning for the rebased head.
    • git diff --check origin/main...HEAD: passed.
  • Manual verification: N/A - tests use a real in-memory Ehcache and verify first-call rebuild plus second-call cache hit.
  • UI evidence: N/A

Risk and compatibility

  • Public API or stored data: No API or cache format changes; only an unreadable key is evicted.
  • Database or driver compatibility: N/A.
  • Network, privacy, or security: N/A.
  • Community / Local / Pro boundary: Shared Community metadata cache.
  • Backward compatibility: Valid scalar and list entries retain existing behavior.

Reviewer map

  • Start here: CacheManage.CacheStore.get and the corrupt scalar regression case.
  • Failure condition: malformed JSON escapes before fallback or a valid neighboring key is removed.
  • Rollback or disable path: Revert commit 8618ac7e9edd87667ac9c0674f6b5516922956e3; no migration is required.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: OpenAI Codex assisted with diagnosis, implementation, automated tests, verification, and adversarial review.

@HandSonic
HandSonic requested review from a team and openai0229 as code owners August 30, 2026 17:49
@openai0229 openai0229 moved this to In Review in Chat2DB Community Aug 30, 2026
@HandSonic
HandSonic force-pushed the fix/cache-corrupt-fallback branch from cfd756e to 8618ac7 Compare September 3, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants