Skip to content

fix(owners): stop a stale posthog_owners copy from breaking images - #5

Draft
evanmarshall wants to merge 1 commit into
masterfrom
ito/upstream-pr-93572-993391bb
Draft

evanmarshall wants to merge 1 commit into
masterfrom
ito/upstream-pr-93572-993391bb

Conversation

@evanmarshall

Copy link
Copy Markdown

This is an Ito QA mirror of PostHog#93572.

Original author: @PostHog[bot]
Pinned upstream head: 993391b

This draft is for QA and build-environment experimentation and will not be merged.


Problem

  • An engineer whose image holds an older posthog_owners copy than their checkout loses every request and management command in that container, not only the feature that added a symbol.
  • posthog/urls.py imports the chain unconditionally (urls, rest_router, load_product_modules, product routes, the owners resolver), so one missing export fails Django system checks and nothing starts.
  • The cause is packaging, not any single import. Both image builds install the package with uv sync --no-editable, which builds a wheel and stores it in the persistent uv cache mount.
  • tools/owners/pyproject.toml keeps one static version, 0.1.0. uv keys the cached wheel on that version, so a later build reuses the first wheel it ever built.
  • This recurs every time the package grows a public symbol. Two symbols tripped it within five minutes on 2 September.

Changes

  • A new export in posthog_owners now reaches the image on the next build, so the container starts instead of failing every entrypoint.
  • Both builds pass --reinstall-package posthog-owners, which implies --refresh-package. uv rebuilds the wheel from the bind mount every build.
-uv sync --locked --no-dev --no-editable --no-install-project --no-binary-package lxml ...
+uv sync --locked --no-dev --no-editable --no-install-project --reinstall-package posthog-owners --no-binary-package lxml ...
  • A version bump also clears the stale wheel, and the linked report recommends it. This PR forces the reinstall instead, because a bump depends on every future author remembering it, and the failure is silent until a container starts.
  • Only posthog-owners needs it. hogli is the other workspace member installed from a bind mount, but it sits in the dev group and both builds pass --no-dev.
  • The rest is a comment on each uv sync line.

Note

Rebuilding one small pure-Python wheel per build. Every other package still reads from the cache.

How did you test this code?

No new automated tests: the change is two build flags, and no suite covers Dockerfile content.

Neither image was built. Building a full PostHog image is out of reach in this sandbox, so the cache behavior was reproduced in a minimal uv workspace instead, matching the real setup (a local path member, one static version, --no-editable, a shared cache directory).

Reproduction results
Step Symbol added to the source Installed copy
First sync - present
Re-sync, version unchanged yes missing (stale)
Re-sync with --reinstall-package yes present
New venv, warm cache, version unchanged yes missing (stale)
New venv, warm cache, --reinstall-package yes present
New venv, warm cache, version bumped yes present

The fourth row is the image case: a build starts from an empty venv, and the cache mount alone is enough to serve a stale copy.

The real uv sync line was also run against this repository's lockfile with --dry-run, and it resolves.

Automatic notifications

  • Publish to changelog?

Docs update

None. The change is internal to the image builds.

🤖 Agent context

Autonomy: Fully autonomous

Written by Claude Code (Opus) from a PostHog self-driving inbox report. Skills invoked: /writing-pr-descriptions, /writing-simplified-technical-english.

The report named the version pin as the cause and a version bump as the fix. The pin is a real cause, and the reproduction above confirms it. The bump was rejected as the fix because it holds only while every future author remembers it. Forcing the reinstall removes the class of failure.

A build-time assertion comparing the baked copy against the checkout was also considered and dropped. It turns a silent runtime failure into a build failure, but the reinstall makes the mismatch impossible, so the assertion would only add a way to hard-block CI with no path forward except busting a cache.

Nothing in this diff or description carries material from the agent session. The two symbol names are in this repository's git history, and the reproduction workspace is invented.


Created with PostHog Desktop from this inbox report.

posthog-owners installs with `uv sync --no-editable`, which builds a wheel and
caches it in the persistent uv cache mount. The package keeps one static
version, so a later build reuses that first wheel even into a new venv. Any new
export is then missing from the baked copy, and `posthog/urls.py` imports the
chain unconditionally, so Django system checks fail and nothing in the image
starts.

Add `--reinstall-package posthog-owners` to both image builds. uv rebuilds the
wheel from the bind mount every build, so the baked copy always matches the
checkout without anyone remembering to bump a version.

Generated-By: PostHog Desktop
Task-Id: cc020ff8-2a32-48f3-adfb-66b6dd4e8d72
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.

1 participant