Skip to content

fix(personality): invalidate stale pre-MBTI cached snapshots - #18

Merged
ClaudiaFang merged 1 commit into
masterfrom
worktree-personality-stale-cache-fix
Jul 21, 2026
Merged

fix(personality): invalidate stale pre-MBTI cached snapshots#18
ClaudiaFang merged 1 commit into
masterfrom
worktree-personality-stale-cache-fix

Conversation

@ClaudiaFang

Copy link
Copy Markdown
Member

Summary

  • GET /api/personality served cached personality_snapshots rows persisted before the cognitiveFunctions + mbti addition (profileVersion 2) as-is — those rows lack mbti/cognitiveFunctions entirely.
  • The dashboard's MbtiCard and CognitiveFunctionRadarChart read those fields unconditionally, crashing with undefined is not an object (evaluating 't.map') on the Personality page.
  • readSnapshot now treats a cached row whose profileVersion doesn't match the current version (2) as a cache miss, falling through to a fresh compute — same path as no cache at all.

Test plan

  • Added regression tests in server/src/routes/personality.test.ts: cache hit on matching version, cache-miss fallback for a row with no profileVersion field, cache-miss fallback for profileVersion: 1
  • pnpm test (root, all workspaces): cli 914 passed, server 658 passed, dashboard 15 passed
  • pnpm build (cli + server) — clean tsc

…rsion

readSnapshot served personality_snapshots rows persisted before the
cognitiveFunctions + mbti addition (profileVersion 2) as-is, missing
those fields entirely. The dashboard's MbtiCard and
CognitiveFunctionRadarChart read them unconditionally, crashing with
"undefined is not an object (evaluating 't.map')". Now a cached row
whose profileVersion doesn't match the current version is treated as
a cache miss and falls through to a fresh compute, same as no cache
at all.
@ClaudiaFang
ClaudiaFang marked this pull request as ready for review July 21, 2026 13:31
@ClaudiaFang
ClaudiaFang merged commit 9c1c8f2 into master Jul 21, 2026
1 check passed
@ClaudiaFang
ClaudiaFang deleted the worktree-personality-stale-cache-fix branch July 21, 2026 13:31
ClaudiaFang pushed a commit that referenced this pull request Jul 23, 2026
chore: add Vercel deployment config for docs site
ClaudiaFang added a commit that referenced this pull request Jul 23, 2026
…ache-fix

fix(personality): invalidate stale pre-MBTI cached snapshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant