Skip to content

fix: drop acceptTerms from workspace create body - #10

Merged
boristane merged 1 commit into
mainfrom
claude/drop-accept-terms
Aug 3, 2026
Merged

fix: drop acceptTerms from workspace create body#10
boristane merged 1 commit into
mainfrom
claude/drop-accept-terms

Conversation

@claude

@claude claude Bot commented Aug 3, 2026

Copy link
Copy Markdown

Requested by boris · Slack thread

Before / After

Before: polylane workspace create sent an acceptTerms: true field in the POST /v1/workspaces body. The API no longer accepts that field — coreplanelabs/nominal#465 replaced the body schema with zCreateWorkspace, a z.strictObject, so any unknown key is rejected. Once that change deploys, every workspace create from the CLI fails with a 400 unknown-key error.

After: the command sends only the workspace name (plus the optional --description / --slug). Creating the workspace is the acceptance, and the server records it. The stderr notice — "By creating a workspace you accept the Polylane Terms of Service: …" — is unchanged and is now a more accurate description of what happens than it was before.

Why CI didn't catch this. The body was routed through an intermediate variable before being assigned to the typed parameter:

const withTerms = { name, acceptTerms: true as const };
const body: Parameters<PolylaneAPI['workspacesPost']>[0] = withTerms;

TypeScript's excess-property check only fires on a fresh object literal assigned directly to the annotated target. Going through withTerms made the assignment an ordinary structural check, which silently tolerates extra properties — so the stale field survived every codegen + typecheck run. The fix restores a direct literal, so the next time the spec drops or renames a field the build fails instead of shipping a 400.

How

src/commands/workspace/create.ts now declares a module-level type CreateWorkspaceBody = Parameters<PolylaneAPI['workspacesPost']>[0] — the same pattern as automation/create.ts, integration/connect.ts, and cloud/connect.ts — and builds the body as const body: CreateWorkspaceBody = { name }. The acceptTerms field and the comment justifying the indirection are gone. A repo-wide grep confirms no other reference to acceptTerms (no tests, docs, or skill/SKILL.md mention it).

Merge ordering — read before merging

This must merge after coreplanelabs/nominal#465 deploys to the API that npm run codegen reads (https://api.polylane.com/v1/doc).

At the time this PR was written the live spec still declared acceptTerms: true as required:

async workspacesPost(body: { name: string; description?: string | null; slug?: string; link?: boolean; acceptTerms: true }): Promise<T.Workspace>

so npm run typecheck fails on this branch with:

src/commands/workspace/create.ts(37,11): error TS2741: Property 'acceptTerms' is missing in type '{ name: string; }' but required in type '{ name: string; ...; acceptTerms: true; }'.

That error is expected and self-clearing: it disappears the moment the deploy lands and codegen picks up the new spec. Re-run CI after the deploy rather than working around it. Lint (clean), tests (117/117 pass), and build (dist/polylane.mjs, 430.5 KB, --version OK) all pass now.

Unrelated pre-existing failure, noted for the record: main is already red on src/commands/feed/list.ts:89 — the CLI's --category list includes investigation, anomaly, chat, alert, and deploy, which the live feed.list spec no longer accepts. That is separate spec drift and out of scope here; worth its own fix.

Does this need a new CLI release?

Yes. This fix does not help anyone who has already installed the CLI. Published v0.2.1 and every prior version send acceptTerms and will start returning 400 on workspace create the moment nominal#465 deploys, regardless of what lands on main. A release is the only thing that reaches users.

Cutting one is a single command from a clean main (see release.sh):

./release.sh 0.2.2

It bumps package.json, runs typecheck + lint + test + build, commits chore: release v0.2.2, tags v0.2.2, and pushes branch + tag. The v* tag fires .github/workflows/release.yml, which re-runs the full check matrix (Node 20/22/24) and then publishes to npm with provenance, creates the GitHub Release with polylane.mjs attached, and bumps the coreplanelabs/homebrew-tap formula. The curl and PowerShell installers pull from the GitHub Release, so all install channels update from that one tag.

Suggested sequence: deploy nominal#465 → merge this PR → ./release.sh 0.2.2.

Refs coreplanelabs/nominal#465


Generated by Claude Code

The POST /v1/workspaces body schema is now a strictObject without
acceptTerms (coreplanelabs/nominal#465), so sending the field returns a
400 unknown-key error. Creating a workspace is itself the acceptance and
the server records it.

Build the body as a direct object literal typed against the generated
params, matching every other command. The previous indirection through a
variable defeated TypeScript's excess-property check, which is why CI
never flagged the stale field.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017YKtZtLLwdxPyh11L5J8BU
@boristane
boristane marked this pull request as ready for review August 3, 2026 00:37
@boristane
boristane merged commit 69f7df6 into main Aug 3, 2026
0 of 3 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.

2 participants