Skip to content

ci: give the api-surface build the tb-addon backend URLs - #140

Merged
rubenhensen merged 2 commits into
mainfrom
fix/api-surface-build-env
Jul 29, 2026
Merged

ci: give the api-surface build the tb-addon backend URLs#140
rubenhensen merged 2 commits into
mainfrom
fix/api-surface-build-env

Conversation

@rubenhensen

Copy link
Copy Markdown
Contributor

Main's Delivery has been red since #135 and #137 both merged, which skips the Release job — so this blocks publishing.

Cause: the API-surface gate's Build step runs pnpm -r build, which now reaches apps/tb-addon, whose build deliberately fail-closes without PKG_URL/CRYPTIFY_URL/POSTGUARD_WEBSITE_URL. This is the fourth build step in integration.yml to need them; I patched the other three when the addon landed, and delivery.yml after review caught it there.

Why no CI caught it: #135 and #137 were each green in isolation and broke in combination. #135 added this build step before the addon existed; #137 added the app that makes the step's preconditions stricter. Neither PR's checks could see the other's change.

Verified locally: pnpm -r build with the vars unset reproduces main's failure, and passes with them set.

The generalisable fix is the guard-test pattern in encryption4all/postguard#272 — a gate asserting its own wiring, rather than each new build step having to remember an invariant that lives in a different file. This class will recur on B4 and B5.

Part of encryption4all/postguard#247.

The API-surface gate's Build step runs `pnpm -r build`, which reaches apps/tb-addon, whose build fail-closes without PKG_URL/CRYPTIFY_URL/POSTGUARD_WEBSITE_URL. It is now the fourth build step in this file to need them.

#135 and #137 were each green in isolation and broke in combination: #135 added this build step before the tb-addon import existed, and #137 added the app that makes the step's preconditions stricter. Neither PR's CI could see the other.

Delivery on main has been failing since both merged, which also skips the Release job — so this blocks publishing.
@dobby-coder

dobby-coder Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for the detailed writeup, @rubenhensen — I'm on it. Starting a review of this PR now, focusing on the guard-test pattern from postguard#272 and whether it properly closes the gap that let #135/#137 combine into a broken main.

@dobby-coder dobby-coder Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct fix, and I reproduced both halves locally: pnpm -r build with the three vars unset fails at apps/tb-addon/build.mjs:14, and it passes with them set. All 16 checks are green. Approving so main's Delivery stops blocking the release.

Two things worth folding in before merge, neither blocking.

The api-surface job can drop the env block entirely. Details in the inline comment. pnpm api:gate reads exactly one build artifact, so pnpm --filter @e4a/pg-js build passes with all three vars unset. That takes this job out of the recurring class you describe, without waiting for the guard-test pattern from postguard#272.

If the recursive build stays, the block is now duplicated four times in integration.yml (lines 41, 89, 135, 182), with the production URLs hardcoded as fallbacks in each. A URL change becomes a four-place edit in one file, and each future build step is another chance to forget. A single job-level or workflow-level env: collapses all four; a per-job env: is the form I would trust without first checking context availability. delivery.yml:62 needs to keep its own copy, since pnpm release genuinely builds the addon, so that one is not duplication.

Separate note on CLAUDE.md:107: it still says api:gate is NOT yet a CI step and that a maintainer has to apply the job patch from #135. #135 did land it, at integration.yml:63-96, which is the job this PR edits. CLAUDE.md is auto-loaded agent context, so as written it tells the next agent to run api:gate locally on the belief that CI does not. Worth correcting in this PR.

Comment thread .github/workflows/integration.yml Outdated
@dobby-coder

dobby-coder Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Approved #140 — no blockers, so Delivery on main can go green again.

I reproduced the diagnosis locally: pnpm -r build dies at apps/tb-addon/build.mjs:14 without the three URL vars, passes with them set, and all 16 checks are green.

Three notes went along with the approval, not blocking this PR:

  • api:gate only reads packages/pg-js/dist/index.d.mts, so the api-surface job could drop the env block entirely and filter its build to just pg-js — skips a website/addon build the other lanes already cover.
  • If you keep the recursive build, the env block is now duplicated four times in integration.yml (41, 89, 135, 182) with hardcoded fallbacks — worth collapsing into one env: block so a URL change isn't a four-place edit. delivery.yml:62 would still need its own copy since pnpm release really does build the addon.
  • CLAUDE.md:107 is now stale — it says api:gate isn't a CI step yet, but ci: track the public API surface as a reviewed snapshot #135 already wired it into integration.yml:63-96. Worth fixing while you're in here since agents load that file as context.

Agreed the guard-test pattern from postguard#272 is the right long-term fix for this class of cross-PR breakage.

Both non-blocking points from review.

api-report.mjs reads exactly packages/pg-js/dist/index.d.mts and nothing from apps/*, so the gate never needed a workspace-wide build. Filtering to `pnpm --filter @e4a/pg-js build` removes this job from the class where a new app's build preconditions silently become this workflow's — which is a better outcome than adding the fourth copy of the workaround — and drops a website + addon build the Node/Bun/Deno lanes already cover. Verified with all three vars unset: filtered build exits 0 and the gate passes.

The three remaining recursive builds now inherit one workflow-level env block instead of carrying three copies with the production URLs hardcoded in each. delivery.yml keeps its own copy, since `pnpm release` genuinely does build the addon.
@rubenhensen

Copy link
Copy Markdown
Contributor Author

Took your suggestion over my own fix — it is the better one, and I verified the claim rather than trusting it: api-report.mjs reads exactly packages/pg-js/dist/index.d.mts (lines 33 and 47) and nothing from apps/*, and with all three vars unset the filtered build exits 0 and api:gate passes.

That is a genuinely better outcome than what I pushed. My fix added the fourth copy of a workaround for an invariant that lives in another file; yours removes the job from that class entirely, and makes it cheaper by dropping a website and addon build the Node, Bun and Deno lanes already cover.

Also collapsed the duplication you flagged: the three remaining recursive builds now inherit one workflow-level env: rather than three step-level copies with the production URLs hardcoded in each. delivery.yml keeps its own copy, since pnpm release genuinely builds the addon — as you noted, that one is not duplication.

Both verified locally: the api-surface path passes with no env set, and the recursive lanes still build with the inherited values.

@rubenhensen
rubenhensen merged commit 2351032 into main Jul 29, 2026
16 checks passed
@dobby-coder
dobby-coder Bot deleted the fix/api-surface-build-env branch July 29, 2026 20:01
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