Skip to content

Update SDK tutorial steps to current SDK APIs - #137

Merged
jackchuka merged 1 commit into
mainfrom
fix/sdk-tutorial-current-api
Oct 26, 2026
Merged

jackchuka merged 1 commit into
mainfrom
fix/sdk-tutorial-current-api

Conversation

@anukiransolur

Copy link
Copy Markdown
Contributor

Summary

The build-from-scratch SDK steps already pin @tailor-platform/sdk 2.32.0 (#135), but the code still used a deprecated API and had a logic bug in closeProject.

  • Relations use toward: { table } (all 4 steps). toward: { type } has been deprecated since SDK 2.6.0 (codemod v3/relation-toward-table). This also matches the published tutorial.
  • Fix the "already closed" check in closeProject (steps 03 and 04). It compared the status to "CANCELED", but the resolver sets projects to "CLOSED", so closing a project a second time re-ran the transaction instead of returning "Project is already closed." The published tutorial already checks "CLOSED".
  • closeProject now requires a logged-in user (steps 03 and 04). Without a permission, tailor generate warned that anonymous callers could reach the resolver. A resolverPermissionLoggedIn policy is added next to the existing permission helpers in src/common/permission.ts.

Testing

Run locally in each of step-01 to step-04, with the same commands as CI:

  • npm ci, npm run generate (no warnings now), npm run typecheck, npm run lint, npm run format:check: all pass
  • @typescript-eslint/no-deprecated run ad hoc over src and tailor.config.ts: no findings (before this change: 2 per step)

Follow-ups (not in this PR)

  • The published tutorial's step 4 (tailor-platform/docs, docs/tutorials/develop-from-scratch/step-04.md) passes a string to the webhook url. On SDK 2.32.0 that fails both tailor generate (DEFINITION_INVALID: operation.url) and tsc, because the SDK expects a function, as this repo uses.
  • Consider enabling @typescript-eslint/no-deprecated with typed linting in the steps' ESLint config so CI catches future deprecations.

🤖 Generated with Claude Code

- Use `toward: { table }` for relations; `toward: { type }` is deprecated
  since SDK 2.6.0
- Fix closeProject's "already closed" check to test CLOSED instead of
  CANCELED
- Require a logged-in user to call closeProject, which removes the
  `tailor generate` warning about anonymous resolver access

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

@jackchuka jackchuka 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.

LGTM

@jackchuka
jackchuka merged commit 3a8fb25 into main Oct 26, 2026
4 checks passed
@jackchuka
jackchuka deleted the fix/sdk-tutorial-current-api branch October 26, 2026 02:49
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