Skip to content

fix(cli): a new app's composition root composes again after a failure - #518

Merged
tortuvshin merged 2 commits into
mainfrom
fix/scaffold-compose-retries-after-a-failure
Dec 5, 2026
Merged

tortuvshin merged 2 commits into
mainfrom
fix/scaffold-compose-retries-after-a-failure

Conversation

@tortuvshin

Copy link
Copy Markdown
Member

Why

The scaffold's composeIntelligo() runs the app's registrations once per process. It set its composed flag before calling bind(), whose first statement checks the environment. When that threw, the flag stayed set: a second call in the same process skipped every registration and carried on to seed the database with nothing bound. A production server stops on the first throw, so this showed in processes that outlive it: a dev server, a worker, a test run, a script.

The flag is still set first, so a registration that itself composes does not recurse, and is put back when bind() throws, so the next call binds again. The seed promise beside it already retried this way.

The reference app and the showcase carry the same change in their own lib/intelligo.ts. app-scaffold is 1.34.1.

Review

  • AI-assisted: an agent wrote part of this diff
  • Touches a high-risk path (the "High risk" section of .github/CODEOWNERS); the review-window check holds it for 24 hours after it is first seen as high-risk

Another open pull request also changes app-scaffold and its pinned hash; whichever merges second takes the next version and a recomputed hash.

Checklist

  • One concern, with a conventional commit subject
  • A test that fails without the change (a case in tests/architecture/ for a boundary change): packages/cli/src/templates.test.ts runs the guard as the template writes it, with a bind that fails once
  • pnpm type-check && pnpm lint && pnpm test pass locally: the CLI's tests, type-check of both apps, tests/architecture, the sync check. The rest is left to CI.
  • Public API (exports, CLI flags and output, environment variables, the schema) changes only as RELEASES.md allows: none
  • A CHANGELOG.md entry under [Unreleased] for anything a consumer notices
  • No product vocabulary in a package; installed registry components are not edited (a seam in packages/registry/base/ instead)

composeIntelligo() in the scaffold marked itself done before it bound
anything. In a process that outlived a first failure, every later call
skipped the registrations and went on with nothing bound. The mark is
put back when binding throws.
@mergify

mergify Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

This pull request is merged.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
intelligo-web 8bd261b Commit Preview URL

Branch Preview URL
Dec 05 2026, 05:55 PM

@tortuvshin
tortuvshin merged commit 409f51a into main Dec 5, 2026
1 check was pending
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