Repository navigation
feat: split daily active users into regulars and people back after a week away - #1382
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Compute seven-day returns and losses app/Queries/BackAndLostQuery.php, tests/Unit/Queries/BackAndLostQueryTest.php |
BackAndLostQuery calculates daily returns and losses using a seven-day gap. It marks loss counts as complete when the seven-day period has elapsed and flags dates whose lookback predates recorded activity. Tests cover exclusions, date boundaries, backfill status, and ranges after today. |
Add return and loss fields to active-user results app/Queries/ActiveUserCountsQuery.php, resources/js/types/operations.ts, tests/Unit/Queries/ActiveUserCountsQueryTest.php, tests/Feature/Controllers/ProductMetricsControllerTest.php |
ActiveUserCountsQuery replaces returning with regular and adds back, lost, lost_complete, and backfilled. The result type and test expectations use the updated fields. |
Display return and loss categories resources/js/pages/operations/metrics.tsx |
Daily bars support below-axis values. The active-user chart shows regular, back, and lost users, and reports whether loss counts are complete or approximate. |
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant ActiveUserCountsQuery
participant ActivationByDayQuery
participant BackAndLostQuery
participant OperationsMetricsChart
ActiveUserCountsQuery->>ActivationByDayQuery: retrieve daily activation counts
ActiveUserCountsQuery->>BackAndLostQuery: retrieve daily back and lost counts
BackAndLostQuery-->>ActiveUserCountsQuery: return counts and status flags
ActiveUserCountsQuery-->>OperationsMetricsChart: provide active-user results
OperationsMetricsChart->>OperationsMetricsChart: render back and lost segments
Possibly related PRs
- dev-null-sh/dev-null.sh#1324: Adds and records
user_active_days, whichBackAndLostQueryreads for the seven-day metrics. - dev-null-sh/dev-null.sh#1337: Calculates signup-cohort retention from
user_active_daysand uses the same historical completeness assumption.
Suggested reviewers: xheaven, nunomaduro
Merge Risk: 
Minimal · up to 805df
-
The reviewed change is mergeable after normal checks; no concrete issue requiring a fix was established.
Security architecture risk: 
Low · up to 805df
-
The change remains within the administrator-only metrics dashboard and returns aggregate counts rather than individual activity records. No new access-control bypass or persistent state change was identified. The main remaining uncertainty is the additional database workload, especially for historical ranges.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The inspected change affects administrator-visible aggregate metrics and database read workload. It does not add an observed path for ordinary or unauthenticated users to retrieve individual activity data.
Trust Boundaries and Controls
- observed — The metrics route remains inside authentication middleware, and its dedicated request authorizes administrators only. The boundary comparison found these controls unchanged from the specified PR base. The new SQL uses bound parameters for dates, gap values, and bot exclusions.
-
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 7 files.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
…week away, with the people lost below, instead of a panel of its own
… their week away is over
…the axis against the bars
Summary
Day-N retention doesn't move once day N is over. If we bring back people who signed up weeks ago (an email about what's new, say), the retention charts can't show it.
"Daily active users" now shows where each day's active people come from, and who left:
Changes
BackAndLostQuerycounts both fromuser_active_days, with no new stored data. Bots are left out, like the other metric queries.ActiveUserCountsQuerysplits "returning users" into regulars and back, so bar totals still matchactive_user_counts. It also returns lost.DailyBarscan hang a value below the axis, on the same scale. The other charts are unchanged.Visual evidence
Local app with synthetic data: about 4,800 sign-ups since Oct 15, a launch spike on Oct 20, and a pretend "we're back" email on Oct 28 that brings some dormant people back. Today is Nov 1, range 30d.
Tooltip on Oct 28:
Device verification
There's no new mobile interaction, only a chart. I checked 390px in Chromium emulation, not on a device: the legend wraps and the bars below the axis stay inside the panel.
Limitations
Summary by CodeRabbit