Skip to content

ci(staging): enable analytics dual-write on the staging web build#7718

Merged
ggurdin merged 2 commits into
mainfrom
ci/enable-analytics-dual-write-staging
Jul 16, 2026
Merged

ci(staging): enable analytics dual-write on the staging web build#7718
ggurdin merged 2 commits into
mainfrom
ci/enable-analytics-dual-write-staging

Conversation

@bbsatvik01

@bbsatvik01 bbsatvik01 commented Jul 16, 2026

Copy link
Copy Markdown

What

Turn on the best-effort analytics dual-write (client#7464) for the staging web build by setting its two required env flags.

Why

client#7464 added the dual-write but ships it dark — the client only POSTs construct uses to the teacher-BFF when BOTH ANALYTICS_DUAL_WRITE_ENABLED=true and TEACHER_BFF_API are set. Neither is set anywhere today, so the deployed staging app does not dual-write at all. This appends both to build/web/.env in the staging web deploy, mirroring the existing staging-only ENABLE_SEMANTICS override.

Changes

File Change
.github/workflows/main_deploy.yaml append ANALYTICS_DUAL_WRITE_ENABLED=true + TEACHER_BFF_API=https://admin-dash-api.staging.pangea.chat to build/web/.env (staging web deploy only)
  • Staging-only: release.yaml (production) is untouched — prod stays dark until validated on staging.
  • Web reads .env at runtime from /.env, so this takes effect for staging web users on next load, no app rebuild.

Ordering / dependency (do NOT merge first)

This depends on admin-dash-api PR #57 (adds the client web origin to CORS_ORIGINS and allows the Authorization header through CORS). Merge/deploy #57 first; then merge this. If this lands first, web dual-write POSTs harmlessly CORS-fail (the write is best-effort/fire-and-forget, so no user-facing breakage — just no data lands).

Scope note

This enables web only (staging has no native pipeline). Native (iOS/Android) dual-write requires the same flags in the native build's bundled .env + a new app release — a separate change.

Test plan

  • YAML valid
  • staging-only (prod release.yaml untouched)
  • BFF endpoint + URL + CORS origin verified (server side is admin-dash-api PR Toolbar #57)
  • full dual-write pipe already verified E2E against real staging Matrix + local Postgres
  • post-merge: real staging student generates constructs → source='client' rows land → backfill → KG reflects

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Enabled dual-write analytics for the staging web environment.
    • Set the staging teacher backend API endpoint used by web deployments.
  • Chores
    • Updated UI code formatting in the left panel course list (no functional change).
  • Tests
    • Reformatted several unit tests for improved readability, with existing assertions and behavior unchanged.

Append ANALYTICS_DUAL_WRITE_ENABLED=true + TEACHER_BFF_API (staging BFF) to
build/web/.env in the staging web deploy (mirrors the ENABLE_SEMANTICS staging
override). Both are required for the client dual-write (client#7464) to fire;
NOT set on production (release.yaml) until validated on staging. Requires the
BFF CORS allowlist to include app.staging.pangea.chat (admin-dash-api PR #57).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ee9c205-d380-44f8-b326-1e51f7aa677b

📥 Commits

Reviewing files that changed from the base of the PR and between e26554b and 0351c5d.

⛔ Files ignored due to path filters (1)
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • lib/routes/world/left_panel/left_panel_courses_list_view.dart
  • test/pangea/grammar_error_example_split_test.dart
  • test/pangea/knock_space_response_test.dart
  • test/pangea/orchestrator_controller_suggestion_test.dart

📝 Walkthrough

Walkthrough

The staging web deployment workflow now injects analytics dual-write and teacher BFF API settings into the deployed web environment configuration. Dart UI expressions and Pangea tests are reformatted without behavior changes.

Changes

Deployment and formatting updates

Layer / File(s) Summary
Staging environment injection
.github/workflows/main_deploy.yaml
The deploy_web job writes ANALYTICS_DUAL_WRITE_ENABLED=true and the staging TEACHER_BFF_API URL into build/web/.env, with staging-only comments.
Dart UI and test formatting
lib/routes/world/left_panel/left_panel_courses_list_view.dart, test/pangea/*
Existing UI expressions and test invocations are reformatted without changing logic, inputs, assertions, or rendered output.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: wcjord

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the staging web dual-write enablement.
Description check ✅ Passed The description explains the change, rationale, staging-only scope, dependency, and test plan, though it doesn’t use the exact template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/enable-analytics-dual-write-staging

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ggurdin
ggurdin merged commit 82029b7 into main Jul 16, 2026
6 checks passed
@ggurdin
ggurdin deleted the ci/enable-analytics-dual-write-staging branch July 16, 2026 19:55
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.

2 participants