Day 126 — Week Review + Recall¶
Month 5 · Week 2 · ⬅ Day 125 · Day 127 ➡ · Journal index
🎯 Learning Objective¶
Consolidate Week 2 — interceptors, auth, TLS, transcoding, reflection, and testing — through active recall and a written retrospective.
📚 Topics¶
- Interceptor chains (logging, recovery, auth) and chain order
- TLS/mTLS trust model · grpc-gateway transcoding · reflection/grpcurl · bufconn testing
📖 Reading / Sources¶
- Re-skimmed the week's notes (Days 120–125)
- gRPC-Go interceptor & auth examples
- Full week retrospective:
week-2-review.md
📝 Notes¶
- This is a lighter review day — the full retrospective, re-quiz, metrics, and next-week goals live in
week-2-review.md. - One-line throughline: gRPC's production concerns are middleware + transport + tooling — interceptors add cross-cutting behavior, TLS secures the channel, the gateway opens a REST door, and reflection/bufconn make services testable and pokeable → [[interceptors]] [[tls]] [[grpc-gateway]].
- The pattern that recurred all week: a function that wraps another function — interceptors, the gateway proxy, and the bufconn dialer are all variations of composition.
💻 Code Examples¶
// The week in one signature — everything hangs off this wrapper shape:
type UnaryServerInterceptor func(
ctx context.Context, req any,
info *UnaryServerInfo, handler UnaryHandler,
) (resp any, err error)
Run this week's stdlib rebuilds:
go run ./examples/month-05/interceptors·.../authmeta·.../tls·.../transcoding
🏋️ Exercises / Practice¶
| Exercise | Status | Link |
|---|---|---|
All Week 2 exercises pass go test |
✅ | exercises/month-05/week-2 |
🐛 Mistakes Made¶
- None new today — review day. Carried-over fixes (named returns for recovery,
status.Codeover string-match) are logged in their day notes.
❓ Open Questions¶
- See the consolidated open questions in the week review.
🧠 Active Recall (answer without looking)¶
- Q: Put these interceptors in the order you'd chain them and say why: auth, logging, recovery.
A
Logging (outermost) → recovery → auth (innermost, nearest the handler). Logging sees everything including recovered errors; recovery catches panics from both auth and the handler; auth runs last before the handler so it can reject early.- Q: Name the four pieces of the TLS trust check a client performs.
A
(1) the server cert's signature chains to a CA in the client's `RootCAs`, (2) the cert is within its validity window, (3) the requested ServerName matches the cert's SAN, (4) the key usage/EKU permits server auth. Only then does data flow.🪶 Feynman Reflection¶
Week 2 turned a bare gRPC service into a real one: I wrapped it in interceptors so logging, recovery, and auth live in one place; sealed the channel with TLS; gave it a REST front door with grpc-gateway; made it self-describing with reflection; and pinned it down with fast bufconn tests. The unifying trick is composition — wrap a handler, wrap a connection, wrap a transport.
🕳️ Knowledge Gaps¶
- Streaming interceptors and streaming tests remain the thinnest spots — top of next week's list.
✅ Summary¶
Week 2 done: I can build and order interceptors, secure transport with TLS/mTLS, transcode to REST, discover services with grpcurl, and test the full stack over bufconn. Confidence solidly in the 3–4 band.
⏭️ Next Steps / Prep for Tomorrow¶
- Week 3: service architecture — project layout, dependency injection, and config. See week review → next-week goals.
| Time spent | Difficulty | Confidence |
|---|---|---|
| 90 min | 🟦⬜⬜⬜⬜ | 🟦🟦🟦🟦⬜ |
Suggested commit: docs(journal): month 5 week 2 review (day 126)