: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(desktop): fetch the old Forge build from the archived repo in the update e2e (#96681)
Julian Bezded9a059a2d2
diff --git a/.github/workflows/desktop-update-e2e.yml b/.github/workflows/desktop-update-e2e.ymlindex 653b422ec176..6cebb0ea019b 100644--- a/.github/workflows/desktop-update-e2e.yml+++ b/.github/workflows/desktop-update-e2e.yml@@ -29,6 +29,7 @@ env:# npm's audit blocks the pnpm bootstrap. See .github/actions/pnpm-install for why.NPM_CONFIG_AUDIT: 'false'NPM_CONFIG_FUND: 'false'+ SLACK_CHANNEL: 'C0AS64N6DJL' # #alerts-devexjobs:update-e2e-macos:@@ -320,3 +321,34 @@ jobs:compression-level: 0if-no-files-found: warnretention-days: 7++ # This runs nightly, so nobody sees a red run unless it pages.+ # A manual dispatch is somebody debugging, and they watch the run.+ - name: Notify Slack on update e2e failure+ if: failure() && github.event_name == 'schedule'+ uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1+ with:+ method: chat.postMessage+ token: ${{ secrets.SLACK_DEVEX_BOT_TOKEN }}+ errors: true+ payload: |+ channel: "${{ env.SLACK_CHANNEL }}"+ text: ":red_circle: Desktop update e2e failed. An auto-update path may be broken for users"+ blocks:+ - type: "section"+ text:+ type: "mrkdwn"+ text: ":red_circle: *Desktop update e2e failed*. The nightly macOS proof that a shipped app updates itself did not pass, so an update path may be broken for users on the current release."+ - type: "section"+ fields:+ - type: "mrkdwn"+ text: "*Trigger*\n${{ github.event_name }}"+ - type: "mrkdwn"+ text: "*Next step*\nCheck which leg failed and its proof summary"+ - type: "actions"+ elements:+ - type: "button"+ text:+ type: "plain_text"+ text: "View run"+ url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"diff --git a/products/desktop/apps/code/scripts/dev-update/build-old-forge.sh b/products/desktop/apps/code/scripts/dev-update/build-old-forge.shindex ca92980fb211..99de68529302 100755--- a/products/desktop/apps/code/scripts/dev-update/build-old-forge.sh+++ b/products/desktop/apps/code/scripts/dev-update/build-old-forge.sh@@ -26,7 +26,8 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"APP_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)" # apps/codeREPO_ROOT="$(cd "$APP_DIR/../.." && pwd)"-OLD_REF="${OLD_FORGE_REF:-cb0ca68db}" # v0.55.132, last Forge release+OLD_REF="${OLD_FORGE_REF:-cb0ca68dbeb49cc979dbcc887e007b9d1916a32a}" # v0.55.132, last Forge release+OLD_FORGE_REMOTE="${OLD_FORGE_REMOTE:-https://github.com/PostHog/code.git}"OLD_VERSION="${OLD_VERSION:-1.0.0}"WORKTREE="${OLD_FORGE_WORKTREE:-$REPO_ROOT/.old-forge-worktree}"OUT_APP_DIR="$APP_DIR/out/old-forge"@@ -47,6 +48,18 @@ log "old Forge ref: $OLD_REF (version $OLD_VERSION)"# 1. Isolated worktree at the pinned tag. Separate node_modules + build output,# so the current branch checkout is untouched.cleanup_worktree+# The last Forge release predates the monorepo import, so its commit lives only in+# the archived standalone repository. GitHub serves a fetch by full commit SHA, so+# pull the one object in instead of cloning the archive.+if ! git -C "$REPO_ROOT" cat-file -e "${OLD_REF}^{commit}" 2>/dev/null; then+ log "fetching $OLD_REF from $OLD_FORGE_REMOTE"+ for attempt in 1 2 3; do+ git -C "$REPO_ROOT" fetch --no-tags "$OLD_FORGE_REMOTE" "$OLD_REF" && break+ [ "$attempt" -lt 3 ] || { echo "FAIL: could not fetch $OLD_REF from $OLD_FORGE_REMOTE after $attempt attempts"; exit 1; }+ log "fetch attempt $attempt failed, retrying"+ sleep $((attempt * 10))+ done+figit -C "$REPO_ROOT" worktree add --force --detach "$WORKTREE" "$OLD_REF"trap cleanup_worktree EXITdiff --git a/products/desktop/docs/AUTO-UPDATE-TESTING.md b/products/desktop/docs/AUTO-UPDATE-TESTING.mdindex 295dc86801b4..897fdb7b067b 100644--- a/products/desktop/docs/AUTO-UPDATE-TESTING.md+++ b/products/desktop/docs/AUTO-UPDATE-TESTING.md@@ -119,7 +119,7 @@ A real Forge build picks up an electron-builder build through its own updater, e### How the old build is produced-`build-old-forge.sh` checks the last Forge release out into an isolated git worktree and builds it there, so the current branch checkout is untouched. The pinned commit is `cb0ca68db` (`v0.55.132`), the last release before the electron-builder migration. Override with `OLD_FORGE_REF` if needed.+`build-old-forge.sh` checks the last Forge release out into an isolated git worktree and builds it there, so the current branch checkout is untouched. The pinned commit is `cb0ca68db` (`v0.55.132`), the last release before the electron-builder migration. That commit predates the monorepo import, so the script fetches it from the archived `PostHog/code` repository when it is not already in the local object store. Override the commit with `OLD_FORGE_REF` and the source repository with `OLD_FORGE_REMOTE` if needed.It is a genuine `electron-forge package` build, not a rebuild with electron-builder, because the whole point is the built-in Squirrel.Mac client that shipped to users. It is signed with the same identity the new build uses (Forge resolves the identity by name from a keychain, so the script imports `CSC_LINK` into a temp keychain and derives `APPLE_CODESIGN_IDENTITY`). Both Forge and electron-builder use bundle id `com.posthog.array`, so the designated requirements match and the swap is allowed.@@ -165,6 +165,8 @@ gh workflow run "Desktop Update E2E (macOS)"It builds the `2.0.0` feed and the baseline `1.0.0` app, runs the baseline spec via `playwright.update.config.ts`, then builds the old Forge `1.0.0` app and runs the Forge spec via `playwright.update-forge.config.ts`. Each leg asserts exactly one test actually ran, so a missing feed or a silent skip fails the job. The Forge leg runs after the baseline so a flake in the (riskier) old-build step can never mask the baseline result.+A failing run posts to `#alerts-devex` in Slack, because nobody watches a nightly.+Every run renders a proof summary per leg on the run page and uploads, on pass or fail: both proof manifests, main log and Squirrel ShipIt cache (artifact `update-e2e-macos`), plus the signed builds as their own artifacts (`update-old-build-1.0.0`, `update-new-build-2.0.0`, `update-old-forge-build-1.0.0`) you can pull as shown above.## Cleanup