fix: preserve Canvas analytics identity (#1839)

* fix: unify Canvas PostHog identity

* fix: preserve funnel events across backend transitions

* fix: preserve telemetry consent through cloud login

* fix: isolate Canvas telemetry from host PostHog

* fix: preserve telemetry during client startup

* fix: centralize Canvas telemetry ownership

* fix: make telemetry lifecycle atomic

---------

Co-authored-by: neubig <neubig@users.noreply.github.com>
This commit is contained in:
Graham Neubig
2026-07-19 20:16:20 +01:00
committed by GitHub
co-authored by neubig
parent 1f404b3774
commit 3598bb14e3
66 changed files with 1582 additions and 1312 deletions
+25 -3
View File
@@ -14,17 +14,39 @@ function read(rel: string): string {
}
describe("npm publish workflow", () => {
it("builds the packaged static app with production PostHog configuration", () => {
it("builds both package surfaces with the production PostHog key", () => {
const workflow = read(".github/workflows/npm-publish.yml");
const buildAppStep = workflow.match(
/- name: Build app[\s\S]*?(?=\n\s*- name: Build library)/,
)?.[0];
const buildLibraryStep = workflow.match(
/- name: Build library[\s\S]*?(?=\n\s*- name: Verify package contents)/,
)?.[0];
expect(buildAppStep).toBeTruthy();
expect(buildAppStep).toContain("VITE_APP_ENV: production");
expect(buildAppStep).toContain(
"VITE_POSTHOG_CLIENT_KEY: ${{ vars.POSTHOG_PROD_KEY }}",
"VITE_POSTHOG_API_KEY: ${{ vars.POSTHOG_PROD_KEY }}",
);
expect(buildAppStep).toContain("npm run build");
expect(buildLibraryStep).toContain(
"VITE_POSTHOG_API_KEY: ${{ vars.POSTHOG_PROD_KEY }}",
);
expect(buildLibraryStep).toContain("npm run build:lib");
});
it("passes the selected PostHog key through Docker's supported build arg", () => {
const workflow = read(".github/workflows/docker.yml");
const dockerfile = read("docker/Dockerfile");
expect(workflow).toContain(
"VITE_POSTHOG_API_KEY=${{ steps.prep.outputs.posthog_api_key }}",
);
expect(workflow).not.toContain("VITE_POSTHOG_CLIENT_KEY");
expect(workflow).not.toContain("vite_app_env");
expect(dockerfile).toContain('ARG VITE_POSTHOG_API_KEY=""');
expect(dockerfile).toContain(
"ENV VITE_POSTHOG_API_KEY=${VITE_POSTHOG_API_KEY}",
);
expect(dockerfile).not.toContain("VITE_APP_ENV");
});
});