Skip to content

Complete EventBus cleanup and fix TypeScript errors from service deletion (#558) - #600

Merged
malibio merged 4 commits into
mainfrom
fix/issue-558-typescript-errors
Nov 21, 2025
Merged

malibio merged 4 commits into
mainfrom
fix/issue-558-typescript-errors

Conversation

@malibio

@malibio malibio commented Nov 21, 2025

Copy link
Copy Markdown
Collaborator

Closes #558

malibio and others added 2 commits November 21, 2025 18:26
## Issues Fixed

1. **Deleted broken test file**: `live-select-multi-client.test.ts`
   - Imported from deleted `$lib/services/event-bus`
   - Test was added in PR #594 but referenced deleted services
   - The test tested old event-bus architecture, not needed for LIVE SELECT

2. **Fixed `optimistic-operation-manager.test.ts`**:
   - Added missing `edgeType: 'child'` property to all 19 `__testOnly_addChild` calls
   - EdgeEventData type requires edgeType field

3. **Fixed `optimistic-operation-manager.svelte.ts`**:
   - Updated import path from `$lib/services/event-types` to `$lib/types/event-types`

4. **Added `PersistenceFailedEvent` type to `$lib/types/event-types.ts`**:
   - Type was missing after event-types.ts was deleted and replaced with minimal version
   - Added with correct fields matching implementation:
     - failureReason: 'timeout' | 'foreign-key-constraint' | 'database-locked' | 'unknown'
     - affectedOperations with error field
     - optional metadata field

## Results
- svelte-check: 0 errors (was 52)
- Tests: 2 pre-existing failures, 1425 passing (no new failures)

Related to #558

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
This commit completes the cleanup from Issue #558 (LIVE SELECT migration)
by removing all remaining eventBus references and dead code:

Deleted Files (21 skipped/broken test files):
- 19 integration tests testing deleted event-bus functionality
- 2 service tests for deleted services
- All used describe.skip or imported deleted services

Source File Changes:
- reactive-node-service.svelte.ts: Remove 5 dead emit functions and 10+ emit calls
- content-processor.ts: Already clean (verified)
- shared-node-store.ts: Remove "(eventBus removed)" comments from debug logs
- performance-monitor.ts: Remove window.eventBus fallback code blocks
- test-helpers.ts: Remove NodeSpaceEvent type, eventBus stub, and all EventBus testing utilities
- base-node-viewer.svelte: Update TODO comment to reference toast system
- mcp-integration.test.ts: Update docstring, remove stale comment

Test Fixes:
- shared-node-store.test.ts: Remove empty "Node Filtering" describe block
- split-pane-isolation.test.ts: Fix hierarchy setup using structureTree

Result:
- Zero eventBus references in codebase
- All 1427 tests passing
- Zero lint/type errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Nov 21, 2025

Copy link
Copy Markdown
Collaborator Author

Code Review: PR #600 - Delete 15 obsolete services replaced by LIVE SELECT

Review Mode

Initial Review - No prior reviews found

Overall Assessment

APPROVE - This PR is a strong net positive for codebase health.

This change completes the EventBus cleanup from the LIVE SELECT migration (Issue #558). The implementation is well-executed, removing 2,185 lines of dead code while maintaining full test coverage (1,427 tests passing). The approach follows the project's "pre-release development" philosophy correctly - no backward compatibility cruft, clean deletion of obsolete patterns.


Requirements Validation

Issue #558 Acceptance Criteria

Criterion Status Notes
Delete obsolete service files Partial EventBus cleanup complete, but PR title mentions "15 services" - this appears to be cleanup work, not all 15 services
Delete corresponding test files PASS 21 broken/skipped test files deleted
Update imports across codebase PASS Zero eventBus references remain
All existing tests pass PASS 1,427 tests passing
Code reduction PASS -2,185 lines (73 insertions, 2,185 deletions)

Note: The PR title references "Delete 15 obsolete services" but the actual work completed is the EventBus cleanup phase. The PR description should be updated to better reflect the actual changes.


Findings

Critical Issues

None identified.

Suggested Improvements

[Improvement] PR Title Mismatch

The PR title "Delete 15 obsolete services replaced by LIVE SELECT" doesn't accurately describe the changes. The commits show:

  1. Fix 52 TypeScript errors from incomplete service deletion
  2. Remove legacy eventBus code and skipped tests

Recommendation: Update PR title to something like:


[Improvement] processContentWithEventEmission Method Deprecation

/packages/desktop-app/src/lib/services/content-processor.ts

The method processContentWithEventEmission now just delegates to prepareBacklinkSyntax:

public processContentWithEventEmission(content: string, _nodeId: string): PreparedContent {
  return this.prepareBacklinkSyntax(content);
}

Engineering Principle: YAGNI (You Aren't Gonna Need It) - If the method no longer does anything unique, consider deprecating it in favor of direct calls to prepareBacklinkSyntax.

Recommendation: Mark for future cleanup or rename to clarify its purpose. Not blocking as this maintains API stability during transition.


[Improvement] Visibility Change Needs Documentation

/packages/desktop-app/src/lib/services/content-processor.ts:234

- private invalidateReferenceCache(nodeId: string): void {
+ public invalidateReferenceCache(nodeId: string): void {

The visibility change from private to public suggests this method is now intended for external callers. This is likely correct since external code now needs to trigger cache invalidation (previously handled by EventBus subscriptions).

Recommendation: Add a JSDoc comment explaining when external callers should invoke this method.


Nitpicks

Nit: Empty Comment Block

/packages/desktop-app/src/lib/services/content-processor.ts:224

private constructor() {
  // Constructor - initialization happens on demand
}

The comment is self-evident. Consider removing or expanding to explain what "on demand" initialization means.


Nit: Unused Parameter Warning Suppression

/packages/desktop-app/src/lib/services/reactive-node-service.svelte.ts:509

function processExpensiveContentOperations(nodeId: string, _content: string): void {

The underscore prefix correctly suppresses the unused parameter warning, but the function body only uses nodeId to look up the node. Consider if _content should be removed entirely or if there's planned future use.


Architecture & Design Analysis

Strengths

  1. Clean Separation of Concerns: EventBus was a cross-cutting concern that created implicit dependencies. Removal simplifies the data flow - LIVE SELECT provides a cleaner unidirectional update pattern.

  2. Test Hygiene: Removing 21 skipped/broken tests that tested deleted functionality is the correct approach. Dead tests are worse than no tests.

  3. Type Safety Preserved: The PersistenceFailedEvent type was correctly moved to $lib/types/event-types.ts maintaining type safety for error handling.

  4. No Half-Measures: The cleanup is thorough - zero eventBus references remain in the codebase (verified via grep).

Considerations for Future Work

  1. The comment in base-node-viewer.svelte references a "toast/notification system" as the replacement for error events. This should be tracked as a follow-up item.

  2. Performance monitoring events (performance:memory-warning, performance:regression) were removed. If these metrics are still needed, they should be reimplemented via the new architecture.


Testing Verification

Check Result
bun run test 1,427 passed
bun run quality:fix 0 errors, 0 warnings
EventBus references remaining 0 files

Security Considerations

No security concerns identified. This change only removes code and does not introduce new attack surfaces.


Final Verdict

APPROVED

The changes are well-implemented and align with the project's development philosophy. The codebase is cleaner, more maintainable, and the test suite remains healthy. The minor improvements suggested are not blocking.


Reviewed by: Principal Engineer AI Reviewer
Review Framework: Pragmatic Quality

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Code review complete. This PR is a strong net positive - clean removal of 2,185 lines of dead EventBus code while maintaining full test coverage. See detailed review comment for minor improvement suggestions. Recommendation: APPROVE

- Updated shared-node-store.ts comments to remove EventBus references
- Updated mock-reactive-node-service.ts comment to reference ReactiveStructureTree
- Updated test-constants.ts comments to remove EventBus references

Addresses code cleanup as part of EventBus removal.
@malibio malibio changed the title Delete 15 obsolete services replaced by LIVE SELECT Complete EventBus cleanup and fix TypeScript errors from service deletion (#558) Nov 21, 2025
- Add comprehensive JSDoc for invalidateReferenceCache() explaining when
  external callers should invoke cache invalidation
- Improve constructor comment to explain singleton pattern enforcement

Addresses reviewer recommendations from PR #600 code review.
@malibio

malibio commented Nov 21, 2025

Copy link
Copy Markdown
Collaborator Author

Review Feedback Addressed

Summary

Category Count Status
Addressed 3 ✅
Skipped 2 ⏭️ (with justification)
Tests 1,427 ✅ Passing

Changes Made

Commit 1: 679b1d7d - Clean up outdated comments

  • Updated shared-node-store.ts comments to remove EventBus references
  • Updated mock-reactive-node-service.ts comment to reference ReactiveStructureTree
  • Updated test-constants.ts comments to remove EventBus references

Commit 2: 1a2cfa75 - Address code review feedback

  • ✅ PR Title: Updated to accurately reflect changes: "Complete EventBus cleanup and fix TypeScript errors from service deletion (Delete 15 obsolete services replaced by LIVE SELECT #558)"
  • ✅ JSDoc for invalidateReferenceCache(): Added comprehensive documentation explaining when external callers should invoke cache invalidation
  • ✅ Constructor comment: Improved to explain singleton pattern enforcement

Skipped Recommendations (with justification)

  1. processContentWithEventEmission deprecation - ⏭️ Skipped

    • Reviewer noted: "Not blocking as this maintains API stability during transition"
    • This is cleanup work; maintaining existing API is correct for now
    • Future cleanup can address method consolidation
  2. _content unused parameter - ⏭️ Skipped

    • The underscore prefix is standard TypeScript convention for intentionally unused parameters
    • The function signature may need _content for interface conformance or future use
    • No action needed

Verification

✅ bun run test: 1,427 tests passing
✅ bun run quality:fix: 0 errors, 0 warnings
✅ git push: Changes pushed successfully

Feedback addressed by Implementation Agent

@malibio
malibio merged commit d94f2f0 into main Nov 21, 2025
@malibio
malibio deleted the fix/issue-558-typescript-errors branch November 21, 2025 18:35
malibio added a commit that referenced this pull request Feb 4, 2026
…tion (#558) (#600)

* Fix 52 TypeScript errors from incomplete service deletion refactoring

## Issues Fixed

1. **Deleted broken test file**: `live-select-multi-client.test.ts`
   - Imported from deleted `$lib/services/event-bus`
   - Test was added in PR #594 but referenced deleted services
   - The test tested old event-bus architecture, not needed for LIVE SELECT

2. **Fixed `optimistic-operation-manager.test.ts`**:
   - Added missing `edgeType: 'child'` property to all 19 `__testOnly_addChild` calls
   - EdgeEventData type requires edgeType field

3. **Fixed `optimistic-operation-manager.svelte.ts`**:
   - Updated import path from `$lib/services/event-types` to `$lib/types/event-types`

4. **Added `PersistenceFailedEvent` type to `$lib/types/event-types.ts`**:
   - Type was missing after event-types.ts was deleted and replaced with minimal version
   - Added with correct fields matching implementation:
     - failureReason: 'timeout' | 'foreign-key-constraint' | 'database-locked' | 'unknown'
     - affectedOperations with error field
     - optional metadata field

## Results
- svelte-check: 0 errors (was 52)
- Tests: 2 pre-existing failures, 1425 passing (no new failures)

Related to #558

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Remove legacy eventBus code and skipped tests

This commit completes the cleanup from Issue #558 (LIVE SELECT migration)
by removing all remaining eventBus references and dead code:

Deleted Files (21 skipped/broken test files):
- 19 integration tests testing deleted event-bus functionality
- 2 service tests for deleted services
- All used describe.skip or imported deleted services

Source File Changes:
- reactive-node-service.svelte.ts: Remove 5 dead emit functions and 10+ emit calls
- content-processor.ts: Already clean (verified)
- shared-node-store.ts: Remove "(eventBus removed)" comments from debug logs
- performance-monitor.ts: Remove window.eventBus fallback code blocks
- test-helpers.ts: Remove NodeSpaceEvent type, eventBus stub, and all EventBus testing utilities
- base-node-viewer.svelte: Update TODO comment to reference toast system
- mcp-integration.test.ts: Update docstring, remove stale comment

Test Fixes:
- shared-node-store.test.ts: Remove empty "Node Filtering" describe block
- split-pane-isolation.test.ts: Fix hierarchy setup using structureTree

Result:
- Zero eventBus references in codebase
- All 1427 tests passing
- Zero lint/type errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Clean up outdated comments referencing EventBus and HierarchyService

- Updated shared-node-store.ts comments to remove EventBus references
- Updated mock-reactive-node-service.ts comment to reference ReactiveStructureTree
- Updated test-constants.ts comments to remove EventBus references

Addresses code cleanup as part of EventBus removal.

* Address code review feedback: improve documentation and comments

- Add comprehensive JSDoc for invalidateReferenceCache() explaining when
  external callers should invoke cache invalidation
- Improve constructor comment to explain singleton pattern enforcement

Addresses reviewer recommendations from PR #600 code review.

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 5, 2026
…tion (#558) (#600)

* Fix 52 TypeScript errors from incomplete service deletion refactoring

## Issues Fixed

1. **Deleted broken test file**: `live-select-multi-client.test.ts`
   - Imported from deleted `$lib/services/event-bus`
   - Test was added in PR #594 but referenced deleted services
   - The test tested old event-bus architecture, not needed for LIVE SELECT

2. **Fixed `optimistic-operation-manager.test.ts`**:
   - Added missing `edgeType: 'child'` property to all 19 `__testOnly_addChild` calls
   - EdgeEventData type requires edgeType field

3. **Fixed `optimistic-operation-manager.svelte.ts`**:
   - Updated import path from `$lib/services/event-types` to `$lib/types/event-types`

4. **Added `PersistenceFailedEvent` type to `$lib/types/event-types.ts`**:
   - Type was missing after event-types.ts was deleted and replaced with minimal version
   - Added with correct fields matching implementation:
     - failureReason: 'timeout' | 'foreign-key-constraint' | 'database-locked' | 'unknown'
     - affectedOperations with error field
     - optional metadata field

## Results
- svelte-check: 0 errors (was 52)
- Tests: 2 pre-existing failures, 1425 passing (no new failures)

Related to #558

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Remove legacy eventBus code and skipped tests

This commit completes the cleanup from Issue #558 (LIVE SELECT migration)
by removing all remaining eventBus references and dead code:

Deleted Files (21 skipped/broken test files):
- 19 integration tests testing deleted event-bus functionality
- 2 service tests for deleted services
- All used describe.skip or imported deleted services

Source File Changes:
- reactive-node-service.svelte.ts: Remove 5 dead emit functions and 10+ emit calls
- content-processor.ts: Already clean (verified)
- shared-node-store.ts: Remove "(eventBus removed)" comments from debug logs
- performance-monitor.ts: Remove window.eventBus fallback code blocks
- test-helpers.ts: Remove NodeSpaceEvent type, eventBus stub, and all EventBus testing utilities
- base-node-viewer.svelte: Update TODO comment to reference toast system
- mcp-integration.test.ts: Update docstring, remove stale comment

Test Fixes:
- shared-node-store.test.ts: Remove empty "Node Filtering" describe block
- split-pane-isolation.test.ts: Fix hierarchy setup using structureTree

Result:
- Zero eventBus references in codebase
- All 1427 tests passing
- Zero lint/type errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Clean up outdated comments referencing EventBus and HierarchyService

- Updated shared-node-store.ts comments to remove EventBus references
- Updated mock-reactive-node-service.ts comment to reference ReactiveStructureTree
- Updated test-constants.ts comments to remove EventBus references

Addresses code cleanup as part of EventBus removal.

* Address code review feedback: improve documentation and comments

- Add comprehensive JSDoc for invalidateReferenceCache() explaining when
  external callers should invoke cache invalidation
- Improve constructor comment to explain singleton pattern enforcement

Addresses reviewer recommendations from PR #600 code review.

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 26, 2026
…tion (#558) (#600)

* Fix 52 TypeScript errors from incomplete service deletion refactoring

## Issues Fixed

1. **Deleted broken test file**: `live-select-multi-client.test.ts`
   - Imported from deleted `$lib/services/event-bus`
   - Test was added in PR #594 but referenced deleted services
   - The test tested old event-bus architecture, not needed for LIVE SELECT

2. **Fixed `optimistic-operation-manager.test.ts`**:
   - Added missing `edgeType: 'child'` property to all 19 `__testOnly_addChild` calls
   - EdgeEventData type requires edgeType field

3. **Fixed `optimistic-operation-manager.svelte.ts`**:
   - Updated import path from `$lib/services/event-types` to `$lib/types/event-types`

4. **Added `PersistenceFailedEvent` type to `$lib/types/event-types.ts`**:
   - Type was missing after event-types.ts was deleted and replaced with minimal version
   - Added with correct fields matching implementation:
     - failureReason: 'timeout' | 'foreign-key-constraint' | 'database-locked' | 'unknown'
     - affectedOperations with error field
     - optional metadata field

## Results
- svelte-check: 0 errors (was 52)
- Tests: 2 pre-existing failures, 1425 passing (no new failures)

Related to #558

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Remove legacy eventBus code and skipped tests

This commit completes the cleanup from Issue #558 (LIVE SELECT migration)
by removing all remaining eventBus references and dead code:

Deleted Files (21 skipped/broken test files):
- 19 integration tests testing deleted event-bus functionality
- 2 service tests for deleted services
- All used describe.skip or imported deleted services

Source File Changes:
- reactive-node-service.svelte.ts: Remove 5 dead emit functions and 10+ emit calls
- content-processor.ts: Already clean (verified)
- shared-node-store.ts: Remove "(eventBus removed)" comments from debug logs
- performance-monitor.ts: Remove window.eventBus fallback code blocks
- test-helpers.ts: Remove NodeSpaceEvent type, eventBus stub, and all EventBus testing utilities
- base-node-viewer.svelte: Update TODO comment to reference toast system
- mcp-integration.test.ts: Update docstring, remove stale comment

Test Fixes:
- shared-node-store.test.ts: Remove empty "Node Filtering" describe block
- split-pane-isolation.test.ts: Fix hierarchy setup using structureTree

Result:
- Zero eventBus references in codebase
- All 1427 tests passing
- Zero lint/type errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Clean up outdated comments referencing EventBus and HierarchyService

- Updated shared-node-store.ts comments to remove EventBus references
- Updated mock-reactive-node-service.ts comment to reference ReactiveStructureTree
- Updated test-constants.ts comments to remove EventBus references

Addresses code cleanup as part of EventBus removal.

* Address code review feedback: improve documentation and comments

- Add comprehensive JSDoc for invalidateReferenceCache() explaining when
  external callers should invoke cache invalidation
- Improve constructor comment to explain singleton pattern enforcement

Addresses reviewer recommendations from PR #600 code review.

---------

Co-authored-by: Claude <[email protected]>
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.

Delete 15 obsolete services replaced by LIVE SELECT

1 participant