Skip to content

fix(platform): invalidate home lists on project hints - #4162

Merged
yannickmonney merged 1 commit into
mainfrom
fix/home-project-invalidation
Oct 4, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
fix/home-project-invalidation

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

What changed

  • Invalidate the organization task and chat-thread query prefixes when a project live-update hint arrives.
  • Extend the existing backend-hints regression to pin project, task, chat-thread, and reviewer invalidation.

This covers project deletion, archival, and restoration because all three writes emit the project hint consumed by Home.

Verification

  • bunx oxfmt --check services/platform/app/lib/backend/use-backend-hints.ts services/platform/app/lib/backend/use-backend-hints.test.tsx — passed.
  • bunx oxlint --type-aware services/platform/app/lib/backend/use-backend-hints.ts services/platform/app/lib/backend/use-backend-hints.test.tsx — passed.
  • Pre-commit hooks — passed: conflict markers, format, and local SAST.
  • Focused Vitest was attempted but could not collect because the filtered install resolves a broken Storybook file: preset and the shared schema fails with z.number undefined before tests start.
  • Platform TypeScript check was attempted but was killed by the 4 GiB host before producing diagnostics.

Finding → test

  • Project hints currently invalidate only project; Home lists are keyed by task and chat_thread → use-backend-hints.test.tsx now asserts both dependent prefixes are invalidated for a project hint.

Closes #4053

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Independent review of PR #4162 at ef69cd480393469623ca55a5b9e65ebf54dade2e: accepted, with one LOW follow-up and one unrun check disclosed.

Source review, cross-checked

  • Every Home list sits under the invalidated prefixes. All backend keys come from backendKey(org, entity, …) = ['backend', org, entity, …] (query-keys.ts:22-36). The prefixes ['backend', org, 'task'] and ['backend', org, 'chat_thread'] therefore cover:
    • Home's task lists (taskBoardScope → 'task', 'across-projects');
    • its chat lists, live and archived;
    • every project board.
  • The project hint reaches the tab that made the change. Hints go org-wide, including the writer's own tab (outbox.ts:10). A delete, archive or restore each emits the project hint, so a single tab refreshes too, not only a second session. The same-tab adapters already refreshed projects and chat threads on delete, but not tasks.
  • Cost: project hints are rare (alignManagedProjectAgent hints only on a change), so the wider invalidation is cheap.

Tests (mine)

Not run (disclosed): the live observations you asked for: Home without a reload across cascade or detach deletion, archive and restore, the same tab and a second session, and the single-task-delete timing control. They need a full local stack, and the fleet's disk rule allows no new install this occurrence. The mapping above is structural, since every list key is built by the same helper, and the unit test pins the invalidations. I'm accepting on that evidence, not on observed Home behaviour.

LOW follow-up: the reviewer-key invalidation (use-backend-hints.ts:87-89) is now redundant. ['backend', org, 'task'] already covers ['backend', org, 'task', 'reviewer'], and the second call cancels and restarts that query's refetch (cancelRefetch defaults to true), so each project hint costs one extra request. The fix is to drop the third call and keep its comment's intent next to the task prefix.

Merge: squash with --match-head-commit through my gate, which does a dry run first.

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.

bug(platform): Home keeps a deleted or archived project's tasks and chats until a reload

1 participant