Skip to content

Commit 889be82

Browse files
akoclaude
andcommitted
docs: add Recurring Finding #13 — Go type switch case body stealing
Caught in PR #475 review: inserting a new case between an existing case label and its body silently makes the original case a no-op. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d63dd37 commit 889be82

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

.claude/commands/mxcli-dev/review.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ proactively. Add a row after every review that surfaces something new.
3535
| 10 | BSON array items decoded by mongo driver are `primitive.D`, not `map[string]any` — bare type assertion `item.(map[string]any)` always fails silently, causing silent data loss (e.g. Languages not parsed, issue #480) | BSON parsing | Always use `extractBsonMap(item)` instead of `item.(map[string]any)`; write a parser unit test with `primitive.D` items to catch this class of bug |
3636
| 11 | `execShow` switch missing a case for a new `ShowXxx` constant — executor handler is wired but never dispatched, command silently does nothing | Dispatch gap | After adding a new `Show*` constant and handler, grep `executor_query.go` to confirm the case is present; add a mock test that calls the handler directly |
3737
| 12 | Mock test constructs a `Kind` value (e.g. `"Array"`) that `parseImportMappingElement` can never produce — parser only sets `"Object"` or `"Value"` — giving false assurance for a code path that is dead against real MPR data | Test coverage | Before writing a mock test for a fallback path, verify the parser can actually produce the mocked value; if not, either extend the parser or remove the dead fallback |
38+
| 13 | Go type switch: inserting `case TypeB:` between `case TypeA:` and its body silently empties TypeA — unlike regular switch, type switch has no fallthrough, so an empty case is a no-op (e.g. EnumSplitStmt handler stolen by InheritanceSplitStmt in PR #475) | Code correctness | Always give each type switch case its own complete block; never share a body by relying on fall-through |
3839

3940
---
4041

0 commit comments

Comments
 (0)