Skip to content

Rebuild the 5.x baseline for Craft 6 beta - #215

Merged
timkelty merged 22 commits into
5.xfrom
craft-6-baseline
Dec 5, 2026
Merged

timkelty merged 22 commits into
5.xfrom
craft-6-baseline

Conversation

@timkelty

@timkelty timkelty commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This PR rebuilds 5.x as a minimal base for the Craft 6 feature PRs (disk, transformer, static cache). It's maintenance: the package isn't meant to run on Craft Cloud yet, and it avoids assumptions about how the platform will work.

What's in it

  • Namespace CraftCms\Cloud, matching CraftCms\Cms.
  • CloudServiceProvider is the only source file. On Lambda (AWS_LAMBDA_RUNTIME_API set, the same check bref/laravel-bridge uses) it applies this config, and elsewhere it does nothing:
    • Cache: Laravel's failover store, database then memory.
    • Logging: the default channel goes to stderr.
    • Sessions: the database driver.
  • Dependencies: PHP ^8.5, craftcms/cms ^6.0.0-beta.3, bref/bref ^3, bref/laravel-bridge ^3.1.7 (GHSA-qmwm-25jf-8mpw).

Removed from 5.x

  • The Lambda handlers (src/bref/handlers/*), CraftCliEntrypoint and CurlClient.
  • The SQS queue configuration.
  • The Valkey lookup from CRAFT_CLOUD_CACHE_SRV. Valkey is left out for now.
  • bref/extra-php-extensions and ext-curl.

Development

  • Pest 5 and Orchestra Testbench, booting Craft's and Cloud's providers.
  • Workbench: composer serve runs Craft 6 with this package on SQLite.
  • .agents/setup and .amp/services.yaml for Amp orbs.
  • Pint and PHPStan with Larastan (level 6), matching craftcms/cms, with cms's tests, phpstan and ci Composer scripts.
  • CI runs composer validate --strict, Pint, PHPStan and the tests on PHP 8.5 and 8.6. The 8.6 job is allowed to fail while 8.6 is a prerelease.

Releases

This removes the unused semantic-release config, which would have numbered from 3.1.0, the newest tag in this branch's history, and collided with 3.x releases. Releases are drafted by hand with the GitHub CLI instead, so the package has no Node tooling:

gh release create 5.0.0-beta.1 --target 5.x --draft --generate-notes --prerelease

Infra

cloud-api still points the queue and command functions at the handler paths this PR removes. No Craft 6 site runs on 5.x yet, so this matters only once one does.

Related

- Move to the CraftCms\Cloud namespace
- Run queued jobs with bref/laravel-bridge's QueueHandler
- Run platform commands with a Guzzle-based CommandSqsHandler
- Give the Valkey connection 1-second timeouts
- Force stderr logging and database sessions on Cloud
- Read CRAFT_CLOUD_* through one Cloud class
- Test with Orchestra Testbench booting Craft
- Release with release-it, matching 3.x

Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
Co-authored-by: Amp <amp@ampcode.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T18:42:47.813975Z f2c8729 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f2c8729630

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Lambda/CommandSqsHandler.php Resolved
Comment thread src/Lambda/CommandSqsHandler.php Resolved
timkelty and others added 4 commits November 10, 2026 18:44
The callback post no longer throws when both attempts fail at the transport
layer, so SQS won't redeliver and rerun a completed command. Output that
isn't valid UTF-8 is substituted instead of failing to encode, as in 3.x.

Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
Co-authored-by: Amp <amp@ampcode.com>
The workbench serves a Craft 6 site with this package installed, on SQLite,
from Testbench's skeleton. `composer build` installs Craft and `composer serve`
serves it. In Amp orbs, .agents/setup installs PHP 8.5 and dependencies and
.amp/services.yaml runs the workbench behind a portal.

Also relocks craftcms/cms and craftcms/cms-assets at 6.0.0-beta.1, now that
Packagist has indexed the cms-assets tag.

Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
Co-authored-by: Amp <amp@ampcode.com>
- Read CRAFT_CLOUD_REDIS_URL, which is what cloud-api sets. CRAFT_CLOUD_CACHE_SRV
  was never set, so Valkey was never used. This also drops the per-boot DNS lookup.
- Give console commands the invocation's remaining time, less a buffer to send the
  result, instead of assuming a 900-second function timeout.
- Drop bref/extra-php-extensions. It only ships serverless.yml layer metadata, and
  Cloud's builder copies the extension images itself.

Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
Co-authored-by: Amp <amp@ampcode.com>
timkelty and others added 17 commits December 3, 2026 18:14
- Require PHP ^8.5 and narrow minimum-stability to beta
- Update dependencies within constraints (Craft 6.0.0-beta.3, Mago 1.62)
- Migrate phpunit.xml.dist to the PHPUnit 12.5 schema
- Bump actions/checkout to v7 and ramsey/composer-install to v4
- Remove the unused tests/Arch and tests/Unit directories

Amp-Thread-ID: https://ampcode.com/threads/T-55bba2ca-8b70-4e4b-b792-799738d8cb80
Pest 5 brings PHPUnit 13, so phpunit.xml.dist moves to the 13.4 schema.

Amp-Thread-ID: https://ampcode.com/threads/T-55bba2ca-8b70-4e4b-b792-799738d8cb80
Releases run through `npm run release` instead of an unpinned npx.

Amp-Thread-ID: https://ampcode.com/threads/T-55bba2ca-8b70-4e4b-b792-799738d8cb80
The baseline isn't meant to run on Craft Cloud yet, only to be a base for
feature PRs, so it shouldn't assume how the platform will work.

- Remove Cloud, the command and queue Lambda handlers, and their tests
- Apply the provider's config unconditionally, without a Craft Cloud check
- Always use database sessions
- Drop guzzlehttp/guzzle and symfony/process, which only the handlers used

Amp-Thread-ID: https://ampcode.com/threads/T-55bba2ca-8b70-4e4b-b792-799738d8cb80
"${self::CONST}" is a variable-variable in PHP, not constant interpolation,
so the store was registered under an empty key.

- Remove the queue tests and CRAFT_CLOUD_SQS_URL from the test env
- Remove the .husky and AGENTS.md export-ignore lines

Amp-Thread-ID: https://ampcode.com/threads/T-55bba2ca-8b70-4e4b-b792-799738d8cb80
- Replace Mago with Pint (laravel preset) and PHPStan with Larastan (level 6)
- Rename Composer scripts to cms's tests, phpstan and ci
- Add sort-packages and platform.php 8.5 to Composer config
- Require craftcms/cms ^6.0.0-beta.3
- Run CI on PHP 8.5 and 8.6

Amp-Thread-ID: https://ampcode.com/threads/T-55bba2ca-8b70-4e4b-b792-799738d8cb80
--ci makes a stray ->only() run the whole suite instead of one test.

Amp-Thread-ID: https://ampcode.com/threads/T-55bba2ca-8b70-4e4b-b792-799738d8cb80
release-it only drafted a GitHub release, which one gh command does. This
removes the package's last Node tooling.

Amp-Thread-ID: https://ampcode.com/threads/T-55bba2ca-8b70-4e4b-b792-799738d8cb80
Craft's database backups, which craft:up runs, shell out to the sqlite3 CLI.
The health check uses / because Craft 6 returns 500 on control panel requests
without a User-Agent header, which Amp's probe doesn't send.

Amp-Thread-ID: https://ampcode.com/threads/T-55bba2ca-8b70-4e4b-b792-799738d8cb80
The provider overrode cache, session and log config on every machine,
including local dev and CI. Check AWS_LAMBDA_RUNTIME_API first, as
bref/laravel-bridge does.

Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
Laravel merges its default cache stores into every app, so its own
failover store (database, then memory) replaces the copy. Tests now
re-register the provider over project config instead of juggling
environment variables, run on an in-memory database instead of the
workbench's, and check that the cache actually fails over.

Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
- Drop LOG_LEVEL=critical from the phpstan script: logs no longer go
  to stderr off Lambda.
- Run Pint with Composer's PHP in the ci script, and group the
  stability keys after scripts, as craftcms/cms does.
- Let the PHP 8.6 prerelease job fail without blocking merges.
- Drop Testbench's default discovers keys and a stray blank line.
- Keep the platform-wide CHANGELOG.md out of the package archive.
- Remove the README's release command for now.
- Describe the workbench in AGENTS.md.

Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
@linear-code

linear-code Bot commented Dec 5, 2026

Copy link
Copy Markdown

CLOUD-793

@timkelty
timkelty merged commit 33a8b42 into 5.x Dec 5, 2026
2 checks passed
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