Fix API Key Status Cache Synchronization and Expired State Handling - #1950
Fix API Key Status Cache Synchronization and Expired State Handling#1950the-hercules wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens API key status/cache consistency by (1) forcing cached rtgodam_user_data into an explicit EXPIRED state once the grace period has ended (when automatic verification is skipped), and (2) clearing cached user data immediately when a previously-valid key is detected as expired.
Changes:
- Update cached/persisted
rtgodam_user_datatovalid_api_key=falseandapi_key_status=EXPIREDwhen skipping verification post–grace period. - Delete the
rtgodam_user_dataoption when a previously valid key transitions to expired during verification.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| inc/helpers/custom-functions.php | Syncs cached rtgodam_user_data to an explicit EXPIRED state when verification is skipped after grace period. |
| admin/godam-transcoder-functions.php | Clears cached rtgodam_user_data when verification determines a previously valid key is expired. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code ReviewTraced the full flow across both files and their callers. Overall the fix is sound and the write-avoidance guard is genuinely well-designed — a few notes below. What's good
Issues & suggestions1. The The change isn't harmful, but the PR description's claim that the cache "is immediately removed … forces regeneration on the next request" only holds for the manual-verify path, not the automatic one. Worth a code comment so a future maintainer doesn't assume the delete is authoritative. 2. Possible undefined-index notice on 3. Stale 4. Unrelated cosmetic change. The removed blank line in TestsNo tests added. This is cache-consistency logic with several branches (expired+grace, expired+post-grace, missing cache, already-corrected cache) and there's no existing coverage for Security / performance
VerdictApprove with minor changes. Core fix is correct. Before merge I'd suggest: (a) clarify/justify the transcoder 🤖 Generated with Claude Code |
|
Above issues addressed cc - @KMchaudhary |
Closes https://github.com/rtCamp/godam-core/issues/1070
Overview
This PR improves API key status handling by ensuring cached user data remains consistent with the persisted API key state, particularly during expiration and grace-period flows.
Changes
1. Force EXPIRED State After Grace Period
When verification is skipped after the grace period ($skip_verification), cached user data is now explicitly updated with:
and persisted back to rtgodam_user_data.
Why: Ensures stale verification results cannot persist in cache once the grace period has ended.
2. Clear Cache When API Key Expires
When a previously valid API key is determined to be expired:
the cached user data is immediately removed.
Why: Prevents requests from using data generated while the key was still valid and forces regeneration on the next request.
Impact
Video Demo
Screen.Recording.2026-06-24.at.4.02.39.PM.mov