Skip to content

spec: Reload File Tree action in Command Palette (#10003)#10025

Open
lonexreb wants to merge 1 commit intowarpdotdev:masterfrom
lonexreb:spec/10003-reload-file-tree-action
Open

spec: Reload File Tree action in Command Palette (#10003)#10025
lonexreb wants to merge 1 commit intowarpdotdev:masterfrom
lonexreb:spec/10003-reload-file-tree-action

Conversation

@lonexreb
Copy link
Copy Markdown
Contributor

@lonexreb lonexreb commented May 4, 2026

Adds a product+tech spec for #10003: a Command Palette action that forces Wildtree to re-scan disk for the active workspace, giving users a deliberate fallback when automatic refresh misses a filesystem change.

Files

  • `specs/GH10003/product.md` (76 lines) — V1 scope, user experience, 8 testable behavior invariants
  • `specs/GH10003/tech.md` (206 lines) — module layout, dispatch, telemetry, end-to-end flow

Total: 282 insertions, 0 deletions. No code changes — this is a spec PR.

Why this is small

The reload paths already exist — `LocalRepoMetadataModel::rebuild_repository` (Git case) and the non-Git snapshot-rebuild path are what the automatic-refresh already invokes when watcher events fire. This spec just adds a manual trigger surface for them: a Command Palette action that calls the existing rebuild via a tiny orchestrator that picks the right path based on `is_git`.

The implementation surface is genuinely small:

  • One `StaticPaletteAction` const in the palette's static-actions registry.
  • One dispatch arm in the palette's selection handler.
  • One new orchestration function (`reload_active_file_tree`) that branches on Git vs non-Git and calls the existing rebuild path.
  • One new telemetry event (`FileTreeReloadInvoked { duration_ms }`).

V1 scope

  • Action label: "Reload File Tree" with aliases "Refresh File Tree", "Reload Wildtree", "Refresh Wildtree" so search hits any of the terms the issue uses interchangeably.
  • Available when a workspace is open; absent otherwise.
  • Works for non-Git directories (the issue's specific motivating case — automatic-refresh sometimes misses changes there).
  • Non-blocking toast confirms success with duration (e.g. "File tree reloaded (47 ms)."); failure toast preserves the existing tree state.
  • New telemetry event with `duration_ms` so adoption + performance can be measured.

Out of V1 (tracked as follow-ups)

  • Default keyboard shortcut binding. Let usage data show whether it's wanted.
  • Per-folder reload scope. Whole-tree is enough for the reported case.
  • Visible refresh button on the tree. Explicitly rejected by the reporter.
  • Investigating the underlying automatic-refresh failure. Orthogonal — the action is needed regardless per the reporter ("this has not been reproduced locally yet, so the underlying automatic-refresh failure is still uncertain. Regardless...").
  • Reload-on-window-focus behavior change. Would need separate UX validation.

Why this spec

Open questions for maintainers

  1. Action label. "Reload File Tree" as canonical with the others as aliases. Confirm at implementation time.
  2. Toast duration display. Always shown (current spec) vs only when ≥ 100 ms. Spec recommends always-shown for unambiguous confirmation.
  3. Per-tree-pane reload. If a workspace can have multiple tree-bearing panes, V1 reloads only the focused one. Confirm if that's correct or if all should reload together.

Happy to iterate further.

Adds product.md and tech.md for issue warpdotdev#10003: a Command Palette action
that forces Wildtree to re-scan disk for the active workspace, giving
users a deliberate fallback when automatic refresh misses a change.

V1 scope:
- New static palette action labeled "Reload File Tree" with aliases
  "Refresh File Tree", "Reload Wildtree", "Refresh Wildtree"
- Dispatches through reload_active_file_tree, which branches on is_git
  to call either LocalRepoMetadataModel::rebuild_repository (Git case)
  or the non-Git snapshot-rebuild path (per the issue's explicit call-out
  that this is needed for non-Git directories)
- Non-blocking toast confirms success with duration; failure toast
  preserves existing tree state
- New FileTreeReloadInvoked telemetry event with duration_ms

Out of V1 (tracked as follow-ups):
- Default keyboard shortcut binding (let usage data drive)
- Per-folder reload scope
- Visible refresh button on the tree itself (explicitly rejected by
  reporter)
- Investigating the underlying automatic-refresh failure (orthogonal
  concern)
- Reload-on-focus behavior change

8 testable behavior invariants. Implementation surface is small:
one static action const, one dispatch arm, one new orchestration
function. Reuses existing rebuild paths the automatic refresh already
exercises — this is purely a manual trigger surface for them.
@cla-bot cla-bot Bot added the cla-signed label May 4, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 4, 2026

@lonexreb

I'm starting a first review of this spec-only pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 4, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This spec PR defines a Command Palette action for manually reloading the File Tree, with product behavior, proposed implementation wiring, telemetry, and tests.

Concerns

  • The central reload contract is not specified against real force-rebuild APIs; the current model paths described by the spec appear to return early once already indexed rather than forcing a rescan.
  • The Command Palette integration plan references static-action and dispatch concepts that do not match the checked-out palette action architecture, so the implementation path is ambiguous.
  • The product UX promises a one-frame visible update, which conflicts with the asynchronous/large-project behavior described in the tech spec.
  • One telemetry test expectation would be flaky for fast reloads.

Found: 1 critical, 2 important, 1 suggestions

Verdict

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread specs/GH10003/product.md
1. User notices the File Tree is out of sync with disk (e.g. after a `rm -rf old-dir/` that doesn't reflect in the tree).
2. User opens the Command Palette (`Cmd+P` / `Ctrl+P`).
3. User types `reload file tree`, `refresh file tree`, or `reload wildtree`. All three queries match the same action via aliasing in the search index.
4. Selecting the action triggers a tree re-scan from disk for the active session's project root. The tree visibly updates within one frame.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] The tree visibly updates within one frame conflicts with the tech spec’s asynchronous and large-project reload paths. Define the UX as non-blocking while the tree updates after the rebuild completes, and specify whether any in-progress feedback is shown.

Comment thread specs/GH10003/tech.md

### 1. New static palette action

**File:** `app/src/search/command_palette/static_actions.rs` (or wherever existing actions like `Reload Settings` are registered — verify at implementation time).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] The checked-in Command Palette uses the action/keybinding data source rather than a static_actions.rs / PaletteActionId registry, so this plan points implementers at nonexistent integration points. Update this section to name the actual binding/action registration and dispatch path, or explicitly specify a new palette data source.

Comment thread specs/GH10003/tech.md
}
```

`rebuild_repository` and `rebuild_from_disk` are conceptual placeholders; the actual function names need to be confirmed at implementation time. The key contract: both paths exist already (they handle the automatic-refresh case); reload simply invokes them on user demand.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 [CRITICAL] The spec’s key contract relies on force-rebuild entry points that are still placeholders; in current code, indexed Git and lazy-loaded non-Git paths return early instead of rebuilding. Specify the real force-reindex API/state transition, including how it replaces the old tree atomically, before implementation.

Comment thread specs/GH10003/tech.md
| 5 (success toast) | unit | dispatch_tests — invoke the action with a healthy workspace, assert `show_toast` is called with a message matching `^File tree reloaded \(\d+ ms\)\.$`. |
| 6 (failure toast + state preserved) | unit | dispatch_tests — invoke the action with a workspace whose root has been unmounted (mock the entry point to return Err); assert the toast surfaces the error and the in-memory snapshot is unchanged. |
| 7 (alias resolution) | unit | static_actions_tests — feed each of `refresh file tree`, `reload wildtree`, `refresh wildtree` to the palette search index, assert all three return the same action ID. |
| 8 (telemetry event) | unit | dispatch_tests — invoke the action, assert `FileTreeReloadInvoked` is emitted with a non-zero `duration_ms`. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 [SUGGESTION] as_millis() can be 0 for fast reloads, so asserting a non-zero duration would be flaky. Require that the event is emitted with a bounded non-negative duration, or use a fake clock in the dispatch test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant