: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(hogli): skip manifest auto-update in ci (#118589)
Georges-Antoine Assi4b00e24be7cf
diff --git a/tools/hogli/src/hogli/cli.py b/tools/hogli/src/hogli/cli.pyindex 3a2bf8ee1487..2be8fc2d2569 100644--- a/tools/hogli/src/hogli/cli.py+++ b/tools/hogli/src/hogli/cli.py@@ -202,7 +202,8 @@ def cli(ctx: click.Context) -> None:# Skip during git hooks to prevent manifest modifications during lint-staged executionin_git_hook = os.environ.get("GIT_DIR") is not None or os.environ.get("HUSKY") is not Noneif ctx.invoked_subcommand not in {"meta:check", "help"} and not in_git_hook:- _auto_update_manifest()+ if not telemetry.is_ci():+ _auto_update_manifest()# telemetry:on still shows the notice (it arms tracking by setting# first_run_notice_shown); only off/status suppress it.if ctx.invoked_subcommand not in {"telemetry:off", "telemetry:status"}:diff --git a/tools/hogli/tests/test_cli.py b/tools/hogli/tests/test_cli.pyindex 92b8695bd16f..5c30dad466e3 100644--- a/tools/hogli/tests/test_cli.py+++ b/tools/hogli/tests/test_cli.py@@ -84,6 +84,23 @@ class TestMetaCheckCommand:# Should either pass or report missing entries clearlyassert "bin script" in result.output.lower() or "✓" in result.output+ @pytest.mark.parametrize("ci_env, expect_update", [({"CI": "true"}, False), ({}, True)])+ def test_manifest_auto_update_skipped_in_ci(+ self, monkeypatch: pytest.MonkeyPatch, ci_env: dict[str, str], expect_update: bool+ ) -> None:+ for var in ("CI", "GITHUB_ACTIONS", "JENKINS_URL", "GITLAB_CI", "CIRCLECI", "BUILDKITE"):+ monkeypatch.delenv(var, raising=False)+ for key, value in ci_env.items():+ monkeypatch.setenv(key, value)+ monkeypatch.delenv("GIT_DIR", raising=False)+ monkeypatch.delenv("HUSKY", raising=False)++ with patch("hogli.cli.auto_update_manifest", return_value=set()) as auto_update:+ result = runner.invoke(cli, ["quickstart"])++ assert result.exit_code == 0+ assert auto_update.called is expect_update+class TestMetaConceptsCommand:"""Test meta:concepts command."""