| name | fake-server-protocol-validation |
| description | Use when implementing, reviewing, or testing a fake/stub database protocol server such as FakeSentinel, FakeMySQL, fake mongos, or Redis Cluster emulation. Forces golden real-server protocol comparison, protocol-aware response reads, command matrix classification, and explicit known-delta signoff instead of trusting high-level SDK behavior. |
| allowed-tools | Bash(go test *) Bash(rg *) Read |
Fake Server Protocol Validation
Hard Rules
- Compare against a real server. A fake server is not compatible until the same raw request has been sent to both real and fake implementations.
- Validate protocol frames, not only SDK results. Client SDKs can hide fallback, retries, and tolerant parsing.
- Use a protocol-aware reader. Read exactly one complete response according to the protocol grammar; never read "N lines" or "until timeout".
- Classify every delta. Each command is
full match, known content delta, known type delta, or blocker.
- Client-consumed fields are mandatory. A fake may omit unused metadata only after the supported client read set is listed and verified.
- Unknown type mismatch blocks merge. Do not accept
+ vs *, $ vs -, OK vs ERR, or equivalent protocol type drift without explicit architecture signoff.
- Final report must separate matches, known deltas, and blockers.
When To Invoke
Use this skill when:
- implementing a fake / stub database protocol service
- reviewing a fake server PR
- adding golden protocol tests for FakeSentinel, FakeMySQL, fake mongos, Redis Cluster emulation, or similar services
- debugging a client that silently fails or behaves differently against the fake service
- someone says "the SDK test passed" but no raw protocol comparison exists
Common trigger phrases: fake server protocol compat check, fake server RESP validation, golden protocol comparison, FakeSentinel compatibility.
Workflow
-
Start both services
- Real server: the closest supported upstream version.
- Fake server: the implementation under review.
- Keep fixtures minimal and deterministic.
-
Send identical raw requests
- Use the same command bytes for real and fake.
- Include happy paths and negative paths.
-
Read one complete response
- RESP: simple string / error / integer = one line; bulk string = length + bytes; array = recursive elements.
- Other protocols: use packet/header length rules.
- A timeout is a test failure, not a successful read strategy.
-
Normalize only volatile values
- Allowed: generated IDs, timestamps, endpoint addresses, bulk length markers when payload is compared separately.
- Not allowed: protocol type, array shape, error-vs-success semantics, required client fields.
-
Classify each command
| Category | Meaning | Review Action |
|---|
full match | Frame type and normalized payload match | Accept |
known content delta | Same frame type; documented content difference | Accept only if client-read fields are covered |
known type delta | Frame type differs with explicit architecture reason | Rare; needs owner signoff |
blocker | Unknown delta, missing required field, or wrong type | Fix before merge |
- Verify client field coverage
- List the fields read by each supported client/library.
- Prove those fields exist in the fake response.
- Add a subtest for field coverage if the response intentionally omits real-server metadata.
Review Checklist
Before approving:
Closeout Format
Use a specific closeout:
Protocol validation passed: real and fake services compared with raw requests; reader is protocol-aware; command matrix has N full matches and M documented known deltas; supported client fields are covered; no unclassified type mismatch remains.
Avoid vague closeouts:
Fake server works with the client.
Related Docs
docs/addon-fake-server-protocol-validation-guide.md