fix(jans-fido2): use the fixed adoption rate in the executive summary - #14861
Conversation
Signed-off-by: imran <imranishaq7071@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthrough
ChangesExecutive summary adoption insights
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This PR corrects the executive summary to use the established adoption-rate metric and prevents the prior runtime failure, with no actionable merge-blocking risk remaining after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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 |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|



PR body
Prepare
Description
Target issue
closes #14859
Implementation Details
Fido2AnalyticsService.generateExecutiveSummarydid not useFido2MetricsService. getUserAdoptionMetrics'sadoptionRate— it pulledtotalUniqueUsersandnewUsersback out ofthat map and recomputed its own rate. Two defects from that:
totalUsersistotalUniqueUsers— everyoneactive in the query window, not a user population — so the recompute fell into the same
"
adoptionRatefalls as adoption succeeds" trap that fix(jans-fido2): user-adoption metrics measure the wrong population #14830 fixes ingetUserAdoptionMetricsitself. Fixing the source method did not fix this call site, because this call site threw the
fixed value away.
(Long)cast threw on every non-empty window.getUserAdoptionMetricsstorestotalUniqueUsers/newUsersasSet.size()— anint, autoboxed toInteger— not aLong.Casting an
IntegertoLongthrowsClassCastExceptionat runtime.generateExecutiveSummaryis only ever called from
generateComprehensiveReport, which wraps it in a try/catch, so theentire comprehensive report silently failed and returned only an
errorkey — discardingperformance, device, error and trends data along with it — whenever the window had at least one
active user.
The fix. Read
adoptionRatestraight fromuserAdoption.get(Fido2MetricsConstants.ADOPTION_RATE)as a
Doubleand use it directly for the insight thresholds, instead of recomputing fromtotalUniqueUsers/newUsers. Fixes both defects at once: no more cast mismatch, and the insight nowagrees with the corrected, population-scoped rate.
Currently unreachable from the REST API.
Fido2AnalyticsServicehas no caller inFido2MetricsControlleror anywhere else injans-fido2—generateComprehensiveReportandgenerateExecutiveSummaryare dead code today. Fixing it now so it's correct before the service isever wired up, rather than rediscovered as a production incident afterward.
Relationship to #14830. This PR does not depend on #14830 landing first —
adoptionRatealreadyexists as a key on
getUserAdoptionMetrics's response regardless of which PR merges first, this PRjust stops bypassing it. Once #14830 also lands, the value this reads becomes the corrected one.
Test and Document the changes
Tests — new
Fido2AnalyticsServiceTest(3 tests, all green):ClassCastExceptionadoptionRatefrom the metrics service, not a window-activityratio recomputed from
totalUniqueUsers/newUsersnull) adoption rate adds no adoption insight and does not throwDocs — no docs page describes
Fido2AnalyticsService's executive summary (it isn't wired to acontroller yet), so none needed updating.
Please check the below before submitting your PR. The PR will not be merged if there are no commits that start with
docs:to indicate documentation changes or if the below checklist is not selected.Summary by CodeRabbit
Bug Fixes
Tests