[FIX] Variation id in sensi result is not enriched with element names#3946
[FIX] Variation id in sensi result is not enriched with element names#3946thangqp wants to merge 2 commits into
Conversation
Signed-off-by: Thang PHAM <phamthang37@gmail.com>
📝 WalkthroughWalkthroughThis PR adds UUID extraction and name resolution utilities to support enriching sensitivity analysis results with human-readable element names. Two utility functions handle parsing and mapping UUIDs within variation identifiers, integrated into the sensitivity analysis service to resolve opaque varId values before returning results. ChangesSensitivity Analysis Result Enrichment
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/services/study/sensitivity-analysis-utils.test.ts (1)
48-91: ⚡ Quick winConsider adding a test case for mixed-case UUIDs.
The test suite is comprehensive, but all test UUIDs are lowercase. To ensure robustness, consider adding a test case that verifies behavior with uppercase or mixed-case UUIDs, especially given that the
UUID_REGEXuses the case-insensitive flag.🧪 Proposed test case for case sensitivity
+ it('handles uppercase UUIDs correctly', () => { + const varId = '[1E34A601-FB40-4DF1-8DC6-09AAC5EF717E] (REGULAR)'; + const map = new Map([['1e34a601-fb40-4df1-8dc6-09aac5ef717e', 'FilterA']]); + // Should resolve if implementation normalizes case + expect(resolveForVariationId(varId, map)).toBe('[FilterA] (REGULAR)'); + });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/services/study/sensitivity-analysis-utils.test.ts` around lines 48 - 91, Add a test to the resolveVarId suite that verifies mixed-case UUIDs are matched correctly (since UUID_REGEX is case-insensitive): within the describe('resolveVarId') block add an it(...) case that passes a varId containing an uppercase or mixed-case UUID (e.g., '...[1E34A601-FB40-4DF1-8DC6-09AAC5EF717E]...') and a Map whose key is the lowercase UUID string used elsewhere, then assert resolveForVariationId returns the mapped name (confirming resolveForVariationId handles case-insensitive UUID matching against the Map).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/services/study/sensitivity-analysis-utils.test.ts`:
- Around line 48-91: Add a test to the resolveVarId suite that verifies
mixed-case UUIDs are matched correctly (since UUID_REGEX is case-insensitive):
within the describe('resolveVarId') block add an it(...) case that passes a
varId containing an uppercase or mixed-case UUID (e.g.,
'...[1E34A601-FB40-4DF1-8DC6-09AAC5EF717E]...') and a Map whose key is the
lowercase UUID string used elsewhere, then assert resolveForVariationId returns
the mapped name (confirming resolveForVariationId handles case-insensitive UUID
matching against the Map).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 32511c32-6688-45aa-bcdb-caba30b98b81
📒 Files selected for processing (3)
src/services/study/sensitivity-analysis-utils.test.tssrc/services/study/sensitivity-analysis-utils.tssrc/services/study/sensitivity-analysis.ts
|



PR Summary
This is only a proposal solution which enrich element names for variation id after fetching the result DTO.
However, there is not any solution at frontend to export sensi result with enriched variation id.