fix(insight): Harden insight facet normalization and empty qualitative handling#108
Open
BingqingLyu wants to merge 2 commits into
Open
fix(insight): Harden insight facet normalization and empty qualitative handling#108BingqingLyu wants to merge 2 commits into
BingqingLyu wants to merge 2 commits into
Conversation
Owner
Author
Conflict Group 2This PR shares modified functions with 1 other PR(s): #45. These PRs should be reviewed as a batch — merging one may affect the others.
graph LR
PR108["PR #108"]
FAtAGlance_7020["AtAGlance<br>Qualitative.tsx"]
PR108 -->|modifies| FAtAGlance_7020
PR45["PR #45"]
PR45 -->|modifies| FAtAGlance_7020
FNavToc_7020["NavToc<br>Qualitative.tsx"]
PR108 -->|modifies| FNavToc_7020
PR45 -->|modifies| FNavToc_7020
FanalyzeSession_8719["analyzeSession<br>DataProcessor.ts"]
PR108 -->|modifies| FanalyzeSession_8719
PR45 -->|modifies| FanalyzeSession_8719
FgenerateQualitativeInsights_8719["generateQualitativeInsights<br>DataProcessor.ts"]
PR108 -->|modifies| FgenerateQualitativeInsights_8719
PR45 -->|modifies| FgenerateQualitativeInsights_8719
Posted by codegraph-ai conflict detection. |
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.
TLDR
This PR hardens the insight generation system by adding robust normalization for session facet data and improving handling of empty qualitative sections in the insight report UI.
Key Changes:
Screenshots / Video Demo
N/A — internal data handling improvements with no visible UI changes when data is present. When qualitative data is empty, sections are now hidden instead of showing blank areas.
Dive Deeper
The insight generation pipeline processes session data through LLM analysis to produce both quantitative metrics and qualitative insights. Previously, the system had several vulnerabilities:
This PR addresses these issues by:
Normalization layer: All facet data is now normalized through type-safe functions that coerce invalid values to sensible defaults (e.g., invalid enum values fall back to defaults, null objects become empty records)
Meaningfulness checks: The UI now checks if qualitative sections have actual content before rendering them, using a recursive function that handles strings, numbers, arrays, and objects
Defensive aggregation: Count record aggregation now safely handles malformed inputs using
Cached facet validation: When reusing cached facets from previous runs, they are now normalized before being returned
Reviewer Test Plan
✓ src/services/insight/generators/DataProcessor.test.ts (42 tests) 68ms
Test Files 1 passed (1)
Tests 42 passed (42)
Start at 18:28:01
Duration 6.19s (transform 1.17s, setup 22ms, collect 2.32s, tests 68ms, environment 384ms, prepare 98ms)
Testing Matrix
Tested on macOS with npm run build + npm run test
Linked issues / bugs
No linked issues
🤖 Generated with Qwen Code