Expose RenameAccount and UpdateAccountType RPCs with DX improvements#48
Merged
Expose RenameAccount and UpdateAccountType RPCs with DX improvements#48
Conversation
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>
There was a problem hiding this comment.
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
RenameAccountandUpdateAccountTypeRPCs with event sourcing, validation, and tests at core and MCP layers ErrNoChangesentinel error mapped tocodes.InvalidArgumentvia newaccountErrorhelper in the daemon- Atomic binary install (
cp+mv) in justfile and new/mcp-reloadskill
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 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 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-reloadskill documents the MCP server development iteration cycle (build, install, exit, resume).A
core.ErrNoChangesentinel error was introduced so the daemon correctly maps "same value" validation failures tocodes.InvalidArgumentinstead ofcodes.Internal.Changes
RenameAccountandUpdateAccountTypeRPC definitions with request/response messagesRenameAccountandUpdateAccountTypewith event sourcing, validation, andErrNoChangesentinelErrNoChange→InvalidArgumentmapping inaccountErrorrename_accountandupdate_account_typetool handlers with input normalizationcp+mv) for binary installs to avoid "text file busy" errors/mcp-reloadskill for MCP development iteration workflowTest plan
ErrNoChangesentinelrename_account,update_account_type,list_accounts,ping)just testandjust lintpassjust all && just installsucceeds while daemon and MCP server are running🤖 Generated with Claude Code