fix(cloud): Trigger.dev connect takes one No restrictions key, no project ref - #108
Conversation
…ject ref The API (coreplanelabs/nominal#3423) now identifies the key's project and environment from the key alone and refuses every preset except No restrictions, so the --project-ref flag, the project-ref retry prompt and the multi-key copy are gone. The failure lines in text output now surface the API's refusal from failures[].response verbatim.
There was a problem hiding this comment.
LGTM: Clean removal of the project-ref path with the refusal surfaced verbatim; matches the deployed API (failures[].response exists in the spec, projectRef stays optional) — one nit on empty-string response.
Note
Approved · head dd8a1d3 · 1 finding: 1 nit
| Severity | Finding | Where |
|---|---|---|
| nit | F1 response ?? message prints an empty line when the API sends response: "" — || would fall back |
src/commands/cloud/connect.ts:273 |
Full review
F1: nominal's connect routers fill failures[].response with (e as Error).message, which can in principle be an empty string; response ?? message then prints the empty response instead of falling back. response || message (or a trim() check) closes that hole. Not worth blocking on.
On the PR's open question: response ?? message for every provider looks right — turso, convex, clickhouse and triggerdev all populate response with the upstream error text, which is strictly more informative than the generic "There was an error when connecting an account." message it replaces.
Two facts I verified against the deployed API spec (api.polylane.com/v1/doc): the failures entry already carries optional response: string, so failure.response typechecks against regenerated src/generated; and projectRef is still an optional body field, so the smaller request body is accepted while nominal#3423's spec change catches up. The deleted test suite covered only the deleted connectTriggerdev helper and is fully replaced by the new printConnectSuccess and flag tests — verification intact.
|
Re F1 (nit, |
polylane cloud connect --provider triggerdevnow takes one Trigger.dev environment key created with the "No restrictions" preset and nothing else: the--project-refflag and its prompt are gone, and a refused key prints the API's own refusal text. Without this the CLI still coaches users toward a flag and key shapes the API no longer accepts.Why: nominal#3423 made Trigger.dev one "No restrictions" key per environment, refusing every other preset and dropping the project ref, so the CLI's retry-with-
--project-refpath and its "restricted keys on Pro" copy describe a contract that no longer exists. Closes cli#107, the patch the Switchboard ship run could not push (switchboard#1459).Where to look
--project-refflag, help row and example are deleted. ⚠ The deployed API spec still advertises an optionalprojectRef, so the generated client accepts the smaller body either way.failures[].responsewhen the API sent one, falling back tomessage; the "Polylane needs a key created with the 'No restrictions' preset" sentence comes from there verbatim.--api-keyexists and--project-refdoes not.Feedback wanted: Is
failure.response ?? failure.messagethe right precedence for every provider's failure list, or should the response only replace the message for Trigger.dev?Risk: Low: one provider's connect path in a CLI. A user with a saved
--project-refin a script gets an unknown-flag error instead of a silent no-op. Roll back by reverting the single commit.Verified:
npm run typecheck,npm run lintandnpm test(537/537) green locally at this head; README and docs carry no--project-refor restricted-preset mention to update. Live connect against the deployed API is human-gated on nominal#3423 reaching prod.Decisions (2)
failures[].responsefor every provider, not only Trigger.dev. The failure list is one shape for all providers andresponseis the field the API fills with the human sentence; a provider that leaves it empty falls back tomessageunchanged, so no other provider's output moves.--helptells the truth.Validation (5 criteria)
responseprints it verbatim after "Couldn't connect :"test/cloud-connect-triggerdev.test.ts::surfaces the API's refusal from failures[].response verbatimresponseprintsmessagetest/cloud-connect-triggerdev.test.ts::falls back to the failure message when the API sent no response text--api-keyis a flag and--project-refis nottest/cloud-connect-triggerdev.test.ts::takes only --api-key: the project ref comes from the key, so no --project-ref flag existsnpm run typecheckandnpm run lintclean at dd8a1d3polylane cloud connect --provider triggerdev --api-key <restricted key>prints the API's "No restrictions" refusalFor agents
The commit is the Switchboard ship run's patch (Slack thread https://coreplanelabs.slack.com/archives/C0BRRHKFLCB/p1789763033761049, also inline on cli#107) applied with
git amonto main at v0.2.39; the blob ids of both changed files match the patch's index line (6e9f450, 626f87a). The run could not push because its credential is scoped to coreplanelabs/nominal (switchboard#1459). No generated files changed;src/generated/is gitignored and rebuilt bynpm run codegenbefore typecheck.🤖 Generated with Claude Code