Repository navigation
refactor(mcp): port adapters (external I/O wrapper) - #95
couragehong merged 6 commits into
Conversation
12 direct-parity items, 3 Go-only safety/typing improvements, 5 acceptable divergences (DecryptResult shape, JSON parse location, Tier 2 fallback, per-instance timeout, etc.), 1 open env-override gap (RUNEVAULT_GRPC_TARGET — should land in config loader, not adapter). Notes the bug fix in this PR (commit 7a8199c) for the broken hand-rolled grpcStatuser interface inherited from #95 review base.
|
// errors.go L117-130 (PR #95 head a13d174)
func statusFromError(err error) (grpcStatus, bool) {
type grpcStatuser interface {
GRPCStatus() interface {
Code() int // ← int 요구
Message() string
}
}
if gs, ok := err.(grpcStatuser); ok {
...
}
return grpcStatus{}, false
}
err := status.Error(codes.Unauthenticated, "wrong token")
if _, ok := err.(grpcStatuser); ok { /* 절대 안 들어옴 */ }
// 실제 출력: "DID NOT MATCH — type assertion failed for *status.Error"
특히
|
| return fmt.Errorf("vault: failed to create health request: %w", err) | ||
| } | ||
|
|
||
| resp, err := http.DefaultClient.Do(req) |
There was a problem hiding this comment.
I think this needs a timeout. http.DefaultClient has no timeout, so if vault is unresponsive and caller doesn't set a ctx deadline, the call hangs. My suggest is set timeout like &http.Client{Timeout: 5 * time.Second}.
The hand-rolled grpcStatuser interface in #95's port required Code() to return int, but real gRPC status errors return codes.Code (uint32). The type assertion silently failed for every gRPC error and every call landed in the !ok branch as ErrVaultInternal — hiding the actual code. Switch to status.FromError(err) and codes.* constants from google.golang.org/grpc, which is already a direct dep.
12 direct-parity items, 3 Go-only safety/typing improvements, 5 acceptable divergences (DecryptResult shape, JSON parse location, Tier 2 fallback, per-instance timeout, etc.), 1 open env-override gap (RUNEVAULT_GRPC_TARGET — should land in config loader, not adapter). Notes the bug fix in this PR (commit 7a8199c) for the broken hand-rolled grpcStatuser interface inherited from #95 review base.
#103 ported errors.go for envector but missed vault. The hand-rolled grpcStatuser interface in #95's port required Code() to return int, but real *status.Status.Code() returns codes.Code (uint32). Type assertion silently fails for every gRPC error and every call lands in the !ok branch as ErrVaultInternal — hiding the actual code. Worst case: Unauthenticated (token revoked/expired) gets mis-flagged as retryable=true, triggering infinite retry on auth failure. Switch to status.FromError(err) and codes.* constants from google.golang.org/grpc, mirroring the pattern in envector/errors.go MapSDKError. Removes the hand-rolled grpcStatus struct + statusFromError helper + 4-line code constants block.
Summary
internal/adapters,go.mod,go.sumValidation
Cross-Agent Invariants
scripts/bootstrap-mcp.shremains the single source of truth for runtime prep (venv/deps/self-heal)codex mcp ...) are clearly separated from cross-agent/common instructionsSKILL.md,commands/rune/*.toml, andAGENT_INTEGRATION.mdstay consistent on boundariesNotes for Reviewers