Skip to content

CLAUDE.md: the serializer owns the wire format - #2367

Merged
erwan-joly merged 1 commit into
masterfrom
docs/serializer-owns-the-wire
Aug 30, 2026
Merged

CLAUDE.md: the serializer owns the wire format#2367
erwan-joly merged 1 commit into
masterfrom
docs/serializer-owns-the-wire

Conversation

@erwan-joly

@erwan-joly erwan-joly commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

What

One rule under Code conventions, next to Keep semantic types — the same class of mistake, one level further along:

The serializer owns the wire format. Never massage a value to fit it: no Replace(' ', '^') before assigning a field, no manual padding, no hand-built separator. A field that needs escaping says so on the packet property — EscapeSpaces for the one that ends the line — so the fix belongs in NosCore.Packets and ships as a version bump. A Replace here to make a packet come out right is a defect, including as a stopgap while the package catches up.

Why

GInfoPacket, MlInfoBrPacket and MlintroPacket already declare EscapeSpaces for a last field that carries a value rather than free text. EInfoNpcMonsterPacket.Name did not, and #2365 was about to ship Replace(' ', '^') at the call site to compensate — knowingly, with a comment saying the flag belonged in the package. That shortcut is easy to reach for because it works, and it leaves the wire knowledge in two repos.

The packet side is fixed in NosCoreIO/NosCore.Packets#509, released as 21.1.2.

Summary by CodeRabbit

  • Documentation
    • Clarified code conventions for preserving serializer-owned wire formats.
    • Documented that escaping and formatting fixes should be addressed in the packet serialization layer rather than through manual value manipulation.

Three packets already declare EscapeSpaces for a last field that is a value
rather than free text, and the fourth was about to get a Replace(' ', '^')
at the call site instead - the second time that shortcut has been proposed.
Write the rule down so the next one goes to the package.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b65d561-0bda-48d2-994a-6edc60db38d7

📥 Commits

Reviewing files that changed from the base of the PR and between 177abad and 966be79.

📒 Files selected for processing (1)
  • CLAUDE.md

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

The change adds a code convention that assigns wire-format ownership to the serializer. It prohibits value transformations for packet formatting and directs escaping fixes to NosCore.Packets packet properties.

Changes

Serializer conventions

Layer / File(s) Summary
Wire-format and escaping guidance
CLAUDE.md
Documents serializer-owned wire formatting, prohibits replacements, manual padding, and hand-built separators, and assigns escaping changes to EscapeSpaces in NosCore.Packets.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to 966be

This localized documentation change clarifies that wire-format handling belongs in the serializer and does not alter runtime behavior; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main documentation change: establishing that the serializer owns the wire format.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/serializer-owns-the-wire

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@erwan-joly
erwan-joly merged commit 543edb7 into master Aug 30, 2026
2 checks passed
@erwan-joly
erwan-joly deleted the docs/serializer-owns-the-wire branch August 30, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant