Skip to content

fix(tasks): use autocomplete for creator in loop admin - #73067

Merged
charlesvien merged 1 commit into
masterfrom
fix/loop-admin-creator-autocomplete
Jul 23, 2026
Merged

fix(tasks): use autocomplete for creator in loop admin#73067
charlesvien merged 1 commit into
masterfrom
fix/loop-admin-creator-autocomplete

Conversation

@charlesvien

Copy link
Copy Markdown
Member

Problem

Opening a Loop's change page in Django admin never finishes loading.
LoopAdmin configures widgets for team, created_by and sandbox_environment, but the creator FK (added alongside the admin in #70604) was never listed in autocomplete_fields, raw_id_fields or readonly_fields.
Django falls back to a plain <select> for it, which queries every row of posthog_user and renders each one as an <option>, so the page hangs on any install with a real user table.

Changes

Adds creator to autocomplete_fields on LoopAdmin, matching how created_by (same target model) is already handled.
Kept it editable rather than readonly so an admin can repair a creator nulled out by SET_NULL after a user deletion.

How did you test this code?

I (or, actually Claude) verified UserAdmin defines the search_fields that autocomplete requires and ran manage.py check --tag admin, which passes with no issues.
No manual load of a production admin page was done.
No test added: a one-line admin widget config isn't a realistic regression target beyond Django's own system checks.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Docs update

N/A, internal admin only.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Diagnosed and authored with Claude Code.
Starting from a report that the Loop admin page loads forever, Claude enumerated the FKs on Loop, found creator was the only one without a widget config and confirmed via git history that it shipped in the same PR as LoopAdmin.
Considered making creator readonly since the model treats it as immutable, but chose autocomplete so support can still fix a nulled creator.
No skills were invoked.

@charlesvien charlesvien self-assigned this Jul 23, 2026
@trunk-io

trunk-io Bot commented Jul 23, 2026

Copy link
Copy Markdown

😎 This pull request was merged.

@charlesvien
charlesvien marked this pull request as ready for review July 23, 2026 05:18
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team July 23, 2026 05:19
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "add creator autocomplete to loop admin" | Re-trigger Greptile

@charlesvien charlesvien added the stamphog Request AI approval (no full review) label Jul 23, 2026

@stamphog stamphog 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.

Trivial one-line Django admin autocomplete fix by an owning-team author with strong familiarity; no risky territory, no outstanding concerns.

  • Author wrote 100% of the modified lines and has 11 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 2L, 1F substantive — within ceiling
tier T1-agent / T1a-trivial (2L, 1F, single-area, fix)
stamphog 2.0.0b3 .stamphog/policy.yml @ 54df693 · reviewed head 6c5f33e

@charlesvien
charlesvien enabled auto-merge (squash) July 23, 2026 05:29
@charlesvien
charlesvien merged commit 6488973 into master Jul 23, 2026
387 of 444 checks passed
@charlesvien
charlesvien deleted the fix/loop-admin-creator-autocomplete branch July 23, 2026 05:50
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-23 06:13 UTC Run
prod-us ✅ Deployed 2026-07-23 06:28 UTC Run
prod-eu ✅ Deployed 2026-07-23 06:30 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant