Skip to content

feat(error-tracking): read and write autocapture opt-in from settings (phase 2) - #70970

Closed
ablaszkiewicz wants to merge 2 commits into
masterfrom
feat/et-autocapture-opt-in-reads
Closed

feat(error-tracking): read and write autocapture opt-in from settings (phase 2)#70970
ablaszkiewicz wants to merge 2 commits into
masterfrom
feat/et-autocapture-opt-in-reads

Conversation

@ablaszkiewicz

@ablaszkiewicz ablaszkiewicz commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

move reads to the new table. Do dual writes

Ran backfills both in EU and US today and there's no drift

@ablaszkiewicz ablaszkiewicz self-assigned this Jul 15, 2026
@trunk-io

trunk-io Bot commented Jul 15, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@ablaszkiewicz
ablaszkiewicz marked this pull request as ready for review July 16, 2026 15:14
Copilot AI review requested due to automatic review settings July 16, 2026 15:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested review from a team, cat-ph and hpouillot July 16, 2026 15:15
@pr-assigner-resolver-posthog

Copy link
Copy Markdown

👀 Auto-assigned reviewers

These soft owners were skipped because they only have minor changes here. Nothing blocks merge, so self-assign if you'd like a look:

  • @PostHog/team-analytics-platform (products/dashboards/product.yaml)
  • @PostHog/team-posthog-code (products/tasks/product.yaml)

Soft owners come from each directory's owners.yaml and each product's product.yaml (resolved nearest-file-wins). The locator after each owner is the file that decided it. Generated files and lockfiles are ignored when deciding ownership.

@greptile-apps

greptile-apps Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "chore(error-tracking): drop redundant au..." | Re-trigger Greptile

@ablaszkiewicz
ablaszkiewicz enabled auto-merge (squash) July 16, 2026 15:18
Comment thread products/error_tracking/backend/models.py
Comment thread products/error_tracking/backend/models.py

@cat-ph cat-ph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

@ablaszkiewicz
ablaszkiewicz disabled auto-merge July 16, 2026 15:18
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Bundle size — 🔺 +7.3 KiB (+0.0%)

Uncompressed size of every built .js bundle, compared against the base branch.

Total: 64.23 MiB · 🔺 +7.3 KiB (+0.0%)

File Size Δ vs base
render-query/src/render-query/render-query.js 21.33 MiB 🔺 +2.8 KiB (+0.0%)
exporter/src/lib/components/ActivityLog/describers.js 129.4 KiB 🔺 +1.2 KiB (+0.9%)
posthog-app/src/lib/components/ActivityLog/describers.js 132.2 KiB 🔺 +1.2 KiB (+0.9%)

Posted automatically by build-bundle-size-report · uncompressed bytes from dist-report

Eager graph — within budget

How much code each root ships on the eager path — downloaded and parsed before the surface is interactive. Measured from the esbuild output chunks (post-tree-shake, static imports only); lazy import() / React.lazy chunks are not counted.

Root Eager (shipped) Δ vs base Budget
entry (logged-out pages, app bootstrap)
src/index.tsx
1.23 MiB · 22 files no change ███░░░░░░░ 28.6% of 4.29 MiB
authenticated shell (every logged-in page)
src/scenes/AuthenticatedShell.tsx
8.16 MiB · 2,988 files 🔺 +50 B (+0.0%) █████████░ 88.2% of 9.25 MiB

🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx

Largest files eagerly shipped from src/index.tsx
Size File
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
24.6 KiB ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
6.3 KiB ../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
4.5 KiB ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js
3.9 KiB ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js
1.4 KiB ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1.3 KiB src/RootErrorBoundary.tsx
912 B ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
789 B src/scenes/ChunkLoadErrorBoundary.tsx
762 B src/index.tsx
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
Size File
281.3 KiB ../node_modules/.pnpm/posthog-js@1.404.0/node_modules/posthog-js/dist/rrweb.js
267.7 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
235.5 KiB src/taxonomy/core-filter-definitions-by-group.json
223.2 KiB ../node_modules/.pnpm/posthog-js@1.404.0/node_modules/posthog-js/dist/module.js
164.0 KiB src/queries/validators.js
154.3 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
105.8 KiB src/lib/api.ts
93.3 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
93.2 KiB ../packages/quill/packages/quill/dist/index.js

Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479

Dist folder size — 🔺 +175.0 KiB (+0.0%)

Total size of the built frontend/dist folder (all assets), compared against the base branch.

Total: 1341.79 MiB · 🔺 +175.0 KiB (+0.0%)

ℹ️ MCP UI apps size — 31 app(s), 16602.7 KB JS

Built size of each MCP UI app (main.js + styles.css).

App JS CSS
debug 599.5 KB 187.4 KB
action 457.8 KB 187.4 KB
action-list 564.3 KB 187.4 KB
cohort 456.8 KB 187.4 KB
cohort-list 563.3 KB 187.4 KB
email-template 456.6 KB 187.4 KB
error-details 472.4 KB 187.4 KB
error-issue 457.5 KB 187.4 KB
error-issue-list 564.2 KB 187.4 KB
experiment 561.5 KB 187.4 KB
experiment-list 565.1 KB 187.4 KB
experiment-results 563.2 KB 187.4 KB
feature-flag 567.1 KB 187.4 KB
feature-flag-list 570.9 KB 187.4 KB
feature-flag-testing 461.0 KB 187.4 KB
insight-actors 562.1 KB 187.4 KB
invite-email-preview 456.0 KB 187.4 KB
llm-costs 559.5 KB 187.4 KB
session-recording 458.6 KB 187.4 KB
session-summary 463.9 KB 187.4 KB
survey 458.4 KB 187.4 KB
survey-global-stats 562.2 KB 187.4 KB
survey-list 565.0 KB 187.4 KB
survey-stats 562.2 KB 187.4 KB
trace-span 457.2 KB 187.4 KB
trace-span-list 564.2 KB 187.4 KB
workflow 457.1 KB 187.4 KB
workflow-list 563.7 KB 187.4 KB
query-results 744.8 KB 187.4 KB
render-ui 825.3 KB 187.4 KB
visual-review-snapshots 461.6 KB 187.4 KB
Playwright — all passed

All tests passed.

View test results →

ClickHouse migration SQL — none

No ClickHouse migrations in the latest push.

@github-actions
github-actions Bot requested a deployment to preview-pr-70970 July 17, 2026 11:13 In progress
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

🦔 Hogbox preview · ✅ ready

▶ Open the preview

🔑 Login test@posthog.com / 12345678 (demo data)
🧩 Running this PR's backend and frontend, on the PostHog :master base
🔗 Link stable across rebuilds — a re-push swaps the box underneath, the URL stays
🔒 Access tailnet only (PostHog VPN)
🛠️ Admin inspect & debug state in hogland
💤 Idle sleeps after ~30 min idle (snapshot to S3, zero node cost) and wakes on your next visit in ~30s, behind a brief "waking up" screen

commit 125eeb4 · box box-5a4fe19723a4 · ready in 813s (push → usable) · build log · rebuilds on every push, torn down on close

Comment thread products/error_tracking/backend/presentation/views/settings.py
@veria-ai

veria-ai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

PR overview

This pull request adds support for reading and writing the exception autocapture opt-in setting through the error tracking settings endpoint. It updates the settings presentation layer so the autocapture preference can be managed alongside other error tracking settings.

One authorization issue remains open: the new write path allows users with error-tracking write/editor access to enable exception autocapture, whereas the prior control required project admin privileges. This could let a non-admin project member change deployed SDK telemetry behavior and cause exception data to be collected without the intended administrative approval. No issues have been fixed yet, so the PR still needs an access-control adjustment before it is in a safer state.

Open issues (1)

Fixed/addressed: 0 · PR risk: 6/10

@ablaszkiewicz ablaszkiewicz changed the title feat(error-tracking): read autocapture opt-in from settings (phase 2) feat(error-tracking): read and write autocapture opt-in from settings (phase 2) Jul 17, 2026
@ablaszkiewicz

ablaszkiewicz commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@PostHog/team-error-tracking I increased scope of this PR to also include writes. This is safe as we have double writes on both sides (if you update it via team, it propagates to ET settings and vice versa but without infinite loop lol) so this will be safe as pods start rolling out

@posthog

posthog Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

👋 Visual changes detected for this PR.

Review and approve in PostHog Visual Review

If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix.

Comment thread products/error_tracking/backend/logic/__init__.py
Comment thread products/error_tracking/backend/presentation/views/settings.py
@ablaszkiewicz
ablaszkiewicz force-pushed the feat/et-autocapture-opt-in-reads branch from e7730d4 to 92f550c Compare July 18, 2026 11:05
@github-actions
github-actions Bot requested a deployment to preview-pr-70970 July 18, 2026 11:05 In progress
Move autocapture exceptions opt-in reads to ErrorTrackingSettings with
dual writes back to Team, drop the team fallback, and update generated
API types and describers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread products/error_tracking/backend/presentation/views/settings.py
Comment thread products/error_tracking/backend/logic/__init__.py Outdated
@hex-security-app

Copy link
Copy Markdown

You're right — I conflated the model's field_access_control(..., "project", "admin") annotation with an unconditional serializer gate. The existing Team path explicitly lists autocapture_exceptions_opt_in in TEAM_CONFIG_MEMBER_FIELDS, and its authorization tests confirm an ordinary member can update it when access controls are not enabled. When access controls are enabled, moving this setting under error_tracking:write is the intended resource-level authorization. My finding does not hold; thank you for the correction.

@ablaszkiewicz
ablaszkiewicz marked this pull request as draft July 18, 2026 11:14
… rebuild

Mirror autocapture opt-in onto the deprecated Team column via a queryset
update() instead of Team.save(). Saving Team fired its post_save mirror back
into ErrorTrackingSettings, doubling the write and dispatching a second
remote config rebuild. The settings row is the source of truth and already
triggers the rebuild, matching the rebuild-hangs-off-this-model comment.

Also narrow log.detail before indexing in the activity test to satisfy mypy.

Generated-By: PostHog Code
Task-Id: a8d3ae8f-8131-4930-810f-7e773786ed84

Copy link
Copy Markdown
Contributor Author

Heads-up on CI: the Jest test (EE - 1) shard failed once on products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.test.tsx with Exceeded timeout of 5000 ms for a test (plus a "worker failed to exit gracefully" warning). It's an unrelated rendering test that only got pulled into this PR's run because the diff touches frontend/src/types.ts, and this branch's latest commit is Python-only. Re-ran the shard and it passed, so it's a flaky timeout rather than a regression from this change.

🦉 via talyn.dev

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.

4 participants