Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

perf(ci): skip static precompression in hogbox previews (#89538)

Raúl Negrón-Oterob0f7ec625e75
diff --git a/tools/hogbox-preview/hogbox_preview/stack.py b/tools/hogbox-preview/hogbox_preview/stack.py
index 11083acd0618..13be48dd2e30 100644
--- a/tools/hogbox-preview/hogbox_preview/stack.py
+++ b/tools/hogbox-preview/hogbox_preview/stack.py
@@ -598,10 +598,8 @@ class PostHogPreviewStack:
# so settings import is fine; collectstatic itself needs no live DB.
import pathlib
- # Upload and collectstatic are separately timed: together they're ~260s,
- # a third of the whole wait, and they were one opaque block — the dist
- # is chunked over the exec API, so "slow upload" and "slow collectstatic"
- # need very different fixes.
+ # Time upload and collectstatic separately because the exec transfer and
+ # static processing require different fixes.
with timing.span("frontend-dist-upload"):
tar = pathlib.Path(self.frontend_dist_tar).read_bytes()
self.backend.write_file(f"{self.repo_dir}/frontend/dist.tgz", tar)
@@ -613,7 +611,8 @@ class PostHogPreviewStack:
f"cd {self.repo_dir} && "
"rm -rf frontend/dist && mkdir -p frontend/dist staticfiles && "
"tar xzf frontend/dist.tgz -C frontend/dist --strip-components=1 && "
- f"{compose} run --rm -T -e STATIC_COLLECTION=1 -e SKIP_SERVICE_VERSION_REQUIREMENTS=1 "
+ f"{compose} run --rm -T "
+ "-e STATIC_COLLECTION=1 -e STATIC_PRECOMPRESS=0 -e SKIP_SERVICE_VERSION_REQUIREMENTS=1 "
"web python manage.py collectstatic --noinput"
)
self.backend.run_long(script, name="frontend", timeout=900)
diff --git a/tools/hogbox-preview/tests/test_swap_frontend.py b/tools/hogbox-preview/tests/test_swap_frontend.py
index d350de032204..80bd26181a15 100644
--- a/tools/hogbox-preview/tests/test_swap_frontend.py
+++ b/tools/hogbox-preview/tests/test_swap_frontend.py
@@ -42,7 +42,7 @@ class _RecordingBackend:
def __init__(self):
self.files: dict[str, bytes | str] = {}
- self.long_runs: list[str] = []
+ self.long_runs: dict[str, str] = {}
self.attached = False
self.health_waited = False
@@ -60,7 +60,7 @@ class _RecordingBackend:
self.files[remote_path] = content
def run_long(self, script, *, name, timeout: int = 1800, interval: int = 3) -> ExecResult:
- self.long_runs.append(name)
+ self.long_runs[name] = script
return ExecResult(0, "", "")
def wait_http_ok(self, url_path, *, expect=200, timeout=600, interval=3) -> None:
@@ -103,7 +103,8 @@ class SwapFrontendOnlyTest(unittest.TestCase):
self.assertIn(f"SECRET_KEY={_EXISTING_KEY}", override)
# Ran the swap (collectstatic) then recreated web, then waited for health.
- self.assertEqual(backend.long_runs, ["frontend", "up-web"])
+ self.assertEqual(list(backend.long_runs), ["frontend", "up-web"])
+ self.assertIn("STATIC_PRECOMPRESS=0", backend.long_runs["frontend"])
self.assertTrue(backend.health_waited)
self.assertEqual(url, backend.web_url)