chore(claude): encode model-naming convention + AsSpan-on-hot-paths rule - #48
Merged
Merged
Conversation
Two rules requested for encoding. Both framed to fit NextAurora's actual
context rather than as blanket assertions that would contradict existing
rules.
1. MODEL NAMING (intent-based, by role) — CLAUDE.md "Coding Standards" +
.coderabbit.yaml **/*.cs naming guidance.
The source tip was "prefer Request/Response over Dto." Encoded as the
convention NextAurora already follows, which is *more* intent-based:
- CQRS messages: *Command (writes) / *Query (reads) — more specific
than *Request (says write-vs-read + flows the Wolverine pipeline).
- gRPC contracts: *Request / *Response pairs (gRPC idiom).
- Read projections: *Dto — acceptable ONLY here (query-result shape;
not HTTP-coupled, so don't rename to *Response).
Rule in one line: generic *Dto on a REQUEST model hides intent — name
it by what it does; reserve *Dto for read projections. Deliberately
does NOT mandate "Request/Response everywhere" (that would downgrade
the write side from the more-specific Command/Query).
2. AsSpan over Substring — CLAUDE.md "Performance Rules" (right after
"Measure before optimizing", which governs it).
Zero-allocation slicing, real win in synchronous hot string loops.
Encoded with two guardrails so it's a narrow tool, not a default:
(a) governed by measure-before-optimizing — apply on profiled hot
paths, not reflexively; (b) Span<T> is a ref struct — can't cross an
await boundary, so rarely usable in NextAurora's async-everywhere
handlers. No such hot path exists today (string work is incidental;
bottleneck is always I/O), so the rule is explicitly preventative.
CLAUDE.md-only — no .coderabbit.yaml/reviewer surface (it's a
judgment-on-profiling call, not a code-shape check), same as the
streams rule.
Paraphrase-drift audit: run /check-rules locally to audit paraphrases
against this diff. Done — both rules are net-new; no existing
See-CLAUDE.md marker covers model-naming or AsSpan, so nothing to
realign. (The naming rule codifies the de-facto convention already
visible in the type names; AsSpan has no existing usage to conflict.)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review WalkthroughAdds intent-based model naming guidance (CQRS, gRPC, read projections) to reviewer config and docs, and a performance guideline advising ChangesCoding Standards and Performance Guidelines
🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Actionable comments posted: 0 |
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.
Summary
Encodes two rules (requested), both framed to fit NextAurora's actual context rather than as blanket assertions that would contradict existing rules.
1. Model naming (intent-based, by role)
Source tip: "prefer Request/Response over Dto." Encoded as the convention NextAurora already follows — which is more intent-based than the suggestion:
*Command(writes) /*Query(reads) — more specific than a generic*Request(says write-vs-read + flows the Wolverine pipeline)*Request/*Responsepairs (gRPC idiom, already used in CatalogService)*Dto— acceptable only here (query-result shape, not HTTP-coupled, so not renamed to*Response)Rule in one line: generic
*Dtoon a request model hides intent — name it by what it does; reserve*Dtofor read projections. Deliberately does not mandate "Request/Response everywhere" — that would downgrade the write side from the more-specificCommand/Query.Encoded in CLAUDE.md "Coding Standards" + a
.coderabbit.yaml**/*.csnaming line (flag a generic*Dtoon a new command/query; don't recommend renaming existing read-projection DTOs).2. AsSpan over Substring (profiled hot paths only)
Zero-allocation slicing — real win in synchronous, hot, string-heavy loops. Encoded with two guardrails so it's a narrow tool, not a default:
Span<T>is aref struct— can't cross anawaitboundary, so it's rarely usable in NextAurora's async-everywhere handlers (the compiler stops you).No such hot path exists today (string work is incidental; the bottleneck is always I/O), so the rule is explicitly preventative. CLAUDE.md "Performance Rules" only — no
.coderabbit.yaml/reviewer surface (it's a judgment-on-profiling call, not a code-shape check), same scoping as the streams rule.Paraphrase-drift audit (per CLAUDE.md change)
Run
/check-ruleslocally to audit paraphrases against this diff. Done — both rules are net-new; no existingSee CLAUDE.mdmarker covers model-naming or AsSpan, so nothing to realign. The naming rule codifies the de-facto convention already visible in the type names; AsSpan has no existing usage to conflict with. No drift.Note on the framing
I'd originally recommended against encoding both (the AsSpan tip is a micro-opt that doesn't fit an I/O-bound async app; the naming tip is superseded by NextAurora's CQRS naming). Per direction to add them, they're encoded as the NextAurora-accurate versions — capturing the real nuance (when AsSpan actually applies; why Command/Query beats generic Request) rather than blanket assertions that would conflict with "Measure before optimizing" and the CQRS naming already in use.
Test plan
**/*.cs🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Chores