From 966be7952b06a582104db5609c76085954c7f284 Mon Sep 17 00:00:00 2001 From: erwan-joly Date: Mon, 31 Aug 2026 10:58:51 +1200 Subject: [PATCH] docs: the serializer owns the wire format 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 --- CLAUDE.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 2376b1630..f8979711c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,6 +29,13 @@ noise to the line. Do not add it; the calls still in the tree are not a preceden **Keep semantic types.** Do not flatten a `bool` or an enum to a number because the wire value happens to be `0` or `1`; the serializer handles the conversion. +**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. + **Ship only what is wired.** No placeholder enums, handlers or UI for behaviour that does not exist yet. A data file listing a field is not a reason to expose it.