Skip to content

feat: add experimental canvas-migration template - #236

Open
ivanboring wants to merge 1 commit into
mainfrom
20261110_jamieaa64_canvas_migration_template
Open

ivanboring wants to merge 1 commit into
mainfrom
20261110_jamieaa64_canvas_migration_template

Conversation

@ivanboring

Copy link
Copy Markdown
Collaborator

Short Summary (TL;DR)

Adds the experimental canvas-migration template, which until now existed only on staging, so that make push-template-canvas-migration can publish it to coder.ddev.com. Its custom Claude behavior moves into optional claude-remote-control variables, leaving the other templates' output byte-identical.

The Issue

The Drupal CMS Canvas Migration template was pushed to staging-coder.ddev.com by hand from outside this repository, so it can't reach coder.ddev.com through the normal deploy path. Its vendored copy of claude-remote-control had also been edited in place, and make sync-shared would overwrite those edits.

How This PR Solves The Issue

  • Adds canvas-migration/ from staging version migration-v6-skill-launch (by jamieaa64). It is a single-project derivative of freeform. On first start, migration-setup.sh installs Drupal CMS with Canvas, Storybook and MCP for the Canvas AI Migrations workflow.
  • Marks it experimental: the display name is "Drupal CMS Canvas Migration (Experimental)", and the README has an experimental tag and a note.
  • Adds four optional claude-remote-control variables, default_enabled, default_skip_permissions, project_directory and launch_script, to replace the template's in-place module edits. The Start a migration with /building-ui switch passes start-building-ui.sh as launch_script. With the defaults, the module renders the same startup script as main byte for byte (checked with remote control off, on, and on with skipped prompts).
  • Makefile: adds canvas-migration to TEMPLATES, with push-template-canvas-migration, deploy-canvas-migration and display metadata. A new RUNNER_TEMPLATES vendors the self-hosted runner module into it as well as freeform.
  • CI: adds canvas-migration to the validate.yml and staging-push.yml matrices.
  • Syncs the vendored modules from main, so the template also gets fix(runner): put Homebrew on every PATH, and report dirty checkouts #234 and fix(claude): give Claude sessions the workspace SSH agent #235.
  • Leaves out the freeform integration-test scripts the staging copy carried, and rewrites MAINTAINERS.md for maintenance in this repository.
  • Docs: updates AGENTS.md and getting-started/choosing-a-template.md.

Manual Testing Instructions

  1. Run make push-template-canvas-migration ACTIVATE=false against staging, then create a workspace from the new version.
  2. Wait for Migration setup log to show ready. Sign in from the Claude Code app and check /mcp.
  3. Create a second workspace with a source URL and Start a migration with /building-ui switched on. After you sign in, Claude should run /building-ui on that site in ~/migration.
  4. Check that Claude remote control in a freeform workspace still behaves as before.

Automated Testing Overview

  • terraform fmt -check -recursive, make validate and make test-templates pass for all templates. Two new template tests cover the default launch and the /building-ui launch.
  • shellcheck and bats canvas-migration/tests/setup.bats (7 tests) pass locally. CI doesn't run them yet.
  • markdownlint passes on docs/content. The Zensical build was not run locally.

Release/Deployment Notes

  • After merge, deploy with make push-template-canvas-migration against coder.ddev.com.
  • First-start setup needs outbound access to aibp.drupalstarforge.ai and gitlab.com/freelygive/canvas-storybook-ai (branch feat/coder).
  • The claude-remote-control change is vendored into drupal-core, drupal-contrib and freeform, but their rendered output is unchanged.

Known limitations, carried over from staging:

  • Switching on Start a migration with /building-ui without a source URL leaves Claude stopped, because start-building-ui.sh requires MIGRATION_SOURCE_URL.
  • The template offers the freeform self-hosted runner parameter. The runner refuses to start alongside remote control, which this template turns on by default.
  • migration-v6-skill-launch was never promoted on staging; the active staging version is migration-v5-workflow.

🤖 Generated with Claude Code - MR done from template code vibe coded by jamieaa64

Add the canvas-migration template from staging-coder.ddev.com (version
migration-v6-skill-launch, by jamieaa64), so that after merge
`make push-template-canvas-migration` publishes it to coder.ddev.com.
It is a single-project derivative of freeform that installs Drupal CMS
with Canvas, Storybook and MCP on first start, for the Canvas AI
Migrations workflow. Its display name and README tags mark it as
experimental.

The staging copy had edited its vendored claude-remote-control module,
which `make sync-shared` would overwrite. Those edits are now optional
module variables: default_enabled, default_skip_permissions,
project_directory and launch_script. With the defaults, the module
renders the same startup script as before, so drupal-core,
drupal-contrib and freeform are unchanged.

Also:

- Makefile: add canvas-migration to TEMPLATES, with push and deploy
  targets and display metadata. RUNNER_TEMPLATES vendors the runner
  module into it as well as freeform.
- CI: add canvas-migration to the validate and staging-push matrices.
- Leave out the freeform test scripts the staging copy carried, and
  rewrite MAINTAINERS.md for maintenance in this repository.
- Docs: describe the template in AGENTS.md and on the
  choosing-a-template page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Previews

Site Preview
docs.coder.ddev.com (docs/content, built by Read the Docs) https://coder-ddev--236.org.readthedocs.build/
start.coder.ddev.com (docs/*.html, deployed to gh-pages) https://start.coder.ddev.com/pr-preview/pr-236/

The landing-page preview creates workspaces on staging-coder.ddev.com, and its Documentation links open the docs preview. Read the Docs posts its build status and changed pages in its own comment; the docs preview may take a minute or two after a push to update.

Updated for 74ee143

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 coder-ddev | 🛠️ Build #35783173 | 📁 Comparing 74ee143 against latest (44a1dd2)

  🔍 Preview build  

1 file changed
± getting-started/choosing-a-template/index.html

@rfay

rfay commented Nov 11, 2026

Copy link
Copy Markdown
Member

This PR is deployed on staging-coder.ddev.com. I'm open to pulling it. Please take it for a spin at it there, even though you were previously using manually deployed version of same thing.

It does show up at the top of everything, and "experimental" isn't clear in that context.

image

Please do explain why it's important to do this as a template, when it could be a script that's autostarted by any other template.

@rfay rfay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • I understand after looking at the web launcher why you need a template.

  • I'm not sure all of it needs to be stuffed into the template, though. About 560 of the 686 lines in canvas-migration/template.tf are a copy of freeform, including the inline startup script, so freeform fixes won't reach this template unless someone copies them over by hand. The migration-specific work (migration-setup.sh, the Claude rules, start-building-ui.sh) doesn't need Terraform.

  • Please open additional issues or PRs based on what you learned doing this, thanks.

Claude Code created a workspace from this version on staging with a source URL and the /building-ui switch on. Setup reached ready in about 11 minutes, Drupal and Storybook both answered, and a restart re-ran setup cleanly in about a minute and a half. After Claude login, the pane started /building-ui on the source site as intended.

  1. The remote-control Claude can't reach the Drupal MCP server: it reported "failed to connect due to a TLS certificate error". The installer puts NODE_EXTRA_CA_CERTS (the mkcert CA) in ~/.bashrc, but the tmux pane doesn't read ~/.bashrc, so Claude's process doesn't have it. The staging v6 version had the same problem. With the variable set, Node reaches https://migration.ddev.site/mcp fine (401, not a TLS error). Maybe add it to the agent env, or to the module next to SSH_AUTH_SOCK, so remote control in other templates gets it too?
NODE_EXTRA_CA_CERTS = "/home/coder/.local/share/mkcert/rootCA.pem"

The setup check passed anyway because it only tests .mcp.json and the token exchange. A real request with curl --cacert or node would catch this.

  1. From reading the code (not tried yet): if migration-setup fails, the startup script stops there because of set -euo pipefail, so Claude remote control, the runner and ~/.coder-startup.sh never start. After a partial install, every later start fails the same way at the missing-marker check, so the user loses Claude right when they'd want it to help repair things. Maybe ~/.local/bin/migration-setup || echo "Migration setup failed; see Migration setup log"?
  2. The installer is fetched unpinned (install.sh plus the feat/coder branch, with --yolo) on the first start of every workspace, so what users get can change without any change here. Can we pin a tag or commit?
  3. With /building-ui switched on and no source URL, Claude stays stopped. Falling back to the default launch avoids that:
launch_script = data.coder_parameter.start_building_ui.value == "true" && data.coder_parameter.migration_source_url.value != "" ? file("${path.module}/start-building-ui.sh") : ""
  1. Right after a restart, the "Migration setup" status shows ready from the previous run until setup starts again. Maybe reset the status file early in the startup script?

Small things:

  • The runner switch can't work here, since remote control is on by default and the runner refuses to run alongside it. Maybe drop it, along with RUNNER_TEMPLATES?
  • "(Experimental)" at the end of the display name is easy to miss in the template list. Maybe put it first?
  • The setup log shows ln: failed to create symbolic link '/usr/local/bin/agent-browser': Permission denied and "Detected 4 configuration error(s)" from the router. Probably for the installer side to fix.

🤖 Reviewed with assistance from Claude Code

@rfay rfay left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Claude tested this in a workspace created from the template (review236a). I ran /building-ui on the source URL and had Claude rebuild the ddev.com homepage in Storybook as Canvas code components, inspecting the source read-only and making no Drupal writes.

The main flow works. Setup reached ready, and the /building-ui build-approach questions fired and saved to AGENTS.md. Claude built 17 components, which pass canvas validate, and the full test suite passes (124 tests). Result: https://6005--main--review236a--rfay.staging-coder.ddev.com/?path=/story/example-pages-ddev-home--ddev-home

Problems found, grouped by where the fix belongs.

In this template

  1. The drupal MCP server can't connect: UNABLE_TO_VERIFY_LEAF_SIGNATURE. The site certificate comes from the workspace's mkcert CA, which isn't in the host trust store, so curl https://migration.ddev.site also needed -k. mkcert -install followed by ddev poweroff && ddev start fixes curl and other OS tools. That matches the open freeform change to run mkcert -install.
    But that isn't enough for Claude Code. Node ignores the system trust store, so a Node fetch to https://migration.ddev.site/mcp still fails after mkcert -install. It succeeds (401, waiting for the token) with either of:

    • NODE_EXTRA_CA_CERTS=/home/coder/.local/share/mkcert/rootCA.pem
    • NODE_USE_SYSTEM_CA=1 (Node 24; needs mkcert -install first)

    Adding one of these to the agent env block in template.tf (next to NODE_NO_WARNINGS) should make /mcp work without manual steps. NODE_EXTRA_CA_CERTS works even without mkcert -install.

  2. agent-browser doesn't run on the host. The global agent-browser's Chrome is missing system libraries (libatk-1.0.so.0, libatk-bridge, libcups, libgbm, libxkbcommon, X11/cairo/pango, libasound). The project's AGENTS.md and the QA skill tell agents to use it directly. Only ddev exec 'npx agent-browser …' inside the web container worked. Either install the Playwright Chromium dependencies in the image (npx playwright install-deps chromium or the equivalent apt packages) or point the guidance at the container.

  3. The Coder CLI isn't logged in on the workspace, so the agent can't set "don't autostop" (coder schedule stop <ws> manual). This matters for workspaces left up for others to review, like this one. Maybe set a long TTL or no autostop by default for this template, or at least document it.

In the installer and skills (aibp.drupalstarforge.ai), probably not this PR

  1. npm run code:fix damages the repo. This is the most serious one. Its Prettier step covers every file in the repo, and .prettierignore doesn't exclude web/, recipes/, .agents/ or .claude/. ESLint --fix also edits web/core and contrib code. One run from the host rewrote about 700 tracked files and about 100 gitignored Composer files (web/core, canvas, gin, project_browser, …). It also rewrote the template's own .claude/rules/coder-workspace.md. Recovery took git checkout plus ddev composer reinstall of 10 packages. AGENTS.md presents code:check and code:fix as routine, so agents will run them. They should be scoped to src/ (or the ignore files fixed).
  2. The Storybook URL is inconsistent. The installer's AGENTS.md MCP section says https://migration.ddev.site:6006 from the host. The Coder block appended by this template and .mcp.json use http://migration.ddev.site:6005.
  3. Brand-kit doesn't fit the sync setting. AGENTS.md lists brand-kit as a trackable sync group, but the Canvas CLI has no sync key for it; it's controlled only by the CANVAS_INCLUDE_BRAND_KIT env var.
  4. Minor skill mismatches:
    • getSlotChildren returns parsed data, not renderable children, so it can't be used to wrap slot children (e.g. in <li>).
    • drupal-canvas's Image logs a console error for every image without an alternateWidths URL, which means every Storybook asset.

Item 1 is the only one that blocks the template's advertised flow ("check /mcp"). The rest are friction or footguns.

@rfay

rfay commented Nov 11, 2026

Copy link
Copy Markdown
Member

Sorry to have introduced merge conflict, but Claude will help you with it :)

@jamieaa64

Copy link
Copy Markdown
Collaborator

Fantastic!

"I'm not sure all of it needs to be stuffed into the template, though."

Absolutely, to me the purpose of putting something out there is to show how it can work, end-to-end and then figure out where things go.

How do we test PRs for this, is it best to build it ourselves? I have the template working on https://staging-coder.ddev.com/workspaces and we were able to use the Agent Browser and get MCP working just fine. Do we set up ddev coder locally?

  • Strongly agree with "Experimental" can we word it something that means it appears near the end? Or maybe it has folders? But yeah otherwise putting it at the beginning is good.

@rfay

rfay commented Nov 12, 2026

Copy link
Copy Markdown
Member
  • The PRs get automated testing on staging-coder, make sure yours has tests for your stuff.
  • You have privs to push all the templates on staging-coder, and have experimented with that, so can do anything any time that mostly involves the template.
  • When you've rebased this or otherwise done as you like with it I can deploy the full thing from this branch again on staging-coder. I updated coder from main yesterday but didn't deploy first to staging-coder because you have this in play.

This branch has not been deployed

No deployments
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.

3 participants