Skip to content

Take NosCore.Packets 21.1.0 and drop the manual mlintro escape - #2339

Merged
erwan-joly merged 1 commit into
masterfrom
drop-manual-caret-escapes
Aug 30, 2026
Merged

Take NosCore.Packets 21.1.0 and drop the manual mlintro escape#2339
erwan-joly merged 1 commit into
masterfrom
drop-manual-caret-escapes

Conversation

@erwan-joly

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

Copy link
Copy Markdown
Collaborator

Consumer half of NosCoreIO/NosCore.Packets#499, released as 21.1.0.

What the serializer now does

Spaces are encoded as ^ by the serializer in three cases, so callers stop doing it:

  • any string that is not the last field — this was the original defect, a spaced value split its own field and shifted every field after it
  • a string nested in a sub-packet, which has to escape the outer separator as well as its own; pinit mate names were going out as 10|Joyeux Mouton|0 and breaking the packet above
  • a field that declares EscapeSpaces, for text the client wants encoded wherever it sits — mlintro, the miniland message on mlinfobr, the family message on ginfo

What changes here

MlobjPacketHandler passes the message through as typed; MlintroPacket.Intro declares EscapeSpaces.

MlEditPacketHandlerTests asserted the caret on the packet object, which is no longer where it appears. It now checks the object carries the message as typed and pins mlintro Test^Test on the wire, so the escaping is still covered end to end rather than just deleted.

What deliberately stays

MinilandEntranceHandler keeps its Replace(' ', '^'). It writes onto MsgPacket, and five other call sites send that same field unescaped — "Your respawn location has been changed." among them — so the field cannot declare EscapeSpaces without mangling them. Making this one serializer-owned would need a second class on the msg header with AllowDuplicateHeader, which is worse than one line in the handler.

Fixed for free

Miniland.GenerateMlinfobr() sent MinilandMessage raw while MinilandEntranceHandler escaped the same string onto msg a few lines away, so a spaced miniland message rendered differently depending on which packet carried it. EscapeSpaces on MlInfoBrPacket settles that without a change here.

GInfoPacket.FamilyMessage gets the same treatment, which matters for #2283.

Tests

Full solution builds against 21.1.0 after a cache clear. GameObject 532, PacketHandlers 410, Parser 139, Database 11, Core 10, WebApi 17 — all green under the CI filter.

Summary by CodeRabbit

  • Bug Fixes

    • Miniland introductory messages now preserve spaces as entered, ensuring displayed messages remain readable and accurate.
    • Message serialization continues to handle required formatting automatically without altering the text shown to players.
  • Tests

    • Updated coverage verifies that miniland messages with spaces are transmitted and serialized correctly.

The serializer now encodes spaces as "^" itself: for any string that is not the
last field, for strings nested in a sub-packet, and for the few fields that
declare EscapeSpaces because the client wants them encoded wherever they sit.
MlintroPacket.Intro is one of those, so the handler passes the message through
as typed.

MlEditPacketHandlerTests asserted the caret on the packet object, which is no
longer where it appears. It now checks the object carries the message as typed
and pins "mlintro Test^Test" on the wire.

MinilandEntranceHandler keeps its substitution. It writes the message onto
MsgPacket, which five other call sites send unescaped, so the field cannot
declare EscapeSpaces without mangling those.
@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: 5d1fbb21-78d8-48a8-950f-f37346b09472

📥 Commits

Reviewing files that changed from the base of the PR and between ed9a693 and 83e3e27.

📒 Files selected for processing (3)
  • Directory.Packages.props
  • src/NosCore.PacketHandlers/Miniland/MlobjPacketHandler.cs
  • test/NosCore.PacketHandlers.Tests/Miniland/MlEditPacketHandlerTests.cs

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


Walkthrough

The NosCore.Packets package version is updated to 21.1.0. The miniland handler now passes message text to MlintroPacket without replacing spaces. Tests verify raw packet data and serialized caret encoding.

Changes

Miniland message encoding

Layer / File(s) Summary
Raw message flow and validation
Directory.Packages.props, src/NosCore.PacketHandlers/Miniland/MlobjPacketHandler.cs, test/NosCore.PacketHandlers.Tests/Miniland/MlEditPacketHandlerTests.cs
The package version is updated to 21.1.0. MlEditPacketHandler passes MinilandInfo directly to MlintroPacket. Tests verify "Test Test" before serialization and "mlintro Test^Test" after serialization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 83e3e

The change keeps miniland messages in their original form while preserving caret escaping on the client wire format. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies both main changes: upgrading NosCore.Packets to 21.1.0 and removing manual mlintro space escaping.
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

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch drop-manual-caret-escapes

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 b64f72d into master Aug 30, 2026
2 checks passed
@erwan-joly
erwan-joly deleted the drop-manual-caret-escapes branch August 30, 2026 01:20
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