docs(plans): record staging results and plan the production rollout (#22181)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Paperclip Cloud now sends analytics directly to PostHog, and this is
live on staging
> - The plan doc records the rollout state and the steps that remain
> - Production needs an ordered, reversible rollout with clear decisions
> - This pull request records the staging results and adds the
production rollout plan
> - The benefit is one reviewed place that says what is done, what is
next, and how to roll back

## Linked Issues or Issue Description

**What is the problem?**
The plan doc still shows the staging rollout as pending and has no
production steps.

**What do you propose?**
Update the delivery state with the merged pull requests and staging
results, and add Phase 5: the production rollout, with prerequisites,
one step per switch, checks, and rollbacks.

**Why does it matter?**
Production changes must be ordered and reversible, and the open
decisions must be visible.

## What Changed

- Update the delivery state table in
`doc/plans/2026-11-17-cloud-direct-posthog.md`.
- Add "Phase 5: production rollout".

## Verification

- Documentation only.

## Risks

- Low risk. Documentation only.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 authored and GitHub committed 2026-11-18 09:19:23 -06:00
1 parent da306ac2da
commit f1abee7060
1 file changed
+85 -5
+85 -5
View File
@@ -1,6 +1,6 @@
# Paperclip Cloud sends analytics directly to PostHog
Status: proposed, 2026-11-17 (revised: Cloud uses real IDs)
Status: live on staging 2026-11-18; production rollout planned (see Phase 5)
PostHog project: 483530 (US), kept as the only project so history is preserved.
## Delivery state (coordinator keeps this current)
@@ -15,11 +15,15 @@ Production enablement is gated on the Phase 0 compliance checklist owner.
| Phase 0 A: install ID stability + Cloud ingest URL source | subagent | done. Stacks run on Railway with a `/paperclip` volume (state.json persists), except `single-ephemeral` stacks (new ID each boot). Legacy three-service stacks had ephemeral disks, and 126 of 166 live staging stacks are unclaimed warm-pool stacks: this explains the ID churn. No supported way to read state.json per stack. Env vars are set by fleet `env_config` campaigns (drain + restart; fleet keys override per-stack). `PAPERCLIP_TELEMETRY_ENDPOINT` lives in the fleet managed-env store. Staging vs production: separate fleets, and `isCloudStagingInstance()` by host. Production admin returned 401 | paperclip-cloud `src/providers/railway.ts:515-521`, `src/fleet/campaigns.ts:5545-5558`, `src/registry/model.ts:1300-1310` |
| Phase 0 B: compliance checklist status | subagent | done. Blocker for ANY production token: Terms §8 says telemetry "does not identify individual users" and Privacy §2 says "anonymized". No subprocessor list, no consent banner (website already runs GA4 + X pixel without consent), no SOC 2 program, DPA status unknown. Workspace delete (`paperclip-cloud` `SleepController.deleteStackInner`) makes no PostHog call; no self-serve account deletion | paperclip-website `web/app/terms/page.tsx:146-165`, `web/app/privacy/page.tsx:59-61` |
| Phase 0 C: PostHog entitlements | coordinator | done: session replay available pay-as-you-go ($0 now); Group analytics add-on NOT enabled (needs Dotta; not blocking: events carry `stack_id`, and the history join uses link events, not group properties); product analytics projected $1,186 this period from 40.1M events, almost all OSS | PostHog billing page, 2026-11-17 |
| Phase 1: server direct sender | subagent | PR green (61 checks, Greptile 5/5); coordinator review asked for private repo `source_ref` to stay hashed on Cloud (customer content, not an ID); rebasing | https://github.com/paperclipai/paperclip/pull/22006 |
| Phase 2: browser analytics | subagent | in progress | |
| Phase 1: server direct sender | subagent | merged 55b692d; live on staging | https://github.com/paperclipai/paperclip/pull/22006 |
| Phase 2: browser analytics | subagent | merged 8172d27; live on staging | https://github.com/paperclipai/paperclip/pull/22012 |
| Phase 2b: visitor IP through the proxy | coordinator | merged fa8bc78 | https://github.com/paperclipai/paperclip/pull/22052 |
| Phase 2c: replay shows text, masks marked content (Dotta's decision) | subagent | merged b56f240; live on staging | https://github.com/paperclipai/paperclip/pull/22057 |
| Phase 2d: `company_id` on background events | subagent | in progress | |
| Phase 3a: workspace-delete cleanup (paperclip-cloud) | coordinator | REVERTED by Dotta's decision (no automatic deletion): https://github.com/paperclipai/paperclip-cloud/pull/1604. It never ran. Original notes: merged b4ddeff; inert until `CLOUD_HARNESS_POSTHOG_PERSONAL_API_KEY_SECRET_REF` is set (scopes group:read, group:write, data_deletion:write; no person scopes). Limits: PostHog has no per-group delete (properties are cleared instead); event deletion uses the alpha Data Deletion API, which PostHog must enable for 483530, needs approval per request, max 5 active; no durable retry (2 in-process retries + audit record) | https://github.com/paperclipai/paperclip-cloud/pull/1603 |
| Phase 3b: legacy link backfill script (telemetry-backend) | subagent | merged 9c9aaae (operator script, not deployed); run after Phase 1 is live on staging | https://github.com/paperclipai/telemetry-backend/pull/148 |
| Phase 4: staging rollout + verification | coordinator | pending | |
| Phase 3b: legacy link backfill script (telemetry-backend) | subagent | merged 9c9aaae, pagination fix a2c123d; staging run: 38 of 44 stacks linked | https://github.com/paperclipai/telemetry-backend/pull/148 |
| Phase 4: staging rollout + verification | coordinator | done 2026-11-18. Staging fleet has the token, `environment=staging`, browser analytics and `TRUST_PROXY=100.64.0.0/10`. 24 h: 5,326 server events from 58 stacks, 0 duplicate uuids; 4,620 browser events, 91% with geo; browser and server events join on one person; replay shows chrome text and masks content | paperclip.staging.paperclip.app |
| Phase 5: production rollout | coordinator | planned, waiting on Dotta's decisions | this doc, Phase 5 |
### Continuous deployment rule
@@ -295,6 +299,82 @@ the collector or directly to PostHog, never both.
retired: remove the Cloud ingest URL setting and the backend's Cloud
ingest path.
### Phase 5: production rollout
Production is a separate fleet (`admin.paperclip.app`). Every switch is an
`env_config` campaign with a canary first. Each step has its own rollback, and
each step is verified before the next one starts.
#### Prerequisites
- [ ] Production runs a release that contains #22006, #22012, #22052 and
#22057 (and the Phase 2d `company_id` PR if merged by then). Check the running app
version of the canary stack before each step.
- [ ] Dotta signs in to `admin.paperclip.app` in the coordinator's browser
pane (the coordinator has no production admin access).
- [x] Decision: consent approach for browser analytics (Step 4). Dotta chose
option 1, the EU/UK consent banner (2026-11-18). Its PR must be merged
and in the production release before Step 4.
- [ ] PostHog: set a billing limit on Session replay before Step 4, so a spike
cannot run up the bill.
- [ ] PostHog: set the project's internal/test account filter to exclude
`environment = staging`.
#### Step 1: server direct sending
- Campaign: `PAPERCLIP_POSTHOG_PROJECT_TOKEN=<phc token>`,
`PAPERCLIP_POSTHOG_ENVIRONMENT=production`. Canary: one internal stack.
- Verify on the canary, then the fleet: `cloud.workspace_started` per stack,
`environment=production`, real IDs, `count() = uniq(uuid)`, no
`deployment_source=cloud` events from production through the collector
after the switch, self-hosted volume unchanged.
- Rollback: campaign with `PAPERCLIP_POSTHOG_DIRECT=0` (back to the collector,
same IDs as before).
#### Step 2: `TRUST_PROXY=100.64.0.0/10`
- Validated on staging: sign-in, board mutations, reads, and visitor IP.
- Production smoke on the canary: sign-in, create and delete a task, open one
connector OAuth flow (redirect URLs now resolve with `https`), invite link.
- Rollback: campaign that removes `TRUST_PROXY`.
#### Step 3: legacy link backfill
- Operator run of `scripts/link-posthog-legacy-workspace-ids.mjs` in
telemetry-backend: a 1-day `query:read` PostHog key (Dotta re-authenticates
in PostHog) and the loader hash secret from AWS. Dry run, then `--write`,
then the verification join. Delete the local secret files and revoke the key.
- Re-run after a week to link stacks that booted later.
#### Step 4: browser analytics and replay
Decided: option 1 (Dotta, 2026-11-18). The options considered:
1. Consent banner for EU/UK visitors (recommended): analytics and replay start
only after the visitor accepts; other regions start as on staging. Needs a
small UI PR (posthog-js `opt_out_capturing_by_default` plus a banner) before
this step.
2. Cookieless until consent for everyone: posthog-js cookieless mode for
anonymous counts, identified analytics and replay only after consent.
Fewer identified sessions.
3. No consent step: turn it on as on staging. Relies on the policy text alone;
legal risk in the EU/UK.
- Campaign: `PAPERCLIP_POSTHOG_BROWSER_ENABLED=1` (replay on by default;
`PAPERCLIP_POSTHOG_REPLAY_ENABLED=0` per stack for customers whose contracts
forbid recording). Canary: one internal stack.
- Verify: Web analytics and Product analytics pages show production visits,
replays mask content, browser and server events join on one person, cold
load time unchanged.
- Rollback: campaign that removes `PAPERCLIP_POSTHOG_BROWSER_ENABLED`.
#### Step 5: watch for one week
- Daily: event volume per environment, duplicates, replay count and spend
against the billing limit, error rate of `/_ph` (429 and 5xx).
- Then retire the `PAPERCLIP_POSTHOG_DIRECT=0` rollback and remove the Cloud
collector ingest path (Phase 4, item 4).
## Success criteria
- [ ] The Web analytics and Product analytics pages for 483530 show Cloud