[MC-458-K] fix(frontend): read concept notes by the concept uid, not member csv ids#649
Merged
Conversation
…member csv ids Compare's concept-note box resolves the note via conceptNoteKeys, which returned the underlying member csv ids (e.g. ["311"], ["328"]). But MC-458-E uid-migrated concept_notes (it is in ROOT_CONCEPT_KEYED_BLOCKS), so the server serves notes keyed by the concept identity uid (c-311, c-328). The box looked up the member id, found nothing, and fell back to the stale localStorage cache — so notes showed under the wrong concept (cold under cloud) or blank (bird), even though the data was correct. Fix: add noteKeysForConcept(concept) which leads with concept.key (the uid) and keeps the member csv ids after it as a legacy read-fallback / merged-member sync. ConceptNotesBox/resolveServerNote returns the first non-empty match, so it now finds the uid-keyed note. This is the notes-equivalent of the MC-458-J cognate keying fix. conceptUnderlyingKeys is unchanged: it intentionally omits concept.key for grouped concepts to avoid concept_id-collision in concept_id-keyed lookups; the note store is uid-keyed so that concern does not apply here. Tests: noteKeysForConcept (uid-first, members, merged, dedupe) + a ConceptNotesBox case proving a uid-keyed note resolves over a stale member-id localStorage entry. Full vitest 1205 passed; tsc --noEmit clean; build clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
Mandatory PR Review Checklist — PR #649 (MC-458-K)Per 1. Scope Confirmation & Sufficiency
2. Test Execution
3. Critical Systems Impact & Regression Check
4. Interactive Surface Verification
5. Side-Effect, Dependency & Performance
6. CI Gates & Merge Hygiene
7. Overall Integrity VerdictSAFE TO MERGE (pending human approval — agents don't merge).
8. Communication, Language & Docs Hygiene
|
The retained comment still said "merged → underlying member ids", which contradicts the fix. Replaced with the uid-first description. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
Code review — PR #649 (review skill)OverviewFixes the concept-note box reading notes under the wrong key. Correctness
Conventions / quality
Test coverage
Performance / security
Risks / suggestions
Verdict: approve / safe to merge (pending required human approval; not merging). This complements the mandatory 8-section checklist review posted above. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Compare's per-concept note box resolves its text via
conceptNoteKeys, which returned the concept's underlying member csv ids (e.g.["311"]for bird,["328"]for cloud). But MC-458-E uid-migratedconcept_notes(it's inROOT_CONCEPT_KEYED_BLOCKS), so the server serves notes keyed by the concept identity uid (c-311,c-328). The box looked up the member id, found nothing, and fell back to the stale localStorage cache — so a note showed under the wrong concept (cold under cloud) or appeared blank (bird), even thoughconcept_noteson the server was correct (verified: 0 mis-keyed).This is the notes-equivalent of MC-458-J (the cognate keying fix): an MC-458 reader still using csv-id/member keys instead of the concept uid.
Fix
Add
noteKeysForConcept(concept)(inspeakerElicitedConcepts.ts) that leads withconcept.key(the uid) and keeps the member csv ids after it as a legacy read-fallback and for merged-member save-sync.ConceptNotesBox/resolveServerNotereturns the first non-empty match, so it now finds the uid-keyed note;concept.key-first means the current note wins over any stale member-id/localStorage entry.ParseUIuses the helper instead of the inline "variant csv ids only" form.conceptUnderlyingKeysis intentionally left unchanged — it omitsconcept.keyfor grouped concepts to avoid concept_id collisions in concept_id-keyed lookups (sort keys, elicited filters). The note store is uid-keyed, so that concern doesn't apply; hence a dedicated helper rather than perturbing the shared one.No data change:
concept_notesis already correctly uid-keyed; this makes the reader use that key.Tests
noteKeysForConcept— uid-first for identity/grouped concepts, all members included,mergedKeys, singleton, dedupe.ConceptNotesBox— a uid-keyed note (c-328) resolves and is preferred over a stale member-id (328) localStorage entry.npx vitest run— 1205 passed, 9 skipped, 0 failed.tsc --noEmitclean.npm run buildclean.Scope / follow-ups
Converges the note reader onto the uid. Same broader convergence noted on #648 applies (single key-mint chokepoint, etc.). A "Reload identity/notes from disk" affordance (raised earlier) would remove the restart needed when notes are repaired out-of-band.
🤖 Generated with Claude Code