Skip to content

RPC registry: migrate h-code RPC methods to register() #134

Description

@harrryyd

What to build

Migrate the five h-code RPC methods to use RpcMethodRegistry.register() instead of the static WS_METHODS / WsRpcGroup / RPC_REQUIRED_SCOPE / handler switch pattern:

  • todo.load — schema in packages/contracts/src/todos.ts, handler in apps/server/src/ws.ts
  • todo.mutate — same files
  • mcp.listServers — handler in apps/server/src/ws.ts
  • mcp.toggleServer — handler in apps/server/src/ws.ts
  • review.getDiffPreview — handler in apps/server/src/ws.ts

Each method migrates by calling registry.register() from its domain file (or a dedicated registration file). The handler moves out of the giant switch in ws.ts into a standalone function.

This is the vertical-slice proof that the registry pattern works end-to-end: contracts → server handler → client types.

Acceptance criteria

  • todo.load registered via registry.register() with schema, scope, and handler
  • todo.mutate registered via same pattern
  • mcp.listServers and mcp.toggleServer registered via same pattern
  • review.getDiffPreview registered via same pattern
  • Each handler is a standalone function (not a switch case in ws.ts)
  • Old entries removed from WS_METHODS constant for these 5 methods
  • Old entries removed from RPC_REQUIRED_SCOPE map for these 5 methods
  • wsRpcScopes.test.ts still passes (checking remaining old entries)
  • Todo panel, MCP toggle, and review diff preview still work end-to-end
  • vp check and vp run typecheck pass

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions