Skip to content

Conversation

@dinohamzic
Copy link
Member

@dinohamzic dinohamzic commented Oct 30, 2025

Fixes #5031

Screen.Recording.2025-10-31.at.11.21.18.mov

Summary by CodeRabbit

  • New Features

    • Loading indicator "Scanning for Deepnote projects..." shown during initial project discovery.
    • Loading entries displayed while project scan is in progress.
  • Improvements

    • "Reveal in Explorer" disabled for items while they are loading.
    • Welcome pane for Deepnote Explorer now appears only after the initial scan completes.
    • Refresh resets discovery so the loading indicator reappears until scanning completes.
  • Tests

    • Added tests for loading state, initial scan lifecycle, refresh behavior, and transitions.

@dinohamzic dinohamzic self-assigned this Oct 30, 2025
@linear
Copy link

linear bot commented Oct 30, 2025

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2025

📝 Walkthrough

Walkthrough

Adds an initial asynchronous scan lifecycle to the Deepnote tree provider that shows a Loading tree item ("Scanning for Deepnote projects...") until the scan completes. Introduces a new Loading DeepnoteTreeItem type (its data can be null) and a cached initialScanPromise with isInitialScanComplete flags. refresh() resets initial-scan state and updates VS Code context deepnote.explorerInitialScanComplete. package.json changes: revealInExplorer now requires viewItem != loading, and the deepnoteExplorer welcome item gains when: deepnote.explorerInitialScanComplete. Unit tests added for loading/scan/refresh flows and Loading item behavior.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TreeView as Deepnote TreeView
    participant Provider as DeepnoteTreeDataProvider

    User->>TreeView: open or refresh view
    TreeView->>Provider: getChildren(undefined)

    alt initial scan incomplete
        Provider->>Provider: start performInitialScan() (store initialScanPromise)
        Provider->>TreeView: return [Loading item]
        TreeView->>User: render "Scanning for Deepnote projects..."
        par background
            Provider->>Provider: performInitialScan() loads projects
            Provider->>Provider: set isInitialScanComplete = true
            Provider->>TreeView: fire refresh event
        end
        TreeView->>Provider: getChildren(undefined) (after refresh)
        Provider->>TreeView: return [Project items]
        TreeView->>User: render projects
    else initial scan complete
        Provider->>TreeView: return [Project items]
        TreeView->>User: render projects
    end

    User->>TreeView: trigger "Reveal in Explorer"
    alt selected item is Loading
        Note right of TreeView: action disabled by `viewItem != loading`
        TreeView-->>User: action unavailable
    else selected item not Loading
        TreeView->>User: reveal in Explorer
    end
Loading

Possibly related PRs

Suggested reviewers

  • saltenasl
  • andyjakubowski
  • jamesbhobbs

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "feat: loading state on startup" directly describes the primary change across the changeset. The modifications implement a loading indicator that appears during the initial scan of the Deepnote explorer on startup—adding a Loading tree item type, displaying "Scanning for Deepnote projects..." while the scan completes, and updating context guards to control visibility. The title is concise, specific, and accurately reflects the main objective without being misleading or vague.

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

@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

❌ Patch coverage is 77.00000% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 72%. Comparing base (f564456) to head (f15975f).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/notebooks/deepnote/deepnoteTreeDataProvider.ts 30% 14 Missing ⚠️
...oks/deepnote/deepnoteTreeDataProvider.unit.test.ts 83% 3 Missing and 6 partials ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #142   +/-   ##
=====================================
  Coverage     72%     72%           
=====================================
  Files        545     545           
  Lines      41795   41889   +94     
  Branches    5049    5058    +9     
=====================================
+ Hits       30447   30518   +71     
- Misses      9666    9683   +17     
- Partials    1682    1688    +6     
Files with missing lines Coverage Δ
src/notebooks/deepnote/deepnoteTreeItem.ts 100% <100%> (ø)
...c/notebooks/deepnote/deepnoteTreeItem.unit.test.ts 100% <100%> (ø)
...oks/deepnote/deepnoteTreeDataProvider.unit.test.ts 88% <83%> (-5%) ⬇️
src/notebooks/deepnote/deepnoteTreeDataProvider.ts 23% <30%> (+1%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dinohamzic dinohamzic force-pushed the dinohamzic/grn-5031-loading-state-on-startup branch from b1c1bcb to ba17d87 Compare October 30, 2025 17:13
@dinohamzic dinohamzic force-pushed the dinohamzic/grn-5031-loading-state-on-startup branch from ba17d87 to 6fe639b Compare October 30, 2025 17:20
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 30, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 31, 2025
@dinohamzic dinohamzic force-pushed the dinohamzic/grn-5031-loading-state-on-startup branch from 12fd98f to feb25af Compare October 31, 2025 08:28
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 12fd98f and feb25af.

📒 Files selected for processing (2)
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2 hunks)
  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts
**/*.unit.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place unit tests in files matching *.unit.test.ts

**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts
🧬 Code graph analysis (2)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (1)
src/notebooks/deepnote/deepnoteTreeDataProvider.ts (1)
  • DeepnoteTreeDataProvider (22-236)
src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts (1)
src/notebooks/deepnote/deepnoteTreeItem.ts (2)
  • DeepnoteTreeItemContext (16-20)
  • DeepnoteTreeItem (25-107)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build & Test
🔇 Additional comments (1)
src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts (1)

583-600: LGTM.

Properly validates loading item creation with null data and correct properties.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

♻️ Duplicate comments (1)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (1)

172-202: Conditional assertion still too permissive.

Lines 192-197 use nested conditionals similar to the past review comment. After refresh(), deterministically assert that childrenAfterRefresh[0].type === Loading (accounting for workspace presence), rather than optional checks.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between feb25af and 88eaf09.

📒 Files selected for processing (1)
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.unit.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place unit tests in files matching *.unit.test.ts

**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
🧬 Code graph analysis (1)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2)
src/notebooks/deepnote/deepnoteTreeDataProvider.ts (1)
  • DeepnoteTreeDataProvider (22-236)
src/notebooks/deepnote/deepnoteTreeItem.ts (1)
  • DeepnoteTreeItem (25-107)
🔇 Additional comments (1)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (1)

245-263: Well-structured test.

Correctly verifies that child element lookups never return loading items. Clean mock setup and deterministic assertion.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (3)

101-115: Missing transition verification.

Test claims to verify "complete initial scan and show projects after loading" but doesn't assert loading item appears initially or disappears after scan.

Add assertions for state transition:

         test('should complete initial scan and show projects after loading', async () => {
             const newProvider = new DeepnoteTreeDataProvider();
             const loadingChildren = await newProvider.getChildren();
             assert.isArray(loadingChildren);
+            // Verify loading state on first call (if workspace exists)
+            if (loadingChildren.length > 0) {
+                assert.strictEqual(loadingChildren[0].type, DeepnoteTreeItemType.Loading);
+            }
 
             await new Promise((resolve) => setTimeout(resolve, 10));
 
-            // Second call should show actual projects (or empty array if no projects)
             const actualChildren = await newProvider.getChildren();
             assert.isArray(actualChildren);
+            // Verify loading item is gone
+            const hasLoading = actualChildren.some((item) => item.type === DeepnoteTreeItemType.Loading);
+            assert.isFalse(hasLoading, 'Loading item should not appear after scan');
 
             if (newProvider && typeof newProvider.dispose === 'function') {
                 newProvider.dispose();
             }
         });

163-184: Doesn't verify loading state after refresh.

Test claims to reset initial scan state but doesn't assert loading item reappears after refresh.

Add assertion after refresh:

             // Call refresh to reset state - this exercises the refresh logic
             newProvider.refresh();
 
-            // After refresh - should work without errors
             const childrenAfterRefresh = await newProvider.getChildren();
             assert.isArray(childrenAfterRefresh);
+            // Verify loading state is shown again (if workspace exists)
+            if (childrenAfterRefresh.length > 0) {
+                assert.strictEqual(childrenAfterRefresh[0].type, DeepnoteTreeItemType.Loading);
+            }
 
             if (newProvider && typeof newProvider.dispose === 'function') {
                 newProvider.dispose();
             }
         });

88-99: Test name doesn't match implementation.

Claims to verify "loading item on first call with correct properties" but only asserts an array is returned. No verification of loading item type, properties, or presence.

Either mock workspace folders to ensure deterministic loading behavior and add assertions:

-        test('should return loading item on first call with correct properties', async () => {
+        test('should return loading item on first call with correct properties', async () => {
             const newProvider = new DeepnoteTreeDataProvider();
 
-            // First call - just verify it returns an array and doesn't throw
             const children = await newProvider.getChildren();
             assert.isArray(children);
-            // In test environment, may return empty or loading based on timing
+            
+            // Verify loading item is present
+            assert.isAtLeast(children.length, 1, 'Should return at least loading item');
+            assert.strictEqual(children[0].type, DeepnoteTreeItemType.Loading);
+            assert.strictEqual(children[0].contextValue, 'loading');
 
             if (newProvider && typeof newProvider.dispose === 'function') {
                 newProvider.dispose();
             }
         });

Or rename to match actual behavior:

-        test('should return loading item on first call with correct properties', async () => {
+        test('should not throw on first getChildren call', async () => {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 88eaf09 and 5c8b794.

📒 Files selected for processing (1)
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.unit.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place unit tests in files matching *.unit.test.ts

**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
🧬 Code graph analysis (1)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2)
src/notebooks/deepnote/deepnoteTreeDataProvider.ts (1)
  • DeepnoteTreeDataProvider (22-236)
src/notebooks/deepnote/deepnoteTreeItem.ts (1)
  • DeepnoteTreeItem (25-107)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5c8b794 and ee5b17e.

📒 Files selected for processing (2)
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2 hunks)
  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.unit.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place unit tests in files matching *.unit.test.ts

**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Files:

  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
🧬 Code graph analysis (2)
src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts (1)
src/notebooks/deepnote/deepnoteTreeItem.ts (2)
  • DeepnoteTreeItemContext (16-20)
  • DeepnoteTreeItem (25-107)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2)
src/notebooks/deepnote/deepnoteTreeDataProvider.ts (1)
  • DeepnoteTreeDataProvider (22-236)
src/notebooks/deepnote/deepnoteTreeItem.ts (1)
  • DeepnoteTreeItem (25-107)
🔇 Additional comments (3)
src/notebooks/deepnote/deepnoteTreeItem.unit.test.ts (2)

583-600: LGTM!

Test correctly validates loading item construction with null data and appropriate properties.


602-626: Verification complete.

Test now properly asserts that initialization was skipped—tooltip, iconPath, and description remain undefined, label defaults to empty string. Addresses the previous review comment.

src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (1)

220-245: Well-verified.

Test properly asserts absence of loading items by checking both type (line 237) and label (lines 241-243). Addresses previous review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ee5b17e and 440cf59.

📒 Files selected for processing (2)
  • package.json (1 hunks)
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.unit.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place unit tests in files matching *.unit.test.ts

**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
🧬 Code graph analysis (1)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2)
src/notebooks/deepnote/deepnoteTreeDataProvider.ts (1)
  • DeepnoteTreeDataProvider (22-236)
src/notebooks/deepnote/deepnoteTreeItem.ts (1)
  • DeepnoteTreeItem (25-107)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build & Test
🔇 Additional comments (3)
package.json (1)

1442-1442: LGTM!

Guards reveal command from loading placeholders. Prevents user confusion.

src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2)

163-206: Environment-dependent assertions acceptable here.

Test properly verifies refresh resets to initial state by comparing lengths and conditionally checking loading item reappears. Conditional logic is reasonable given test environment constraints.


242-267: Solid test with proper assertions.

Correctly verifies loading items don't appear when querying project children. Clear setup, targeted assertions for both type and label.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/notebooks/deepnote/deepnoteTreeDataProvider.ts (1)

57-70: Keep the welcome view visible with empty workspaces.

When no workspace folders are open, getChildren returns early and the new initial-scan context never flips to true, so the welcome view (now gated by deepnote.explorerInitialScanComplete) stays hidden. Users land on a blank explorer in that scenario. Mark the scan complete before returning so the welcome view still renders.

         if (!workspace.workspaceFolders || workspace.workspaceFolders.length === 0) {
-            return [];
+            if (!this.isInitialScanComplete) {
+                this.isInitialScanComplete = true;
+                this.updateContextKey();
+            }
+
+            return [];
         }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 440cf59 and 4a84bdd.

📒 Files selected for processing (2)
  • package.json (2 hunks)
  • src/notebooks/deepnote/deepnoteTreeDataProvider.ts (6 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.ts
🧬 Code graph analysis (1)
src/notebooks/deepnote/deepnoteTreeDataProvider.ts (2)
src/notebooks/deepnote/deepnoteTreeItem.ts (1)
  • DeepnoteTreeItem (25-107)
src/test/mocks/vsc/extHostedTypes.ts (1)
  • ThemeIcon (2094-2104)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build & Test

@dinohamzic dinohamzic marked this pull request as ready for review October 31, 2025 10:50
@dinohamzic dinohamzic requested a review from a team as a code owner October 31, 2025 10:50
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2)

220-237: Weak assertions for multiple-call scenario.

Test name implies verification of how multiple calls are handled but only checks arrays are returned. Doesn't verify state transitions or idempotency.

Add assertions about loading state behavior:

             // Second call
             const secondResult = await newProvider.getChildren(undefined);
             assert.isArray(secondResult);
+            
+            // Verify behavior: either both show loading (if scan incomplete)
+            // or both show same results (if scan complete)
+            const firstIsLoading = firstResult.length > 0 && firstResult[0].contextValue === 'loading';
+            const secondIsLoading = secondResult.length > 0 && secondResult[0].contextValue === 'loading';
+            
+            if (firstIsLoading) {
+                // If first call returned loading, scan might still be running
+                // Second call should eventually show real results or still loading
+                assert.isTrue(
+                    secondIsLoading || secondResult.length === 0,
+                    'Multiple calls should handle loading state consistently'
+                );
+            }

207-218: Test doesn't verify claimed behavior.

Test claims to "execute loading logic" but only asserts an array is returned. Doesn't verify loading logic ran or that loading state was entered.

Either rename to match actual behavior: "should not throw when calling getChildren at root level", or add assertions:

             const children = await newProvider.getChildren(undefined);
             assert.isArray(children);
-            // In test environment may be empty or have loading item depending on timing
+            
+            // In test environment without workspace, returns empty array
+            // With workspace, should exercise loading code path
+            if (children.length > 0) {
+                assert.strictEqual(children[0].contextValue, 'loading', 'Should show loading item on first call');
+            }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4a84bdd and 6a974be.

📒 Files selected for processing (2)
  • src/notebooks/deepnote/deepnoteTreeDataProvider.ts (6 hunks)
  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeDataProvider.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeDataProvider.ts
**/*.unit.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place unit tests in files matching *.unit.test.ts

**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts
  • src/notebooks/deepnote/deepnoteTreeDataProvider.ts
🧬 Code graph analysis (2)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (2)
src/notebooks/deepnote/deepnoteTreeDataProvider.ts (1)
  • DeepnoteTreeDataProvider (24-245)
src/notebooks/deepnote/deepnoteTreeItem.ts (1)
  • DeepnoteTreeItem (25-107)
src/notebooks/deepnote/deepnoteTreeDataProvider.ts (2)
src/notebooks/deepnote/deepnoteTreeItem.ts (1)
  • DeepnoteTreeItem (25-107)
src/test/mocks/vsc/extHostedTypes.ts (1)
  • ThemeIcon (2094-2104)
🔇 Additional comments (10)
src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts (3)

2-2: LGTM!

Import needed for loading label verification at line 261.


89-112: LGTM!

Both tests serve as valid sanity checks with accurate names matching their assertions.


239-264: LGTM!

Good test with meaningful assertions. Properly verifies that child lookups don't produce loading items by checking both type and label.

src/notebooks/deepnote/deepnoteTreeDataProvider.ts (7)

10-13: LGTM!

All imports needed for loading state implementation.


32-33: LGTM!

Fields properly track initial scan lifecycle.


37-37: LGTM!

Initializes context key state on construction.


47-49: LGTM!

Refresh properly resets scan state for reload.


63-70: LGTM!

Loading logic correctly:

  • Caches scan promise to prevent duplicates
  • Returns loading item during scan
  • Relies on tree refresh after scan completes

82-103: LGTM!

Both helpers correctly implement loading item creation and async scan lifecycle. Localization and error handling properly addressed.


242-244: LGTM!

Context key update correctly integrated into provider lifecycle. Void operator appropriate for fire-and-forget command.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 31, 2025
@dinohamzic dinohamzic enabled auto-merge (squash) October 31, 2025 11:52
@dinohamzic
Copy link
Member Author

@coderabbitai approve

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

✅ Actions performed

Comments resolved and changes approved.

@dinohamzic dinohamzic merged commit 5d7cb11 into main Oct 31, 2025
13 checks passed
@dinohamzic dinohamzic deleted the dinohamzic/grn-5031-loading-state-on-startup branch October 31, 2025 11:53
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.

3 participants