Skip to content

Audit Dashboard, Focus Card, Onboarding & Mobile Shell: fix P0-P3 defects - #1780

Merged
elkimek merged 4 commits into
mainfrom
audit/dashboard-focus-onboarding-mobile
Dec 6, 2026
Merged

elkimek merged 4 commits into
mainfrom
audit/dashboard-focus-onboarding-mobile

Conversation

@elkimek

@elkimek elkimek commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the Tier 3.4 audit fixes for Dashboard, Focus Card, Onboarding & Mobile Shell in getbased (P0–P3).

P0

  • js/sun-onboarding-ai.ts & js/light-today-ai.ts: Gate onboarding AI context, fingerprint, canAnalyze, and shouldAutoFire on isLightSunContextEnabled(); wrap healthGoals and sleepRest serialization in isInsightContextCardsEnabled(); filter Vitamin D lab entries through createLabContextDisclosure().entries(...) in both sun-onboarding-ai.ts and light-today-ai.ts so lab master toggles, lab group toggles, and date/panel/marker tombstones are consistently enforced.

P1

  • js/data-core.ts & js/focus-card.ts: Extend getFocusCardFingerprint() with labPanelTombstones, _deleted, _deletedAt, _deletedClearedAt, customMarkers, markerPlacements, unitSystem, rangeMode, and getContextDisclosureFingerprint() (while keeping js/data-core.ts compact under the line budget). Short-circuit projectFocusCard() and loadFocusCard() before reading cached/demo prefills when !isLabMarkersContextEnabled(). Add monotonic sequence tracking (focusCardRequestSeq) and AbortController cancellation for concurrent loadFocusCard() calls, forwarding signal to queryLens and callAssistantFeatureAI.
  • js/dashboard-lab-widget-renderers.ts: Skip null/empty draw values in dashboardPearson() before numeric coercion so sparse draw dates do not fabricate correlations from coerced 0s.
  • js/mobile-dashboard.ts, types/mobile-dashboard.ts, js/dashboard-view-composition.ts, js/dashboard-view-shell.ts: Add and wire loadFocusCard into mobileDashboardDeps, calling loadFocusCard({ refreshStale: false }) after mobile dashboard hydration (guarded by request.isCurrent()).
  • js/mobile-dashboard.ts: Defer adding mobile-dashboard-active until right before mounting (disposeDashboardPage()) after request.isCurrent() succeeds, and call syncMobileBottomNav('dashboard') so #mobile-bottom-tabs and mobile-tabs-active are cleared on both sync and async mobile dashboard renders.

P2

  • js/dashboard-page-view.ts: Guard the 100ms startEmptyTour timeout callback on onboardingGeneration, currentProfile, importedData, connected #main-content, and empty-dashboard-active.
  • js/dashboard-quick-marker-core.ts: Compare toggled pin storage ID against the resolved storage ID of state._activeDetailMarkerId and re-open the modal using state._activeDetailMarkerId so moved/re-categorized markers refresh cleanly.
  • js/dashboard-recommendation-widget.ts, js/dashboard-page-view.ts, js/mobile-dashboard.ts: Track failed catalog loads so the recommendations widget renders an empty state instead of looping loading when loadCatalog() fails/returns null (resetting on explicit retry or cache population), attach rejection handlers to catalog preload chains, and include deviceSessions alongside sunSessions in recent light session checks.
  • js/dashboard-widget-renderers.ts: Fast-path zero-genetics profiles to { kind: 'empty', contributionHref: null } when DNA helpers are not loaded yet (avoiding "Loading 0 SNPs" flash and unnecessary module fetches), guard async DOM refreshes on current profile/data ownership, and queue/run follow-up loads when needsMtdna arrives mid-load.

P3

  • js/dashboard-widget-controls.ts: Clear draggingWidgetId = null on document 'dragend' so cancelled drags cannot reorder widgets later.
  • js/onboarding-view.ts: Guard setOnboardingFocus('cards') async openChatPanel continuation and scroll timer on profile/data ownership and attach .catch(() => {}).

Verification

  • npm run typescript:build & npm run architecture:build (regenerated MODULE_MAP.md)
  • npm run typecheck, npm run typecheck:migration, npm run typecheck:migration-tests, npm run typecheck:checkjs, npm run typecheck:strict-null (0 diagnostics)
  • npm run architecture:check (2133 modules, 0 cyclic)
  • npm run quality (17/17 checks passed)
  • node tests/verify-modules.js (161/161 passed)
  • Vitest (20 suites, 361/361 tests passed), including new regression suite tests/dashboard-focus-onboarding-mobile-audit.test.ts (16 tests covering all P0–P3 fixes) and maintained contract tests (tests/dashboard-owned-quick-contract.test.ts, tests/dashboard-owned-notes-contract.test.ts, tests/dashboard-genome-rows-presentation.test.ts, tests/dashboard-current-zero-sink-ledger.test.ts, tests/mobile-dashboard-presentation.test.ts, tests/dashboard-composition-contract.test.ts, tests/dashboard-renderer-lifecycle.test.ts, tests/dashboard-onboarding-route.test.ts, tests/dom-sink-audit.test.ts)
  • Legacy Node suites: tests/test-onboarding-view-runtime.js (7/7), tests/test-recommendations.js (140/140), tests/test-correctness-phase2.js, tests/test-sun-defaults.js, tests/test-audit.js (385/385)
  • Exhaustive Playwright browser and combined coverage matrices are owned by GitHub Actions CI.

@greptile-apps

greptile-apps Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; no new actionable issue was established.

Summary

This PR adds disclosure checks for Light AI, strengthens Focus Card cache checks and cancellation, and fixes dashboard lifecycle details.

  • Sun onboarding and Light Today follow their context settings.
  • The Focus Card tracks current lab settings and requests.
  • The mobile dashboard loads the Focus Card after its shell mounts.
  • Recommendations leave loading when the catalog is unavailable.
  • The Genome widget waits only for data the profile needs.
  • Lab correlations skip missing draw values.
  • The empty-dashboard tour starts only while its page is current.
  • Pinning a moved marker refreshes its open detail.
  • Cancelled widget drags no longer affect a later drop.
  • Onboarding chat callbacks stop when their profile changes.

Reviews (5) · Last reviewed commit: "Regenerate MODULE_MAP.md after rebasing ..." · Reviewed by Greptile

Comment thread js/dashboard-widget-renderers.ts Resolved
Comment thread js/dashboard-widget-renderers.ts Resolved
@elkimek
elkimek force-pushed the audit/dashboard-focus-onboarding-mobile branch from f23550a to 0d81a9e Compare December 5, 2026 08:10
Comment thread js/light-today-ai.ts Resolved
@greptile-apps

greptile-apps Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

security Security Review

This PR appears safe to merge from a security standpoint.

What was checked
  • The new light/sun context gates in sun-onboarding and light-today block every AI call path, including auto-fire and queued analyses, while the toggle is off; the verdict engine really enforces the canAnalyze and shouldAutoFire options before any request is sent.
  • Vitamin D lab values now pass through the lab disclosure filter (tombstones, panel deletions, group and marker toggles) before reaching the AI prompts in both onboarding and day contexts.
  • Focus card projection, loading, and cache reuse are gated on the lab markers toggle, and the expanded fingerprint covers disclosure settings and deletion tombstones, so a cached insight built under old settings cannot be shown after the user turns a source off.
  • Automatic (non-user-initiated) AI calls still require the transparency acknowledgment and destination approval enforced in requireAIProcessingApproval.
  • No new HTML injection sinks: message and error text render through escaping Svelte components and the lens page uses textContent; the new tests and helpers add no network calls, keys, or secrets.

Reviews (4) · Last reviewed commit: "Regenerate MODULE_MAP.md after rebasing ..." · Reviewed by Greptile

Comment thread js/dashboard-recommendation-widget.ts Resolved
@elkimek
elkimek force-pushed the audit/dashboard-focus-onboarding-mobile branch from b75662d to afe54a1 Compare December 6, 2026 13:35
@elkimek
elkimek merged commit 8434f7e into main Dec 6, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant