Skip to content

site deploy: finalize through the session id the create returned - #602

Merged
netanelgilad merged 6 commits into
mainfrom
claude/deploy-session-id
Aug 30, 2026
Merged

site deploy: finalize through the session id the create returned#602
netanelgilad merged 6 commits into
mainfrom
claude/deploy-session-id

Conversation

@netanelgilad

@netanelgilad netanelgilad commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Note

Description

A deployment id is derived from the commit, so two deploys of the same commit address the same deployment — the loser of a create race finalizes against whatever the winner's uploads left behind. The platform now returns a per-attempt session_id from POST deployments; this PR threads it back as ?session_id= on finalize so each run resolves its own uploads. Pairs with base44-dev/apper#20445 on the platform side.

Related Issue

Pairs with base44-dev/apper#20445 (platform side). No GitHub issue in this repo.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • CreateDeploymentResponseSchema gains a required session_id, transformed to sessionId alongside deploymentId (packages/cli/src/core/site/schema.ts).
  • finalizeStaticDeployment and postFinalize now take a sessionId and send it as searchParams: { session_id } on POST deployments/{id}/finalize (packages/cli/src/core/site/api.ts).
  • deployStaticSite threads created.sessionId from create through to finalize (packages/cli/src/core/site/static-site.ts).
  • TestAPIServer captures finalize query strings in a new finalizeQueries array (it previously captured only multipart fields), and its DeploymentCreateResponse shape carries session_id.
  • static_site_deployments.spec.ts mocks a session id on create and asserts finalize sends it: expect(t.api.finalizeQueries[0]).toEqual({ session_id: SESSION_ID }).
  • docs/deployments.md updated to document session_id in the create response, the ?session_id= finalize param and why it exists, and the new finalizeQueries testkit capture.

Why `session_id` is required, not optional

An earlier revision made it optional so a newer CLI would degrade against an older platform. There is nothing to tolerate: the static lane is gated by `BASE44_STATIC_DEPLOYMENTS`, set in exactly one place on the platform (the sandbox publish path) behind the currently-closed `sandbox-cli-static-publish` flag, and nothing else calls the deployments API. Public `base44 site deploy` users take the legacy tar.gz path and never reach this code.

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (`npm test`)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated `docs/` (AGENTS.md) if I made architectural changes

Additional Notes

Recorded run from when the change landed on the branch: `bun run test static_site_deployments` — 14 passed. It was not re-run for this description pass. The session assertion lives in the existing happy-path deploy test rather than a standalone case, which would have been setup-identical. Making `session_id` required also forced every mocked create in the spec to carry one — the schema doing its job.

Full-suite caveats from that same run, both verified pre-existing on clean `main` and not introduced here: `bun run typecheck` reports 6 errors in `src/cli/dev/dev-server/function-bundler.ts` (identical count with the change stashed), and `bun run test` fails 25 tests in `dev.spec.ts` / `exec.spec.ts` because `deno` is not installed in that environment.


🤖 Generated by Claude | 2026-08-30 11:57 UTC | c0623af

claude added 2 commits August 17, 2026 04:58
Two deploys of one commit share a deployment id — it is derived from the commit
— so they also share the upload session it addresses, and the loser of a create
race finalizes against whatever the winner wrote last. The platform now hands
back a per-attempt session_id at create; passing it to finalize resolves this
run's own uploads.

Both directions stay compatible: session_id is optional on the create response,
so a CLI newer than its platform sends nothing and gets the commit-derived
session, and an older CLI (the one pinned in today's sandbox images) is
unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1E31AZvYBa86zpcYJFD1g
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.1.11-pr.602.9833770

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.1.11-pr.602.9833770"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.1.11-pr.602.9833770"
  }
}

Preview published to npm registry — try new features instantly!

The optionality was protecting nobody. The static lane is gated by
BASE44_STATIC_DEPLOYMENTS, which only the sandbox publish path sets, and nothing
else in the platform calls the deployments API — so there is no client that both
reaches this code and lacks a session. A platform that opens none is a
mismatched deploy, and failing on it beats silently finalizing into the
commit-derived session two siblings share.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1E31AZvYBa86zpcYJFD1g
Comment thread packages/cli/src/core/site/api.ts Outdated
Comment thread packages/cli/tests/cli/testkit/TestAPIServer.ts Outdated
claude and others added 3 commits August 18, 2026 04:46
The platform always opens a session, so there was nothing to tolerate — the
testkit type is required again and the negative spec is gone. The remaining
session assertion folds into the happy-path deploy test rather than standing as
a near-duplicate of it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1E31AZvYBa86zpcYJFD1g
The server no longer keeps a commit-derived session alongside the per-attempt
one, so two deploys of a commit share only the deployment id.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1E31AZvYBa86zpcYJFD1g
@netanelgilad
netanelgilad merged commit ffa0324 into main Aug 30, 2026
14 checks passed
@netanelgilad
netanelgilad deleted the claude/deploy-session-id branch August 30, 2026 12:12
netanelgilad pushed a commit that referenced this pull request Aug 30, 2026
Integrates the session id main's #602 added to the deployments protocol:
create returns `session_id` and finalize now addresses this attempt's
uploads through it, so the cf arm threads `created.sessionId` into
`finalizeDeployment` alongside the static arm.

Conflicts resolved in docs/deployments.md (both arms plus session_id) and
core/site/schema.ts (kept sessionId alongside the cf/s3 upload union).
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