fix: new user detection race condition + telemetry gaps#445
fix: new user detection race condition + telemetry gaps#445anandgupta42 merged 5 commits intomainfrom
Conversation
… icon semantics, field validation, pre-delivery checklist Six improvements derived from session learnings — all general, none task-specific: - component-guide: lazy chart initialization pattern for multi-tab dashboards (Chart.js/Recharts/Nivo all render blank in display:none containers) - component-guide: data-code separation for programmatic HTML generation (f-string + JS curly braces cause silent parse failures) - SKILL.md Design Principles: dynamic color safety rule for external/brand colors - SKILL.md Design Principles: icon semantics check - SKILL.md Anti-Patterns: warn against filtering on unvalidated data fields - SKILL.md: pre-delivery checklist (tabs, fields, contrast, icons, tooltips, mobile)
UI Fixes: - Guard `isFirstTimeUser` on sync status — don't show beginner UI while sessions are loading (prevents flash on every startup) - Make Tips component reactive — tip pool now updates when `isFirstTime` changes (was locked at render time) Telemetry Fixes (privacy-safe): - Add `first_launch` event — fires once after install, contains only version string and is_upgrade boolean. No PII. Opt-out-able. - Use machine_id as ai.user.id fallback — IMPROVES privacy by giving each anonymous user a distinct random UUID instead of grouping all non-logged-in users under empty string "" Documentation: - telemetry.md: added `first_launch` to event table, new "New User Identification" section, "Data Retention" section - security-faq.md: added "How does Altimate Code identify users?" and "What happens on first launch?" sections All telemetry changes respect existing ALTIMATE_TELEMETRY_DISABLED opt-out. No PII is ever sent — machine_id is crypto.randomUUID(), email is SHA-256 hashed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review.
Tip: disable this comment in your organization's Code Review settings.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds first-launch telemetry tracking, enhances user identification for analytics, and improves first-time user detection in the CLI TUI. It introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI Start
participant Welcome as Welcome Banner
participant Telemetry as Telemetry
participant AppInsights as App Insights
CLI->>Welcome: showWelcomeBannerIfNeeded()
Welcome->>Welcome: Check ~/.altimate/.first_launch_shown
Welcome->>Welcome: Detect isUpgrade via machine-id existence
Welcome->>Telemetry: track({ type: "first_launch", version, is_upgrade })
Telemetry->>Telemetry: Resolve userEmail || machineId || ""
Telemetry->>AppInsights: Send event with ai.user.id fallback
AppInsights-->>Telemetry: Acknowledged
Telemetry-->>Welcome: Complete
alt isUpgrade = false
Welcome-->>CLI: Show welcome banner
else isUpgrade = true
Welcome-->>CLI: Skip (return)
end
sequenceDiagram
participant TUI as TUI Home Route
participant Sync as Session Sync
participant FirstTime as First-Time Detector
participant Tips as Tips Component
TUI->>Sync: Initialize session data fetch
Sync-->>TUI: sync.status = "loading"
TUI->>FirstTime: isFirstTimeUser() — status loading?
FirstTime-->>TUI: Return undefined (defer)
TUI->>TUI: Skip onboarding hint (when !== true)
Sync-->>TUI: sync.status = "success", sync.data.session = [...]
TUI->>FirstTime: isFirstTimeUser() — check session.length === 0
FirstTime-->>TUI: Return true or false
alt session.length === 0
TUI->>Tips: Show Tips with isFirstTime={true}
Tips->>Tips: createMemo selects from BEGINNER_TIPS pool
Tips-->>TUI: Render beginner tips
else
TUI->>Tips: Show Tips with isFirstTime={false}
Tips->>Tips: createMemo selects from TIPS pool
Tips-->>TUI: Render regular tips
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.opencode/skills/data-viz/references/component-guide.md:
- Line 425: Update the inaccurate description for Nivo's Responsive* components:
replace the claim that ResizeObserver "never re-fires on show" with text
describing the actual lifecycle (e.g., "uses ResizeObserver — initially measures
as 0×0 when hidden, then re-measures and re-renders correctly when the container
becomes visible"); reference Nivo's measurement hooks (useMeasure /
useDimensions in `@nivo/core`) to clarify that the ResizeObserver triggers a new
measurement when visibility/size changes so the chart is rendered with correct
dimensions.
In `@packages/opencode/src/cli/welcome.ts`:
- Around line 45-55: The is_upgrade flag is computed incorrectly (isUpgrade =
installedVersion === currentVersion) and cannot distinguish fresh installs from
upgrades; change the logic in the CLI startup path that sets isUpgrade (the
variables installedVersion and currentVersion and the Telemetry.track call) to
detect whether a previous marker/version existed: read the previous version
before you overwrite the marker (or check marker existence), set is_upgrade =
true only when a previousVersion exists AND previousVersion !== currentVersion,
and set is_upgrade = false for first-time installs (no previousVersion present);
then pass that corrected boolean into Telemetry.track.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 860aa2ff-e725-4b50-9fb0-119a736d9193
📒 Files selected for processing (8)
.opencode/skills/data-viz/SKILL.md.opencode/skills/data-viz/references/component-guide.mddocs/docs/reference/security-faq.mddocs/docs/reference/telemetry.mdpackages/opencode/src/altimate/telemetry/index.tspackages/opencode/src/cli/cmd/tui/component/tips.tsxpackages/opencode/src/cli/cmd/tui/routes/home.tsxpackages/opencode/src/cli/welcome.ts
- use `~/.altimate/machine-id` existence for robust `is_upgrade` flag - fix 3-state logic in `isFirstTimeUser` memo to prevent suppressed beginner UI - prevent tip re-randomization on prop change in `tips.tsx` - add missing `first_launch` event to telemetry tests - remove unused import
Multi-Model Code Review — 6 Models, 1 Round ConvergenceVerdict: All findings below were identified during review and fixed in Major Issues (Fixed)1.
Fix: Now uses Flagged by: GPT 5.2 Codex, Gemini 3.1 Pro, Kimi K2.5, GLM-5 2. Returning Fix: Now returns Flagged by: GPT 5.2 Codex, Gemini 3.1 Pro Minor Issues (Fixed)3. Tips re-randomized when
Fix: Random value now captured once at mount time, reused inside the memo. Flagged by: Claude, Gemini 3.1 Pro, GLM-5 4. Missing Fix: Added Flagged by: GPT 5.2 Codex, Gemini 3.1 Pro, Kimi K2.5, MiniMax M2.5 NIT (Fixed)5. Unused Fix: Removed. Flagged by: Kimi K2.5 Finding Attribution
Reviewed by 6 models. Convergence: 1 round, unanimous agreement. All findings resolved in |
- Correct Nivo `Responsive*` behavior: `ResizeObserver` does re-fire when container becomes visible, not "never re-fires on show" - Add `altimate_change` marker around `installedVersion` banner line Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
What does this PR do?
Fixes 3 bugs in the "new user" detection system and 2 telemetry gaps.
UI Fixes:
home.tsx):isFirstTimeUserwas evaluatingsession.length === 0before sessions loaded, causing beginner UI to flash on every startup for all users. Now guards onsync.status !== "loading".tips.tsx): Tip pool was a plain variable, not reactive. Beginner tip selected during the flash persisted for the entire session. Now usescreateMemo.Telemetry Fixes (privacy-safe):
first_launchevent (welcome.ts): Fires once after install. Contains only version string + is_upgrade boolean. No PII.machine_idfallback (telemetry/index.ts): Anonymous users now get their random UUID asai.user.idinstead of"". This is a privacy improvement — stops grouping all anonymous users as one mega-user.Documentation:
telemetry.md: Addedfirst_launchto event table, "New User Identification" section, "Data Retention" sectionsecurity-faq.md: Added "How does Altimate Code identify users?" and "What happens on first launch?" Q&AsType of change
Issue for this PR
Closes #444
How did you verify your code works?
createMemoguards onsync.statusALTIMATE_TELEMETRY_DISABLEDopt-outChecklist
Summary by CodeRabbit
Documentation
Bug Fixes
Tests