Skip to content

fix(cloud-sync): drop CLI flag hints from library messages - #579

Merged
tkislan merged 9 commits into
mainfrom
tomaskislan/blu-6511-cloud-sync-messages-no-cli-flags
Oct 20, 2026
Merged

tkislan merged 9 commits into
mainfrom
tomaskislan/blu-6511-cloud-sync-messages-no-cli-flags

Conversation

@tkislan

@tkislan tkislan commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #578

Summary

publishApp and syncWorkspace in @deepnote/cloud-sync returned or threw messages that told the caller to pass CLI flags (--no-sync-root, --prune, --url) or named them (--path, --all-files). A library caller has no flags; they set options such as syncRoot: false, prune: true or baseUrl.

The library now ends those messages before the hint, marks the condition with a typed code, and returns the option change that resolves it as a structured OptionHint. deepnote publish and deepnote sync translate each hint into its flag, so the CLI keeps recommending the same arguments.

Changes

@deepnote/cloud-sync

Situation Reported as Message now code Hint
publishApp cannot use the sync folder (for example, the sync manifest cannot be read) PublishError, reason invalid-input the underlying error message, no suffix 'sync-root-unusable' PublishError.hint: syncRoot: false
publishApp gets an explicit syncRoot whose manifest does not track the project, or whose project directory is missing PublishError, reason invalid-input stops after its first sentence 'project-not-in-sync-root' PublishError.hint: syncRoot: false
syncWorkspace with allFiles and without prune keeps working files that were deleted in Deepnote warning event ends after the file list 'deleted-files-kept' the event's hint: prune: true
syncWorkspace finds a tracked project that is gone from the cloud, with prune off, and keeps the local copy missing-in-cloud project outcome no longer in the cloud; kept locally none the outcome's hint: prune: true
The same, with prune on, and the local copy is removed pruned project outcome no longer in the cloud; removed locally none none: nothing for the caller to change

A hint names a property of the options object of the call that reported it, and the value that resolves the condition. The library never names a CLI flag.

  • New exports: PublishErrorCode ('sync-root-unusable' | 'project-not-in-sync-root'), OptionHint ({ option: 'syncRoot'; value: false } | { option: 'prune'; value: true }), and PublishErrorHint, the type of PublishError.hint for a given code.
  • Errors: PublishError takes an optional third code argument and derives hint from it. PublishMirrorError's constructor is now (message: string, code?: PublishErrorCode); it no longer accepts Error's options argument. publishApp copies code when it rethrows.
  • Events and outcomes: the warning SyncEvent gains optional code and hint, and ProjectSyncOutcome gains an optional hint.
  • Reworded messages: three messages that only named a flag no longer do. See What differs from main.
  • Docs: the filesDownloaded / filesUploaded JSDoc now says allFiles instead of --all-files, and the README has a new "Messages and CLI hints" section.

deepnote CLI

  • cliFlagFor in packages/cli/src/utils/option-hint.ts is the only place option names become flags.
  • publish appends a sentence built from the hint's flag to the error before reporting it. Exit codes are unchanged.
  • sync folds the hint into the project outcome's detail and drops the hint key, so the -o json document keeps its shape and key order. The kept-files warning gets its extra sentence only when the event carries a hint.
  • sync no longer infers the --prune hint from its own option. When --prune keeps a local copy because a current cloud project uses the same path, the outcome carries no hint and the CLI adds none, as before.

CLI output: before and after

Stdout, stderr and -o json are the same as on main, except for the three messages under What differs from main.

What stays the same

The library no longer emits these flags, so the CLI adds them back from the hint. <error> stands for the library's message.

Command Situation Output, before and after
deepnote publish the sync folder cannot be used <error> Pass --no-sync-root to publish without updating the workspace.
deepnote publish --sync-root <dir> the manifest in <dir> does not track the project The sync manifest at <dir>/.deepnote-sync.json does not track project p1. Sync the workspace first, or pass --no-sync-root to publish without updating it.
deepnote publish --sync-root <dir> the manifest tracks the project in Alpha, but that directory is missing The sync manifest at <dir>/.deepnote-sync.json tracks project p1 in Alpha, but that directory does not exist. Sync the workspace first, or pass --no-sync-root to publish without updating it.
deepnote sync --all-files a file deleted in Deepnote is kept locally (warning) 1 file in "Alpha" deleted in Deepnote but kept locally: a.txt. Run sync --prune to remove them; pushing an edited copy restores that file in Deepnote.
deepnote sync a project is gone from the cloud and its local copy is kept ? missing Team/Alpha — no longer in the cloud; kept locally (use --prune to remove)
deepnote sync --prune a project is gone from the cloud and its local copy is removed ✕ pruned Team/Alpha — no longer in the cloud; removed locally (--prune)
deepnote sync --prune a project is gone from the cloud, but a current project uses its path ? missing Team/Alpha — no longer in the cloud; kept local path used by a current cloud project

What differs from main

Three messages no longer name a flag, and the CLI does not add one back.

Command Situation Before After
deepnote publish --path elsewhere/x the target path is outside _deepnote_static --path must be _deepnote_static or a directory below it Target path must be _deepnote_static or a directory below it
deepnote sync --all-files a working-directory file is larger than 100 MiB Project file "x" exceeds the 100 MiB --all-files limit. Project file "x" exceeds the 100 MiB working-file transfer limit.
deepnote sync --prune prune is refused because no project in the sync manifest matches the cloud workspace The API token or --url may point to a different workspace… The API token or API URL may point to a different workspace…

The first one is less specific for CLI users than before: it no longer points at --path.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VEcD7PPguvSkpmDm77ADFa

Summary by CodeRabbit

  • Bug Fixes
    • Publish errors now provide clearer guidance for missing, invalid, or mismatched sync roots.
    • Sync warnings and outcomes explain when --prune can remove locally kept projects or files, and when pruning has already occurred.
    • Updated messages use general option names rather than CLI-specific flags where appropriate.
  • Documentation
    • Expanded API guidance on interpreting error codes, sync outcomes, and available option hints.

@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown

BLU-6511

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (60b744f) to head (e785fd1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #579      +/-   ##
==========================================
+ Coverage   90.47%   90.49%   +0.02%     
==========================================
  Files         216      217       +1     
  Lines       12619    12650      +31     
  Branches     3534     3542       +8     
==========================================
+ Hits        11417    11448      +31     
  Misses       1199     1199              
  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 changed the base branch from main to tomaskislan/blu-6512-deepnote-publish-deletes-the-live-copy-of-a-file-over-100 October 14, 2026 10:49
Base automatically changed from tomaskislan/blu-6512-deepnote-publish-deletes-the-live-copy-of-a-file-over-100 to main October 14, 2026 11:35
tkislan and others added 4 commits October 14, 2026 11:38
publishApp and syncWorkspace told library callers to pass CLI flags
(--no-sync-root, --prune, --url) or named them (--path, --all-files).
Callers have no flags; they need syncRoot: false, prune: true or baseUrl.

The library now ends those messages before the hint and marks the
condition in a field instead:
- PublishError (and PublishMirrorError) carry an optional
  PublishErrorCode: 'sync-root-unusable' | 'project-not-in-sync-root'.
- The kept-deleted-files warning event carries code 'deleted-files-kept'.
- The pruned and missing-in-cloud outcome details no longer mention
  --prune.
- The --path, --all-files and --url wording becomes neutral.

`deepnote publish` and `deepnote sync` add the same hints back, so their
stdout, stderr and -o json output are unchanged except for the three
neutral strings (target path, working-file transfer limit, API URL).

Closes #578

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEcD7PPguvSkpmDm77ADFa
…late

Alongside the codes, the library now says which option resolves each
condition, as an OptionHint ({ option: 'syncRoot', value: false } or
{ option: 'prune', value: true }):
- PublishError.hint, derived from its code
- the deleted-files-kept warning event
- the missing-in-cloud outcome kept because prune is off

The CLI maps a hint to its flag in one place (cliFlagFor) and builds the
same messages as before from it. `deepnote sync` no longer infers the
--prune hint from its own option, and drops the hint from the outcomes
it prints, so `-o json` output is unchanged.
PUBLISH_ERROR_HINTS is `as const satisfies`, PublishError.hint is the
exact PublishErrorHint (exported), cliFlagFor returns the literal flag
for the hint's option, and the CLI's publish sentences take the flag of
their own code. Output is unchanged.

Trim code comments that restated the code.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEcD7PPguvSkpmDm77ADFa
ProjectSyncOutcome is no longer the `-o json` shape: the CLI strips
`hint` and folds its flag into `detail`. The keptDeletedFilesHint doc
spoke of several hints for one sentence. The other three comments
restated the code or the OptionHint and PublishErrorHint contracts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEcD7PPguvSkpmDm77ADFa
@tkislan
tkislan force-pushed the tomaskislan/blu-6511-cloud-sync-messages-no-cli-flags branch from dd89f7a to 43fbae7 Compare October 14, 2026 11:55
tkislan and others added 4 commits October 15, 2026 17:22
…docs

The deleted-files-kept warning is now its own SyncEvent member with a
required prune hint, and ProjectSyncOutcome.hint is the prune hint
only. A syncRoot hint on either carrier no longer compiles, so the CLI
drops its `event.hint` guard and the test for a warning with a code but
no hint, a shape the library cannot emit.

Correct the docs that overstated behavior: pruning a missing-in-cloud
project whose path a live project reuses only drops its manifest record;
pushing an edited kept file raises a working-files-changed conflict
rather than restoring it; PublishMirrorError is rethrown only while the
folder is resolved and reported as mirror-incomplete while updating it.
Drop comments that restated the code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEcD7PPguvSkpmDm77ADFa
The large.bin outcome row and the different-workspace refusal row passed a
copy of the reworded library message through the mocked syncWorkspace and
expected it back, so they could not catch the library returning to the old
flag wording; the cloud-sync tests cover that. The existing 'boom' and
'an Error' rows already cover pass-through, and the large.bin row gave
it.each a second test named "renders a 'error' outcome as its progress line".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEcD7PPguvSkpmDm77ADFa
rejects.toThrow('<string>') passes whenever the thrown message contains the
string, so a flag hint appended to the refusal (for example "Pass --url to
fix.") went unnoticed. toThrow(new Error(...)) requires the exact message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEcD7PPguvSkpmDm77ADFa
@tkislan

tkislan commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 9ad92886-9f53-4396-a640-e53ea762986d
📥 Commits

Reviewing files that changed from the base of the PR and between a75feb0 and e785fd1.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: e914178a-5ade-45c6-85ad-0471d27d090f
📥 Commits

Reviewing files that changed from the base of the PR and between 6d13897 and a75feb0.

📒 Files selected for processing: 15
  • packages/cli/src/commands/publish.test.ts
  • packages/cli/src/commands/publish.ts
  • packages/cli/src/commands/sync.test.ts
  • packages/cli/src/commands/sync.ts
  • packages/cli/src/utils/option-hint.test.ts
  • packages/cli/src/utils/option-hint.ts
  • packages/cloud-sync/README.md
  • packages/cloud-sync/src/index.ts
  • packages/cloud-sync/src/option-hint.ts
  • packages/cloud-sync/src/publish-app.test.ts
  • packages/cloud-sync/src/publish-app.ts
  • packages/cloud-sync/src/publish-mirror.test.ts
  • packages/cloud-sync/src/publish-mirror.ts
  • packages/cloud-sync/src/sync-workspace.test.ts
  • packages/cloud-sync/src/sync-workspace.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.

📝 Walkthrough

Cloud-sync publish errors now expose error codes and option hints. Sync warnings and project outcomes also carry structured hints. The CLI translates those hints into flag guidance for publish errors, sync outcomes, and warnings. Cloud-sync messages use option-neutral wording, and the README documents the available hints and option names.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: jamesbhobbs

Merge Risk: ⚪ Minimal · up to a75fe

No issue requiring a change before merge was identified; the reviewed sync output paths do not duplicate guidance.

Pre-merge checks: Passed 4 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 14 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Updates Docs Inconclusive The OSS documentation is updated. packages/cloud-sync/README.md documents the new error codes, OptionHint values, hints, and CLI translation behavior. The linked private repository and its landing… Verify or update the roadmap on the landing page in deepnote/deepnote-internal to reflect this feature.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title accurately identifies the main change: removing CLI flag hints from cloud-sync library messages.
Linked Issues check Passed Issue #578 coding requirements are met. cloud-sync now uses PublishErrorCode, OptionHint, warning codes, and outcome hints. The library messages use option-neutral wording. publish and sync …
Out of Scope Changes check Passed The changes stay within Issue #578. Source changes implement structured library hints, neutral messages, and CLI translation. Tests and documentation verify and explain those changes. No unrelated beh…
Full details: Linked Issues check

Explanation

Issue #578 coding requirements are met. cloud-sync now uses PublishErrorCode, OptionHint, warning codes, and outcome hints. The library messages use option-neutral wording. publish and sync translate hints back to CLI flags. The focused diffs show the required publish and sync behavior. Tests and README documentation cover the new codes, hints, messages, and CLI output.

Full details: Out of Scope Changes check

Explanation

The changes stay within Issue #578. Source changes implement structured library hints, neutral messages, and CLI translation. Tests and documentation verify and explain those changes. No unrelated behavior or feature appears in the reviewed change summary or focused diffs.

Full details: Docstring Coverage

Explanation

Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 14 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Full details: Updates Docs

Explanation

The OSS documentation is updated. packages/cloud-sync/README.md documents the new error codes, OptionHint values, hints, and CLI translation behavior. The linked private repository and its landing-page roadmap are unavailable in this run, so that required documentation cannot be verified.

Resolution

Verify or update the roadmap on the landing page in deepnote/deepnote-internal to reflect this feature.

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

Comment @coderabbitai help to get the list of available commands.

@tkislan
tkislan marked this pull request as ready for review October 19, 2026 11:46
@tkislan
tkislan requested a review from a team as a code owner October 19, 2026 11:46
@tkislan
tkislan requested review from dinohamzic and m1so October 20, 2026 13:09
@tkislan
tkislan merged commit 7c1d02f into main Oct 20, 2026
22 checks passed
@tkislan
tkislan deleted the tomaskislan/blu-6511-cloud-sync-messages-no-cli-flags branch October 20, 2026 13:35
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.

@deepnote/cloud-sync messages tell library callers to pass CLI flags

2 participants