Skip to content

Expose RenameAccount and UpdateAccountType RPCs with DX improvements#48

Merged
jakewan merged 5 commits intomainfrom
feature/account-rename-type-change
Mar 16, 2026
Merged

Expose RenameAccount and UpdateAccountType RPCs with DX improvements#48
jakewan merged 5 commits intomainfrom
feature/account-rename-type-change

Conversation

@jakewan
Copy link
Copy Markdown
Owner

@jakewan jakewan commented Mar 16, 2026

Overview

This change adds two new account mutation RPCs (RenameAccount and UpdateAccountType) across the full stack — proto definition, core domain logic with event sourcing, daemon gRPC handlers, and MCP tool wrappers. It represents an incremental improvement, extending the existing account management API surface to support operations that were previously only possible by recreating accounts.

Along the way, this PR addresses two DX pain points discovered during development: binary installs now use atomic replacement to avoid "text file busy" errors when updating running binaries, and a new /mcp-reload skill documents the MCP server development iteration cycle (build, install, exit, resume).

A core.ErrNoChange sentinel error was introduced so the daemon correctly maps "same value" validation failures to codes.InvalidArgument instead of codes.Internal.

Changes

  • proto: Add RenameAccount and UpdateAccountType RPC definitions with request/response messages
  • core: Implement RenameAccount and UpdateAccountType with event sourcing, validation, and ErrNoChange sentinel
  • daemon: Add gRPC handlers with input validation and ErrNoChangeInvalidArgument mapping in accountError
  • mcp: Add rename_account and update_account_type tool handlers with input normalization
  • justfile: Use atomic replacement (cp + mv) for binary installs to avoid "text file busy" errors
  • skill: Add /mcp-reload skill for MCP development iteration workflow

Test plan

  • Core unit tests verify rename, type change, event production, and ErrNoChange sentinel
  • MCP BDD tests cover happy path, validation, event history, and input normalization
  • Manual verification via MCP tools (rename_account, update_account_type, list_accounts, ping)
  • just test and just lint pass
  • Pre-push hooks pass (proto, go-lint, go-test, qt-build)
  • Atomic install verified: just all && just install succeeds while daemon and MCP server are running

🤖 Generated with Claude Code

jakewan and others added 4 commits March 15, 2026 14:59
Add core methods, proto definitions, daemon handlers, and MCP tools
for renaming accounts and changing account types. Both operations
follow the established event-sourcing pattern with proper validation,
not-found error mapping, and no-op detection.

Closes #30

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Clarify the rebuild-install-resume cycle for the Finch MCP server.
Claude Code's stdio transport spawns the binary at session start with
no in-session reload, so the skill automates the build/install steps
and guides the user through exiting and resuming with `claude --continue`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cp fails with "text file busy" when overwriting a running binary on
Linux. Using cp-to-temp + mv replaces the directory entry atomically
while the running process retains its fd to the old inode, allowing
installs to succeed without stopping the daemon or MCP server first.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce core.ErrNoChange sentinel so the daemon can distinguish
"same value" validation failures from unexpected internal errors and
return codes.InvalidArgument instead of codes.Internal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds RenameAccount and UpdateAccountType RPCs across the full stack (proto, core, daemon, MCP), introduces a core.ErrNoChange sentinel error for same-value validation, uses atomic binary replacement in the justfile, and adds an MCP reload skill document.

Changes:

  • New RenameAccount and UpdateAccountType RPCs with event sourcing, validation, and tests at core and MCP layers
  • ErrNoChange sentinel error mapped to codes.InvalidArgument via new accountError helper in the daemon
  • Atomic binary install (cp+mv) in justfile and new /mcp-reload skill

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
proto/finch/v1/finch.proto Add RenameAccount and UpdateAccountType RPC definitions and messages
core/account.go Implement RenameAccount, UpdateAccountType with event sourcing and ErrNoChange sentinel
core/account_test.go Unit tests for rename, type change, validation, and ErrNoChange
daemon/finchd/server.go gRPC handlers and accountError helper for error mapping
mcp/tools.go MCP tool handlers with input normalization for account type
mcp/tools_test.go BDD-style tests for rename and update_account_type tools
justfile Atomic binary replacement for install targets
.claude/skills/mcp-reload/SKILL.md Skill doc for MCP server reload workflow

Comment thread core/account.go Outdated
Comment on lines +152 to +154
var acctType int
if err := tx.QueryRowContext(ctx,
"SELECT name, type FROM accounts WHERE id = ?", accountID).Scan(&oldName, &acctType); err != nil {
Comment thread core/account.go Outdated
Comment on lines +207 to +210
var name string
var oldType int
if err := tx.QueryRowContext(ctx,
"SELECT name, type FROM accounts WHERE id = ?", accountID).Scan(&name, &oldType); err != nil {
Remove unused columns from queries in RenameAccount (acctType) and
UpdateAccountType (name) per Copilot review feedback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jakewan jakewan marked this pull request as ready for review March 16, 2026 06:07
@jakewan jakewan merged commit 377d0a9 into main Mar 16, 2026
3 checks passed
@jakewan jakewan deleted the feature/account-rename-type-change branch March 16, 2026 06:07
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.

2 participants