Skip to content

Fix engagement analytics and production readiness - #23

Merged
alextnetto merged 8 commits into
mainfrom
fix/analytics-readiness-20260922
Sep 22, 2026
Merged

alextnetto merged 8 commits into
mainfrom
fix/analytics-readiness-20260922

Conversation

@alextnetto

Copy link
Copy Markdown
Member

Summary

  • Correct viewer dwell attribution, continuous qualification, repeated-slide order, inactive visit boundaries, and page lifecycle recovery.
  • Show ordered per-appearance slide time in the owner dashboard using a native keyboard-accessible disclosure; explicitly withhold invented sequences for older data.
  • Preserve all three access modes and the two-tool MCP contract. Clarify the intentionally unverified email mode and production configuration.
  • Make CI provision all integration databases and prove its production-mode database connection uses verified TLS.

Migration and operational notes

The additive nullable event-qualification column is migrated at API startup. Existing totals and immutable presentation revisions are retained. Exact appearance order cannot be reconstructed for historical events, so the dashboard labels those sequences as unrecorded instead of guessing.

No new package, service, public tool, or authorization surface is introduced. Original unrelated working-tree changes are excluded.

Verification

  • 780 unit/integration tests across 93 files passed.
  • 48 Chromium end-to-end scenarios passed with retries disabled, including a deterministic delayed-visibility startup regression, actual 1/2/1 dwell and owner disclosure, and 31-minute same-tab rollover.
  • Typecheck, lint, formatting, deployment layout, web build, and MCP bundle checks passed. Both independent UX reviewers inspected 42 responsive captures; no blockers.
  • Current commit received independent code, security, requirements, context, and QA execution approval plus a debugging runtime audit. Hosted GitHub CI remains an explicit merge gate.

Post-merge verification checks both deployed commit hashes, real email sign-in, sharing/analytics UI, and cleanup of the synthetic release fixture. Local evidence does not claim population SLOs, Safari/Firefox certification, or actual browser BFCache admission.

@vercel

vercel Bot commented Sep 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pagent Ready Ready Preview Sep 22, 2026 8:22pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T20:33:33.601264Z b93e330 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@alextnetto
alextnetto merged commit b93e330 into main Sep 22, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b93e3309fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +53 to +55
this.delivery = new EngagementDelivery(input.sessionToken, (error) => {
if (error.status === 410) this.resetVisit();
else this.stop();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restart tracking after a stale-visit response

When the server expires a visit slightly before the client does—for example because recent queued events failed delivery—the user's next interaction is sent to the old visit and receives 410. This callback only resets state, clearing hasInteracted, the qualification timer, and queued events; because the pointer/click handlers have already completed, no replacement visit starts until the user interacts again. Consequently the first navigation/read after the stale boundary is omitted from analytics. Preserve the current interaction and immediately attempt a new visit after resetting.

Useful? React with 👍 / 👎.

Comment on lines +224 to +228
select visit_id as "visitId", slide_id as "slideId", event_at as "eventAt",
sequence, accepted_duration_ms as "activeDurationMs", qualified
from engagement_events
where visit_id in ${database(visitIds)}
order by event_at, sequence, server_received_at, idempotency_key

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid loading every heartbeat for an analytics read

For a long-lived or high-traffic deck, this query materializes every raw engagement event for every matching visit before aggregation. The tracker emits a heartbeat every 10 seconds and retention defaults to 365 days, so this turns an analytics request that previously loaded roughly one row per visit/slide into one that can load hundreds of rows per visit and millions of rows for a popular deck, causing large latency and memory spikes or request failure. Derive appearance aggregates in SQL or persist bounded appearance records instead of returning the complete raw event history on each read.

Useful? React with 👍 / 👎.

This branch was successfully deployed

3 active deployments
Production — b93e3309 Deployed Sep 22, 2026 by vercel[bot]
pagent / production — b93e3309 Deployed Sep 22, 2026 by railway-app[bot]
Preview — b93e3309 Deployed Sep 22, 2026 by vercel[bot]
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