Skip to content

Trigger headless builds through the current build API - #16

Open
batuhan wants to merge 1 commit into
mainfrom
fix/current-build-and-upload-routes
Open

batuhan wants to merge 1 commit into
mainfrom
fix/current-build-and-upload-routes

Conversation

@batuhan

@batuhan batuhan commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Why

Headless mode can't trigger a build today. Spacefast's API retired the routes this plugin calls:

Plugin 0.5.8 calls Current API
GET /v1/spaces/{id}/builds/wordpress?sourceUrl=… GET /v1/spaces/{id}/builds/preflight?source=wordpress&sourceUrl=…
POST /v1/spaces/{id}/builds/wordpress {sourceUrl} POST /v1/spaces/{id}/builds {source: "wordpress", sourceUrl}
POST …/versions/{v}/uploads/resume POST …/versions/{v}/uploads/refresh

I checked this against the live API's published https://api.spacefast.com/openapi.json. The two /builds/wordpress routes and uploads/resume are absent, the replacements are present, and GET /builds/wordpress returns 404 not_found. Every headless rebuild fails at the preflight, so publishing in WordPress never updates the site. Static mode still works only because the server keeps a hidden uploads/resume alias marked for removal.

What

  • Spacefast_Client::repository_health() and trigger_build() call builds/preflight and POST /builds with source: "wordpress".
  • resume_static_upload() is now refresh_static_upload() and calls uploads/refresh.
  • 0.5.9: version, stable tag, changelog, acceptance pin.
  • Tests: tests/behavior.php used to check only str_ends_with( $url, '/builds/wordpress' ), which is how this drift got through. It now pins the exact method, URL, query, and body for preflight, trigger, and upload refresh. Fixture links use the current refresh key.

Overlap: #15 touches the same publisher file but no route. #13 is conflicting and still calls uploads/resume; whichever lands second needs a rebase.

Proof

./bin/test.sh            Spacefast WordPress behavior tests: PASS (reproducible zip check passes)
./bin/test-wordpress.sh  Spacefast WordPress container acceptance: PASS (WordPress 6.5, PHP 8.1)

I haven't run a real WordPress against production yet. That needs this release cut and a connected Space.

Release

Merge, then tag v0.5.9. release.yml publishes the zip the dashboard's Download WordPress plugin button links to (releases/latest/download/spacefast-wordpress.zip).

Retries across OAuth token refreshes are safe only after spacefast/monorepo#4689 deploys. Before that, a retry after a refresh can queue a second build.

This action is being done autonomously.

🤖 Generated with Claude Code


View with [code]smith QA with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Improvements
    • Updated build checks and creation to use the current Spacefast build API, including WordPress source details.
    • Updated static upload refresh to use the current upload route.
  • Release
    • Updated the plugin version to 0.5.9.

Spacefast replaced POST/GET /builds/wordpress with POST /builds
{source: "wordpress"} and GET /builds/preflight, and renamed
/uploads/resume to /uploads/refresh. 0.5.8 still called the removed
routes, so headless rebuilds never started. Static publishing only kept
working through a server-side alias.

The behavior suite now pins exact method, URL, query, and body for the
preflight, trigger, and upload refresh calls. The old suffix checks let
the drift pass.

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

indent Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Issues

No issues found.

CI Checks

All CI checks passed on 88a0d49.

Review agents

Select any unchecked box below to run or rerun that agent.

Passed (1)
  • Indent Review Agent · No issues found in the build API migration.
Full results

Indent Review Agent

  • Summary: No issues found in the build API migration.
  • Last ran on commit: 88a0d492
  • Latest result
    {
      "summary": "No issues found in the build API migration.",
      "findings": []
    }

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Walkthrough

The plugin now uses updated Spacefast build and upload-refresh routes. The publisher and behavior tests use the renamed upload-refresh method. The plugin version changes from 0.5.8 to 0.5.9.

Changes: Spacefast API route updates

Layer / File(s) Summary
Build API requests
includes/class-spacefast-client.php, tests/behavior.php, readme.txt, spacefast-wordpress.php, tests/acceptance/wordpress.php
The client checks the repository preflight endpoint and posts build requests to /builds with source: wordpress. Tests verify the preflight and request body. Release metadata and the changelog now identify version 0.5.9.
Static upload refresh
includes/class-spacefast-client.php, includes/class-spacefast-static-publisher.php, tests/behavior.php
The client renames resume_static_upload to refresh_static_upload and requests /uploads/refresh. The publisher and behavior tests use the updated method and route.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to 88a0d

The API route updates are consistent across the client, publisher and tests. Refresh completion uses a documented JSON response, so the reported empty-response concern does not block merging after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the primary change: updating headless build requests to use the current build API.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 5 files. (1 skipped: 1 unsupported.)

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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