feat(flags): add staff toggle for minimal_flag_called_events - #69492
Conversation
🤖 CI report
|
| File | Size | Δ vs base |
|---|---|---|
posthog-app/_parent/products/feature_flags/frontend/staff/FeatureFlagsStaffToolsScene.js |
12.1 KiB | 🔺 +1.6 KiB (+14.7%) |
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.21 MiB · 22 files | no change | ███░░░░░░░ 28.1% of 4.29 MiB |
authenticated shell (every logged-in page)src/scenes/AuthenticatedShell.tsx |
8.11 MiB · 2,973 files | 🔺 +790 B (+0.0%) | █████████░ 87.6% 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 |
| 668 B | src/index.tsx |
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
| Size | File |
|---|---|
| 278.6 KiB | ../node_modules/.pnpm/posthog-js@1.399.2/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 |
| 234.9 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 221.5 KiB | ../node_modules/.pnpm/posthog-js@1.399.2/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.9 KiB | src/lib/api.ts |
| 93.3 KiB | ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js |
| 90.6 KiB | ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/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 — 🔺 +17.6 KiB (+0.0%)
Total size of the built frontend/dist folder (all assets), compared against the base branch.
Total: 1278.76 MiB · 🔺 +17.6 KiB (+0.0%)
ℹ️ MCP UI apps size — 31 app(s), 16373.5 KB JS
Built size of each MCP UI app (main.js + styles.css).
| App | JS | CSS |
|---|---|---|
| debug | 598.2 KB | 179.2 KB |
| action | 456.5 KB | 179.2 KB |
| action-list | 563.0 KB | 179.2 KB |
| cohort | 455.4 KB | 179.2 KB |
| cohort-list | 562.0 KB | 179.2 KB |
| email-template | 455.3 KB | 179.2 KB |
| error-details | 471.1 KB | 179.2 KB |
| error-issue | 456.1 KB | 179.2 KB |
| error-issue-list | 562.9 KB | 179.2 KB |
| experiment | 560.1 KB | 179.2 KB |
| experiment-list | 563.8 KB | 179.2 KB |
| experiment-results | 561.8 KB | 179.2 KB |
| feature-flag | 565.8 KB | 179.2 KB |
| feature-flag-list | 569.5 KB | 179.2 KB |
| feature-flag-testing | 459.4 KB | 179.2 KB |
| insight-actors | 560.8 KB | 179.2 KB |
| invite-email-preview | 454.7 KB | 179.2 KB |
| llm-costs | 558.1 KB | 179.2 KB |
| session-recording | 457.2 KB | 179.2 KB |
| session-summary | 462.5 KB | 179.2 KB |
| survey | 457.0 KB | 179.2 KB |
| survey-global-stats | 560.9 KB | 179.2 KB |
| survey-list | 563.7 KB | 179.2 KB |
| survey-stats | 560.8 KB | 179.2 KB |
| trace-span | 455.8 KB | 179.2 KB |
| trace-span-list | 562.9 KB | 179.2 KB |
| workflow | 455.8 KB | 179.2 KB |
| workflow-list | 562.4 KB | 179.2 KB |
| query-results | 743.7 KB | 179.2 KB |
| render-ui | 636.0 KB | 179.2 KB |
| visual-review-snapshots | 460.3 KB | 179.2 KB |
6deab7a to
c00ec8d
Compare
🦔 Hogbox preview · ✅ ready▶ Open the preview
commit |
|
Reviews (1): Last reviewed commit: "chore: update OpenAPI generated types" | Re-trigger Greptile |
There was a problem hiding this comment.
Staff-only, IsStaffUser-gated endpoint that follows the existing staff_cache.py/staff_teams.py pattern, with audit logging, tests, and no schema migration (field already existed); author has strong familiarity and is on the owning team. The one unresolved bot finding (a same-team double-toggle race in the listener) is real at the code level but not reachable through the UI since the switch is disabled via disabledReason while a mutation is pending, so it isn't a practical showstopper for this low-traffic internal tool.
- Author wrote 100% of the modified lines and has 25 merged PRs in these paths (familiarity STRONG).
- greptile-apps[bot] reviewed the current head.
- Greptile flagged that rapid opposite toggles for the same team while a request is in flight could drop the second intent — mitigated in practice by the switch's disabledReason/loading state blocking further clicks during the pending window, but worth a follow-up hardening pass if this tool sees heavier use.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 328L, 9F substantive, 665L/15F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (665L, 15F, two-areas, feat) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ fc9ea12 · reviewed head c00ec8d |
New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
Staff-only toggle for an existing internal flag, gated by the established IsStaffUser permission (matches the existing staff_cache.py pattern), with solid test coverage and all review comments resolved; author is on the owning team with strong recent familiarity and a teammate already approved the current head.
- Author wrote 100% of the modified lines and has 25 merged PRs in these paths (familiarity STRONG).
- 👍 on the PR from greptile-apps[bot], hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 332L, 9F substantive, 669L/15F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (669L, 15F, two-areas, feat) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ 354525e · reviewed head 06b7143 |
posthog.tasks.team_metadata sits under posthog.tasks, whose __init__ is a celery autoimport aggregator that pulls in every task module. Importing it at module level in the new staff team-config viewset meant its 4 signal receivers only wired up when the API router was built, so a process that never builds the router (celery, temporal, migrate, shell) would lose them. Defer the import to call time instead.
06b7143 to
cd5e924
Compare
Problem
There was no way to flip
TeamFeatureFlagsConfig.minimal_flag_called_eventsfor a specific team without a raw ORM write. The model has no serializer, viewset, or admin registration, so staff had no path to enable the slim$feature_flag_calledevent shape for a team once its SDKs support it, short of a one-off database update.Changes
FeatureFlagsStaffTeamConfigViewSet) for batch-reading and single-team writing ofminimal_flag_called_events, following the same pattern as the existing cache tools (staff_cache.py/staff_teams.py): unscoped ViewSet,IsStaffUsergated, structured audit logging./flagsand/decideread this value out of Redis, not the database.How did you test this code?
test_staff_team_config_api.pycovering permission gating, batch read behavior (dedup, unknown ids, the id cap), the write path (DB update plus cache refresh enqueue), and the not-found and missing-row cases.featureFlagsStaffToolsLogic.test.tswith cases for the batch load, a successful toggle, the failure toast path, and the double-submit guard./feature_flags/staff, searched for a team, toggled the switch on and off, and confirmed the DB value updated, the metadata cache refresh task fired (checked via logs), and the switch reflected the persisted value after a page reload.hogli ci:preflightbefore pushing.Automatic notifications
Docs update
No existing docs reference this page or model, so nothing to update.