Skip to content

feat(cloud): declare projectType on SyncProject - #651

Merged
tkislan merged 2 commits into
mainfrom
tomaskislan/cloud-sync-project-type
Nov 16, 2026
Merged

tkislan merged 2 commits into
mainfrom
tomaskislan/cloud-sync-project-type

Conversation

@tkislan

@tkislan tkislan commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #649

listAllProjects and getProjectDetail already return each project's projectType at runtime through .passthrough(), but SyncProject didn't declare it. Consumers had to widen the type to read it; the VS Code extension uses SyncProject & { projectType?: string } to list only data apps.

Changes

  • syncProjectSchema validates projectType as an optional plain string, matching projectSchema in projects.ts. A type this client doesn't know (or a missing one) still parses.
  • SyncProject declares projectType?: string. ProjectDetail inherits it.

Behavior change

A projectType that is present but not a string now fails listAllProjects, getProjectDetail, and setDataAppPublished with a 502 (Invalid Deepnote response for …). The v2 API spec types the field as a required, non-null string, so real responses aren't affected. setDataAppPublished validates its response after the PATCH, as it already does for every other project field.

Tests

In packages/cloud/src/sync.test.ts:

  • Type reporting: listAllProjects reports a known type, an unknown type (future-type), and a missing type. Narrowing the schema to the five spec values fails this test.
  • Non-string rejection: listAllProjects rejects a numeric projectType. This test fails against the previous schema.
  • Typed reads: the tests read .projectType off both SyncProject and ProjectDetail, so pnpm typecheck fails if either type loses the field.

The v2 projects API already returns `projectType`, and `listAllProjects` and
`getProjectDetail` passed it through at runtime, but `SyncProject` did not
declare it, so consumers had to widen the type to read it.

`syncProjectSchema` now validates the field as an optional plain string, like
`projectSchema` in projects.ts, so an unknown or missing type still parses.
A non-string value now fails the list, detail, and data app update responses
with a 502.

Closes #649
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.23%. Comparing base (6aa7008) to head (289ed7f).

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #651    +/-   ##
========================================
  Coverage   91.23%   91.23%            
========================================
  Files         233      233            
  Lines       13506    13506            
  Branches     3857     3738   -119     
========================================
  Hits        12322    12322            
  Misses       1181     1181            
  Partials        3        3            

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tkislan

tkislan commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The sync project response schema now accepts an optional string projectType, and SyncProject exposes that property. Tests cover string values, missing values, rejection of a non-string list value, and the project type returned by getProjectDetail.

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

Suggested reviewers: jamesbhobbs

Merge Risk: Minimal · up to 289ed

This adds an optional project type field to cloud sync project responses. Existing responses without the field keep working, and invalid non-string values are rejected. The risk of merging is minimal.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed Title states the main change: an optional projectType is declared on SyncProject in @deepnote/cloud. It matches the diff, which adds projectType?: string to SyncProject and to syncProjectSchema.
Description check Passed Description is on-topic. It explains that listAllProjects and getProjectDetail already return projectType, that SyncProject now declares it, the schema change, the 502 behavior change for non-string v…
Linked Issues check Passed Issue #649 requires (1) projectType declared as optional string on SyncProject so listAllProjects and getProjectDetail results type-check as string | undefined, (2) unknown string values and…
Out of Scope Changes check Passed The PR changes two files per the supplied summaries: packages/cloud/src/sync.ts (+2 lines: the schema field and the SyncProject property) and packages/cloud/src/sync.test.ts (+30 lines of tests …
Updates Docs Passed The PR changes two files: packages/cloud/src/sync.ts and packages/cloud/src/sync.test.ts. It adds an optional projectType field to syncProjectSchema and SyncProject. No Markdown file in this…
Full details: Description check

Explanation

Description is on-topic. It explains that listAllProjects and getProjectDetail already return projectType, that SyncProject now declares it, the schema change, the 502 behavior change for non-string values, and the added tests.

Full details: Linked Issues check

Explanation

Issue #649 requires (1) projectType declared as optional string on SyncProject so listAllProjects and getProjectDetail results type-check as string | undefined, (2) unknown string values and missing values accepted, and (3) a non-string projectType rejected with ApiError 502 Invalid Deepnote response for list projects. At the reviewed head, packages/cloud/src/sync.ts adds projectType: z.string().optional() to syncProjectSchema and projectType?: string to SyncProject. ProjectDetail extends SyncProject, and projectDetailSchema and updateProjectDataAppResponseSchema build on syncProjectSchema, so they inherit the field. parseJsonResponse throws the required 502 on schema failure. The PR summary reports tests for known, unknown, and missing types, rejection of a numeric type, and typed reads of .projectType on SyncProject and ProjectDetail, which cover the completion criteria. Limitation: the whole-PR text diff for sync.ts and sync.test.ts could not be read (changed blobs unavailable). The test coverage is therefore taken from the supplied summary, not from source inspection. The sync.ts schema and interface were confirmed from the file at head. All requirements are coding requirements; the release and VS Code extension follow-ups are out of scope for this PR.

Full details: Out of Scope Changes check

Explanation

The PR changes two files per the supplied summaries: packages/cloud/src/sync.ts (+2 lines: the schema field and the SyncProject property) and packages/cloud/src/sync.test.ts (+30 lines of tests for listAllProjects and getProjectDetail). Both fall within the issue's stated scope. The PR does not narrow to literal types, change cloud-sync, edit cloud-mock, the README, the version, or the extension. The test diff was not readable directly, so this verdict rests on the summary for the test file.

Full details: Updates Docs

Explanation

The PR changes two files: packages/cloud/src/sync.ts and packages/cloud/src/sync.test.ts. It adds an optional projectType field to syncProjectSchema and SyncProject. No Markdown file in this repository changed. The in-repo docs do not need an update for this change: - packages/cloud/README.md lists listAllProjects and getProjectDetail in a table. Those rows describe endpoints and do not list response fields. The linked issue #649 excludes README edits for this reason. - A search of all *.md files found no reference to projectType in the public docs under docs/. The only projectType mentions are in the packages/cloud/README.md table rows, which describe the createDataAppProject request body and the endpoint behavior. Reminder: I cannot access the private deepnote/deepnote-internal repository. The check asks for the roadmap on its landing page to be updated for this feature. Update that roadmap manually.

Resolution

Manual follow-up: update the roadmap on the landing page of the private deepnote/deepnote-internal repository to reflect the projectType declaration on SyncProject. This check could not verify that repository.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Biome (2.6.3)

packages/cloud/src/sync.test.ts

Biome could not lint this file: configuration resulted in errors. Check the repository's Biome configuration and plugins.

packages/cloud/src/sync.ts

Biome could not lint this file: configuration resulted in errors. Check the repository's Biome configuration and plugins.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 31396453-06ec-48bd-b578-c9d4528378f9
Commits

Reviewing files that changed from the base of the PR and between 6aa7008 and 289ed7f.

Files selected for processing: 2

  • packages/cloud/src/sync.test.ts
  • packages/cloud/src/sync.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@tkislan
tkislan marked this pull request as ready for review November 16, 2026 14:12
@tkislan
tkislan requested a review from a team as a code owner November 16, 2026 14:12
@tkislan
tkislan merged commit 3a726d1 into main Nov 16, 2026
23 checks passed
@tkislan
tkislan deleted the tomaskislan/cloud-sync-project-type branch November 16, 2026 14:39
tkislan added a commit to deepnote/vscode-deepnote that referenced this pull request Nov 24, 2026
* chore(deps): bump @deepnote/cloud to 0.5.0

0.5.0 declares projectType on SyncProject (deepnote/deepnote#651), so the
publish flow no longer needs its own widened ListedProject type.

* chore(deps): bump @deepnote/cloud-sync to 0.4.0 and @deepnote/cli to 0.13.0

Both re-pin @deepnote/cloud 0.5.0, so the lockfile keeps a single copy of
it instead of nesting 0.4.0 under cloud-sync, cli and local-runner.
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.

Declare projectType on @deepnote/cloud's SyncProject

2 participants