Skip to content

feat: hide items from home's recently run panel - #12572

Merged
rubenfiszel merged 7 commits into
mainfrom
handle-run-hide-items-dropdown
Nov 20, 2026
Merged

rubenfiszel merged 7 commits into
mainfrom
handle-run-hide-items-dropdown

Conversation

@Guilhem-lm

Copy link
Copy Markdown
Contributor

Summary

Each row of Home's Recently run panel gets a menu with Hide item from Recently run. Hidden items are kept per user and per workspace on the server. Their runs are left out of the panel's list and of every count, so the panel and the header status agree. Below the list, a collapsible "N hidden items" section lists them, with Unhide on each and Unhide all.

Changes

  • Migration recent_run_hidden_item (workspace_id, email, kind, path, hidden_at), keyed per user and item, cascading on workspace delete. Admin-only RLS policy as a backstop; the handlers use the raw pool scoped to the caller's own rows.
  • GET /w/{workspace}/jobs/recent_runs drops the caller's hidden items from the runs before counting, so total_runs, failed_runs, failing_items and running_items exclude them even when an item falls past the 50-item cut. It returns them in a new hidden_items field (within the folder filter, with summaries), including items with no run in the window.
  • POST /w/{workspace}/jobs/recent_runs/hide and /unhide take {items: [{kind, path}]}; an unknown kind returns 400.
  • Workspace id change moves the rows to the new id, like favorite.
  • Frontend: a DropdownV2 row menu in the side panel (not in the header status popover, where a dropdown would close it), and RecentRunsHiddenHint, the collapsible hidden list in both the panel and the header status popover. Hiding or unhiding rereads the panel (about 100 ms locally). The cached read's version is bumped for the new field.

Screenshots

Before: the panel has no row menu.

before

Row menu:

menu

Two items hidden, section collapsed (the failed count no longer includes Daily ETL pipeline):

collapsed

Section expanded, with per-item Unhide and Unhide all:

expanded

Header status popover with the panel closed:

header

Test plan

Checked on a local backend with a seeded copy of the dev database:

  • API: hiding f/data/daily_etl_pipeline in acme takes total_runs from 125 to 124 and failed_runs from 2 to 1, and removes the item; hidden_items returns it with its summary, plus a hidden item with no runs; ?folder=billing lists none of them; kind app returns 400; unhide restores everything.
  • A hidden row planted for another email has no effect on admin's view.
  • Renaming a workspace with a hidden row moves the row to the new id, and the renamed workspace still lists the item as hidden.
  • UI: hide from the row menu; the row and its failures leave the panel and the header status; the item stays hidden after a reload; the folder filter shows only that folder's hidden items; Unhide from the panel and from the header popover brings the row and count back.
  • A reviewer hides a script, a flow and an agent, and checks each leaves the counts.

🤖 Generated with Claude Code

Guilhem-lm and others added 4 commits November 20, 2026 06:39
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… counts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: afc6bc2
Status: ✅  Deploy successful!
Preview URL: https://f2c49825.windmill.pages.dev
Branch Preview URL: https://handle-run-hide-items-dropdo.windmill.pages.dev

View logs

@rubenfiszel
rubenfiszel marked this pull request as ready for review November 20, 2026 16:17
@claude

claude Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @rubenfiszel's task in 1m 3s —— View job


cc @Guilhem-lm

Mergeable, but should ideally address nits: hidden items not moved on email rename or cleared on user removal, path longer than 255 chars on /hide returns 500

  • Gather diff and context
  • Review backend
  • Review frontend
  • Post review

Summary

The design holds up. Hidden runs are dropped before counting, so items past the MAX_ITEMS cut still leave the counts. The hide and unhide handlers use the raw pool, but every query is scoped to workspace_id = $1 AND email = authed.email, so a caller can only reach their own rows. The admin-only RLS policy is a sensible backstop. Unknown kinds get a 400 in the handler and are also blocked by the CHECK constraint. The workspace id change moves the rows inside the same transaction, right after favorite. Bumping the frontend cache version for the new hidden_items field is correct.

Findings

  • P2: hidden items are not moved on email rename or cleared on user removal (inline). The table is keyed by email, but the instance email rename in windmill-api-users/src/users.rs (~1965–2122) never touches it. That code moves every other per-email table (tutorial_progress, token, schedule, capture_config, draft, …). After a rename, the user's hidden items come back and the old rows stay orphaned. The workspace user delete clears favorite (users.rs:2633) but not these rows, so a re-added user gets their old hidden list back. Fix this →
  • P2: a path longer than 255 characters on /hide returns 500. path is VARCHAR(255) and hide_recent_run_items only checks kind. A path that is too long fails inside Postgres and comes back as a 500 instead of a 400. It's only reachable with a hand-built request, so this is minor; a length check next to the kind check would cover it.
  • Not a blocker: RecentRunsHeaderStatus.svelte has a stray blank line after <RecentRunsHiddenHint … />. Prettier will normalise it.

AGENTS.md compliance

  • The migration is a proper up/down pair in the expected timestamp format.
  • Comments explain constraints (why runs are dropped before counting, why RLS is a backstop) rather than narrating the code. ✅
  • The queries use runtime sqlx::query, so no .sqlx cache update is needed. ✅
  • openapi.yaml is updated for both new endpoints and the new response field. ✅
  • AGENTS.md asks for feature_usage telemetry to be proposed for new user-facing features. It isn't mentioned here; it's your call whether to add it.

Test coverage

  • Backend: there are no Rust tests for the new handlers or for the filtering in list_recent_runs. One small integration test would be worth keeping as a regression guard. It would hide an item that has a failure and check that total_runs/failed_runs drop and that the item appears in hidden_items. It would also check that a row planted for another email has no effect, since that is the invariant a later refactor of the raw-pool queries could break.
  • Frontend: these are component and state changes only, so no tests are expected.

Manual verification still needed: the unchecked item in the test plan. Hide one script, one flow and one agent from the side panel's row menu. Each should leave the list, and its failures should leave both the panel's counts and the header status badge. Unhide each from the header status popover: the popover should stay open and the row and its counts should come back. Also, with only hidden items in the window, the panel should show the "N hidden items" section and not the "Runs show up here once something runs." message.

-- list and counts for that user only.
CREATE TABLE recent_run_hidden_item (
workspace_id VARCHAR(50) NOT NULL REFERENCES workspace(id) ON DELETE CASCADE,
email VARCHAR(255) NOT NULL,

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.

P2: these rows are keyed by email, but nothing updates them when a user's email changes. The instance-level email rename in backend/windmill-api-users/src/users.rs (around lines 1965–2122, plus draft/draft_move in windmill-common/src/user_drafts.rs) moves every per-email table (tutorial_progress, token, schedule, capture_config, draft, …). After a rename the user's hidden items silently come back, and the old-email rows stay behind as orphans. Something like UPDATE recent_run_hidden_item SET email = $1 WHERE email = $2 next to tutorial_progress would fix it.

Same gap on removal: the workspace user delete clears favorite (users.rs:2633) but not these rows, so a user who is removed and later re-added gets their old hidden list back.

@github-actions

Copy link
Copy Markdown
Contributor

Codex Review

Good to merge

No introduced bugs, security issues, or clear AGENTS.md violations found.

Test coverage

No Rust unit or integration tests were added for hide/unhide, count filtering, or workspace rename. The PR documents manual API and UI checks. Frontend changes add component and state wiring; component tests are not expected.

This was a static review; I did not run tests or exercise the application. The remaining manual check is to hide and restore a script, flow, and agent, confirming their runs leave and reenter the panel and header counts.

@github-actions

Copy link
Copy Markdown
Contributor

Pi Review

cc @Guilhem-lm

Mergeable, but should ideally address nits: hidden items without a summary don't show their path; no automated test for hide/unhide and hidden-counting.

The feature is well scoped: the migration keys rows per (workspace_id, email, kind, path), the raw-pool handlers scope every write to authed.email, and the count/labels all derive from the same filtered runs vec so the panel and header can't disagree. I found no blocking issues.

P2 — RecentRunsHiddenHint.svelte:55-57 — summary-less hidden items show only their basename

<span class="truncate text-[12px] text-secondary">{itemTitle(item)}</span>
{#if item.summary}
    <span class="truncate text-[10.5px]">{item.path}</span>
{/if}

itemTitle falls back to item.path.split('/').pop(), so an item without a summary renders only its basename and the full path is never shown (no title either). Two hidden main scripts in different folders become indistinguishable when the user is deciding what to unhide — the same reason the visible list computes collisionPrefixes. Suggest always rendering the path (or putting it in a title tooltip) rather than gating it on item.summary.

Test coverage

Backend — the PR adds a migration, two new handlers, and reworks list_recent_runs counting, but no new tests. Existing backend/tests/recent_runs_tag_scope.rs exercises list_recent_runs (tag scope, resolved-vs-failure) but not the new surface. The subtle behavior worth pinning is that a hidden item is excluded from all four counts and from items even when it falls past the MAX_ITEMS cut — the comment at jobs_recent_runs.rs:201 describes exactly the regression a test would guard. Recommend an integration test that plants a row, hides a script, and asserts it drops from items/total_runs/failed_runs/failing_items and appears (with the folder filter applied) in hidden_items. hide/unhide themselves are thin inserts/deletes and are covered transitively by such a test.

Frontend — no component tests expected. The new setHidden/hide/unhide logic in recentRuns.svelte.ts is glue around generated API calls with no sibling *.test.ts pattern, so none is expected.

Manual verification — the PR's test plan already covers API hide/unhide/folder-filter and UI hide/unhide across panel and header. The one open checkbox (hide a script, a flow, and an agent, and confirm each leaves the counts) is the remaining manual step; the agent case is the one most worth doing, since its runs are flowpreview rows remapped to kind = 'agent', and the match against a stored agent row is the least obvious pairing.

Considered and dismissed

  • No workspace-membership check on /recent_runs/hide and /unhide — dismissed. They follow favorite::star/unstar exactly (raw pool, scoped to the caller's own identity); rows are keyed by authed.email, so a non-member can only write rows for their own email in a workspace they cannot read, exposing nothing.
  • unhide does not validate kind — dismissed. An invalid kind makes the DELETE … USING unnest a no-op; hide already returns 400 for unknown kinds.
  • path is caller-controlled and not length/NUL validated — dismissed. All binds are parameterized (no injection/traversal), the column is VARCHAR(255), and the worst case is a 500 against the caller's own rows — same as favorite.
  • capped is computed before the hidden filter — dismissed. It describes the underlying scan cap, so the total_runs+ suffix stays accurate after hiding.
  • Runtime sqlx::query in workspaces_extra.rs:450 instead of query! — dismissed. The SQL is trivial and correct, and the runtime form avoids adding a .sqlx entry for the new table; not a bug.
  • RLS grants ALL to windmill_user but only an admin_policy — dismissed. windmill_admin carries BYPASSRLS (init-db-as-superuser.sql), the handlers use the raw pool, and the windmill_user denial is the documented backstop in the migration comment.

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

Copy link
Copy Markdown
Contributor

Codex Review

Good to merge

No confident introduced bugs, security issues, or clear AGENTS.md violations found. The latest commit addresses the earlier cleanup, path-length, and hidden-path display findings.

Test coverage

No Rust unit or integration tests were added for hide/unhide, hidden-run counting, or lifecycle cleanup. Existing recent-run tests cover tag scoping and resolved failures. Frontend changes are component and state wiring; component tests are not expected.

The PR reports manual API, UI, and workspace-rename checks. I performed static review and ran git diff --check, which passed; I did not run application tests or exercise the UI.

Complete the open checklist by hiding and unhiding a script, flow, and agent, confirming their runs leave and return to both panel and header counts. Also exercise the latest lifecycle changes: hidden items should survive an email rename and clear after workspace-user removal and re-addition.

@github-actions

Copy link
Copy Markdown
Contributor

Pi Review

cc @Guilhem-lm

Mergeable, but should ideally address nits: no automated test for hide/unhide and the hidden-count exclusion.

The three prior findings are all correctly addressed. Verifying each fix:

  • Email rename (backend/windmill-api-users/src/users.rs:2070-2081): the DELETE … WHERE email = $new then UPDATE … old → new pair matches the tutorial_progress/usage merge pattern immediately above it, so a rename carries the rows over and drops any stale rows the new address already held. Correct.
  • Workspace user removal (users.rs:2655): deletes the user's rows for the workspace, mirroring the favorite cleanup a few lines above it. Correct.
  • Path length (backend/windmill-api/src/jobs_recent_runs.rs:327): chars().count() > 255 returns a 400 before the insert, matching the VARCHAR(255) column's character count. Correct.
  • Summary-less hidden items (RecentRunsHiddenHint.svelte): the path is now always rendered with a title tooltip, so two hidden main scripts in different folders are distinguishable. Correct.

No new blockers are introduced by these commits.

P2 — no automated test for hide/unhide and the hidden-count exclusion (backend/windmill-api/src/jobs_recent_runs.rs:201)

Still no test covers the subtle invariant described at that comment: a hidden item is dropped before counting, so it leaves total_runs/failed_runs/failing_items/running_items even when it falls past the MAX_ITEMS cut, and appears (with the folder filter applied) in hidden_items. backend/tests/recent_runs_tag_scope.rs exercises list_recent_runs but not this. A small integration test that plants a row, hides a script, and asserts the counts drop and hidden_items contains the item would pin the raw-pool queries against a future refactor.

Test coverage

Backend — new migration, two new handlers, and reworked list_recent_runs counting, with no new Rust or integration tests (see P2 above). The change_user_email and delete_workspace_user_internal additions do run through the existing test_change_user_email suite in backend/windmill-api-integration-tests/tests/users.rs, so those paths are exercised even though hidden-item behavior isn't asserted.

Frontend — component and state wiring only (DropdownV2 menu, RecentRunsHiddenHint, the setHidden glue); no component tests are expected for this layer.

Migration — a proper up/down pair with an RLS backstop and ON DELETE CASCADE; no automated tests expected for migrations here.

Manual verification still needed — the one unchecked item in the test plan: hide a script, a flow, and an agent from the side panel's row menu, and confirm each leaves the list and the counts in both the panel and the header status popover. The agent case is the most worth doing, since its runs are flowpreview rows remapped to kind = 'agent' and the match against a stored agent hidden row is the least obvious pairing. Also confirm unhide from the header popover restores the row and counts.

Considered and dismissed

  • Full instance delete_user leaves orphaned recent_run_hidden_item rows — dismissed: delete_user likewise does not clear tutorial_progress, schedule, or capture_config, so this matches the existing per-email-table pattern; a later rename is handled by the new change_user_email merge.
  • No workspace-membership check on /recent_runs/hide and /unhide — dismissed: identical to favorite::star/unstar (raw pool, every row scoped to authed.email); a non-member can only write rows for their own identity in a workspace they cannot read.
  • unhide validates neither kind nor path length — dismissed: an unknown kind or over-long path simply makes the DELETE … USING unnest a no-op; hide already 400s on both.
  • capped computed before the hidden filter — dismissed: it describes the underlying scan cap, so the total_runs+ suffix stays accurate after hiding.
  • hidden HashSet<(&str,&str)> borrow vs the later hidden_items.iter_mut() — dismissed: hidden is dead after the filter/collect, so NLL allows the mutable iteration.
  • DropdownV2 menu inside the clickable row — dismissed: the trigger button stops propagation and the menu is portaled to the overlay host, so selecting "Hide item" does not also navigate.

rubenfiszel and others added 2 commits November 20, 2026 17:59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rubenfiszel
rubenfiszel merged commit 64995fa into main Nov 20, 2026
16 of 19 checks passed
@rubenfiszel
rubenfiszel deleted the handle-run-hide-items-dropdown branch November 20, 2026 17:04
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants