Skip to content

refactor(data): scope async resource consumers - #563

Open
beruro wants to merge 17 commits into
junyu/async-resource-lifecyclefrom
junyu/scoped-loader-consumers
Open

refactor(data): scope async resource consumers#563
beruro wants to merge 17 commits into
junyu/async-resource-lifecyclefrom
junyu/scoped-loader-consumers

Conversation

@beruro

@beruro beruro commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Problem

Shared application loaders could publish late results after project, workspace, session, or browser scope changes. Some polling/countdown work also continued while hidden, browser diagnostic state could outlive the owning surface, and Tauri event consumers could leak subscriptions when cleanup ran before asynchronous listener registration resolved.

Solution

Potential risks

  • This is a broad consumer sweep; an incorrect scope key can expose stale cross-project data.
  • Browser close/unmount, visibility return, native menu registration, and project reactivation are the highest lifecycle-risk paths.
  • Listener cleanup errors are swallowed so teardown cannot mask the originating setup error; a failing native unlisten may require platform logs.
  • This PR depends on refactor(async): add scoped resource lifecycle #562 and should be retargeted only after refactor(async): add scoped resource lifecycle #562 lands. Rollback is a normal revert; there is no schema, wire, dependency, or persistence migration.

Performance audit

Verdict: pass. Each retained subscription has one Effect-owned scope; cleanup is symmetric, late handles self-release, partial setup rolls back, and no unbounded timer/cache was added.

Verification

Validated locally after merging current #562 head 8618af370 into head 49864e065 without conflicts:

  • pnpm install --frozen-lockfilePASS. The optional legacy node-sass native postinstall warning did not block installation or checks.
  • Focused Vitest across the 7 changed/foundation lifecycle files — PASS, 7 files / 28 tests.
  • pnpm typecheckPASS.
  • git diff --cached --check before the merge commit — PASS.

Because this stacked PR targets junyu/async-resource-lifecycle, full frontend/Rust CI may not run until #562 lands and this PR is retargeted to develop.

@beruro
beruro force-pushed the junyu/async-resource-lifecycle branch from 9c4d6e6 to eb16aff Compare July 30, 2026 07:07
@beruro
beruro force-pushed the junyu/scoped-loader-consumers branch from d2355fc to 5f7f585 Compare July 30, 2026 07:07
@beruro
beruro force-pushed the junyu/async-resource-lifecycle branch from eb16aff to 59189c0 Compare July 30, 2026 07:49
@beruro
beruro force-pushed the junyu/scoped-loader-consumers branch from 5f7f585 to 3e6b103 Compare July 30, 2026 07:49
@beruro
beruro force-pushed the junyu/async-resource-lifecycle branch from 59189c0 to a739c82 Compare July 30, 2026 08:04
@beruro
beruro force-pushed the junyu/scoped-loader-consumers branch from 3e6b103 to c294fbf Compare July 30, 2026 08:04
beruro added 2 commits July 30, 2026 23:09
Pre-commit hook ran. Total eslint: 10, total circular: 0
Pre-commit hook ran. Total eslint: 10, total circular: 0
@beruro
beruro force-pushed the junyu/async-resource-lifecycle branch from a739c82 to d16c8e5 Compare July 30, 2026 15:09
beruro and others added 4 commits August 8, 2026 20:38
…e-lifecycle' into HEAD

# Conflicts:
#	src/engines/ChatPanel/panels/ProjectPanelView.tsx
#	src/modules/MainApp/WorkManagement/useGitHubWorkItemsLoadLifecycle.ts
#	src/modules/ProjectManager/LinearProjects/useLinearIndexData.tsx
#	src/modules/ProjectManager/WorkItems/hooks/useProjectData/useProjectData.ts
#	src/modules/WorkStation/CodeEditor/Panels/EditorPrimarySidebar/hooks/useWorkstationIssues.ts
…e-lifecycle' into HEAD

# Conflicts:
#	src/modules/ProjectManager/WorkItems/hooks/useProjectData/useProjectData.ts
@beruro
beruro marked this pull request as draft August 10, 2026 03:35
@beruro
beruro force-pushed the junyu/async-resource-lifecycle branch 2 times, most recently from fb403e6 to 5f991c2 Compare August 10, 2026 05:24
@beruro
beruro marked this pull request as ready for review August 11, 2026 05:16
beruro added 2 commits August 13, 2026 22:52
…into sync-pr-563

# Conflicts:
#	src/engines/ChatPanel/panels/ProjectPanelView.tsx
#	src/modules/WorkStation/CodeEditor/Panels/EditorPrimarySidebar/hooks/useWorkstationIssues.ts
Pre-commit hook ran. Total eslint: 0, total circular: 0
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.

1 participant