Skip to content

Delete frontend migration residue: tombstone comments + FocusManager legacy/@deprecated API (C6) #1246

Closed

Description

@malibio

Spun off from the architectural-audit tracking issue #1228 (finding C6 — frontend migration residue). Verified against main 2026-05-30; the audit's line numbers were stale and are corrected below.

Background

Frontend migration residue from completed migrations (#557 cache removal, #690 schema-defaults simplification, the FocusManager action-based rewrite) still litters the service layer as (a) tombstone comments describing code that no longer exists and (b) a full @deprecated "legacy compatibility" API layer in FocusManager. The latter violates the repo's no backward-compat / no @deprecated / delete-don't-deprecate rule (CLAUDE.md).

This is two cleanly separable jobs. Do both in one PR.

Job A — Delete tombstone comments

Pure-noise comments describing removed code. Verified locations in packages/desktop-app/src/lib/services/reactive-node-service.svelte.ts:

⚠️ DO NOT delete the "NOTE: X removed (Issue #557) — backend handles ordering via fractional ordering" comments (e.g. :386, :484, :702, :900-901, :1417, :1420, :1762, and similar). These are load-bearing: they document an intentional absence of sibling-chain/cache management in the frontend. A future dev who deletes them and sees no cache logic could "helpfully" re-add it and reintroduce the #557 bug class. Keep these. Job A removes only tombstones for code whose absence needs no explanation (schema defaults, clearAllAutoFocus, autoFocus).

Also KEEP real open TODOs tied to live issues: :448 TODO(#656): Emit error event and :36.

Job B — Delete the FocusManager legacy/@deprecated API layer

packages/desktop-app/src/lib/services/focus-manager.svelte.ts (389 lines) carries an explicit "LEGACY API - Backwards Compatibility (will be removed after migration)" section plus parallel "keep legacy state in sync during migration" plumbing:

  • Legacy state declarations + sync: :60, :83, :125, :138, :153, :171, :240
  • @deprecated getters: pendingCursorPosition, arrowNavigationContext, arrowNavDirection, arrowNavPixelOffset, nodeTypeConversionCursorPosition (:191-226)
  • @deprecated methods: setEditingNodeFromArrowNavigation, setEditingNodeFromInheritedType, focusNodeFromTypeConversion, clearArrowNavigationContext, getCurrentState (:249, :273, :297, :350, :366)

Production-dead, test-only alive (verified via grep + LSP). No production code outside focus-manager.svelte.ts calls these legacy getters/methods — the only non-test reference (textarea-controller.svelte.ts:441-443 this.pendingCursorPosition) is a field on a different class, unrelated. Every other caller lives in:

  • packages/desktop-app/src/tests/services/focus-manager.test.ts
  • packages/desktop-app/src/tests/services/focus-manager-cursor-positioning.test.ts

Action: delete the legacy state + the @deprecated getters/methods + the migration-sync plumbing. Then migrate the two test files: rewrite assertions to use the current API (cursorPosition, focusNode/focusNodeAtPosition/focusNodeAtLine, focusNodeFromArrowNav, setEditingNode/clearEditing — the replacements named in each @deprecated doc comment) instead of the legacy surface. Where a test exists only to exercise a legacy method (e.g. a "legacy arrow nav" test), delete it if the current-API path is already covered elsewhere; otherwise port it to the current API. Do not keep a legacy test asserting legacy behavior.

Acceptance criteria

  • Job A: the four tombstone comment sites above are removed; the Delete obsolete cache management code from SharedNodeStore #557 "intentional absence" comments and the real TODO(#656)/:36 TODOs are preserved.
  • Job B: no @deprecated annotations remain in focus-manager.svelte.ts; the "LEGACY API" section and all "legacy state ... during migration" plumbing are deleted.
  • Job B: focus-manager.test.ts and focus-manager-cursor-positioning.test.ts reference only the current FocusManager API; no test asserts legacy-API behavior.
  • grep -rn "@deprecated" packages/desktop-app/src/lib/services/focus-manager.svelte.ts returns nothing.
  • No new lint suppressions; no {@html}; logging via createLogger (no raw console). Delete, don't comment-out.

Testing

  • bun run test green — specifically the two focus-manager test files pass against the current API after migration (no new failures vs baseline).
  • bun run check (svelte-check) clean — removing the legacy getters must not leave dangling type references.
  • Manually sanity-check focus behavior is unaffected: this is dead-code removal, so runtime behavior should be identical. If any production path did secretly depend on the legacy sync, bun run check + tests will surface it.

Out of scope

Standard NodeSpace startup / PR sequence

Primary checkout git status + git pull origin main, then EnterWorktree({name: "issue-<N>-frontend-residue-cleanup"}); inside: bun install, baseline bun run test, bun run gh:assign <N> "@me", bun run gh:status <N> "In Progress". Use createLogger not console.*; bun run test not bun test. Before PR: bun run test:all + bun run check (no new failures), bun run quality:fix, commit, bun run gh:pr <N>. /pragmatic-code-review before merge, then ExitWorktree({action: "remove", discard_changes: true}) and gh pr merge <PR#> --squash --delete-branch.


Spun off from #1228 (architectural audit), finding C6.

Activity

  1. malibio commented on May 30, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 131 files, 3924 tests passed

  2. self-assigned this
    on May 30, 2026
  3. added a commit that references this issue on Jun 22, 2026
    aae207e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions