Skip to content

ci: gate image publish on pack, flake, and runtime smoke checks - #71

Open
LizAinslie wants to merge 4 commits into
mainfrom
hotfix/pre-publish-checks
Open

LizAinslie wants to merge 4 commits into
mainfrom
hotfix/pre-publish-checks

Conversation

@LizAinslie

Copy link
Copy Markdown
Contributor

Why

v0.2.0 shipped a /login page runtime crash: server/pack/src/pages/kalendee/login/+page.svelte called page<LoginPage>() without binding the result, so ctx was undefined when the template rendered. pnpm typecheck only runs tsc over .ts files and vite build happily bundles the broken component, so nothing failed until a browser loaded the page from the pack baked into the published image. (Fixed on main by a1d706e, released as v0.2.1.)

This PR adds local + CI gates that run before the runtime image is pushed.

Gates

  • Pack page-context guard — scripts/check-page-context.mjs walks every server/pack/src/pages/**/+page.svelte and fails if the template references ctx while the script does not bind page<...>().
    • svelte-check was tried first (adds check script + .svelte to tsconfig include). It does catch this regression (Cannot find name 'ctx'), but the pack has 23 pre-existing unrelated type errors, so it cannot be shipped as a failing gate yet. The targeted guard was used instead per plan.
  • Nix flake check — scripts/check-flake.sh runs nix flake check --no-build then nix flake show.
  • Runtime image smoke test — scripts/smoke-image.sh builds the Dockerfile runtime stage (or reuses IMAGE_TAG with --no-build), boots it with a disposable PostgreSQL, and asserts:
    • GET /api/v1/health contains "ok"
    • GET /login returns 200 HTML
    • /__keel/pack/kalendee/bootstrap.js returns 200 non-empty JS
    • /__keel/pack/kalendee/pages/kalendee.login.js returns 200 and contains Sign in (the real page module is in the served pack)
    • POST /api/v1/auth/login (admin) returns 200 and a session cookie
    • authenticated GET /api/v1/calendars returns 200

scripts/pre-publish-checks.sh runs all three locally.

CI

.github/workflows/docker.yml gains pack-check, flake-check, and smoke-image jobs; the existing multi-arch docker job now needs all three, so nothing is pushed unless every gate passes. on:, permissions, concurrency, env, and the existing build/push step are untouched.

latest and 0.2.1 are unaffected: no image is rebuilt or retagged by this PR, and the new gates only apply to future pushes/tags.

The v0.2.0 /login crash came from a +page.svelte that used ctx in its
template while the script called page<LoginPage>() without binding the
result. typecheck only covers .ts files and vite build bundles the broken
page happily, so walk the page templates directly.
Add local pre-publish gates and make the docker workflow run them before
the multi-arch build/push:
- smoke-image.sh builds the runtime stage, boots it with a disposable
  postgres, and checks health, /login HTML, the served pack bootstrap and
  login modules, an admin login, and an authenticated calendars fetch.
- check-flake.sh runs nix flake check --no-build and nix flake show.
- pre-publish-checks.sh orchestrates the guard above plus both checks.
- docker.yml gains pack-check, flake-check, and smoke-image jobs and the
  docker job now needs all three.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Deploying kalendee-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: e8122a8
Status: ✅  Deploy successful!
Preview URL: https://a0811110.kalendee-docs.pages.dev
Branch Preview URL: https://hotfix-pre-publish-checks.kalendee-docs.pages.dev

View logs

Add a pull_request trigger limited to main so PRs exercise the
pack-check, flake-check, and smoke-image gates. The build+push docker
job stays tag/dispatch-only via if: github.event_name != 'pull_request';
it still needs all three checks.
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