Skip to content

fix: escape user strings in SDK code examples - #51

Merged
TMHSDigital merged 3 commits into
TMHSDigital:mainfrom
ect2000:fix/sdk-string-literals
Oct 25, 2026
Merged

TMHSDigital merged 3 commits into
TMHSDigital:mainfrom
ect2000:fix/sdk-string-literals

Conversation

@ect2000

@ect2000 ect2000 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

The SDK guide tools interpolate raw titles, paths, tags and lobby metadata into source strings. Quotes break those literals, Windows backslashes become escape sequences, and line breaks split the generated code.

Both guide generators now use a shared quoted-literal encoder. C# and GDScript use JSON-compatible escapes, including escaped line separators. C++ emits fixed-width octal for non-printable/non-ASCII UTF-8 bytes, avoiding both invalid control-character universal names and a following digit extending an escape. The guide's structured metadata remains unchanged.

Closes #36.

Verification:

  • Two regressions fail on the original code. After integrating current main (234d195), including the registerTool/annotation migration, npm test passes all 231 tests with the fix. The merge preserves both LOCAL_ONLY annotations and literal escaping.
  • The new tests call the actual registered tools over an in-memory MCP client/server connection. They cover quoted strings, CR/LF/tab characters, Windows content/preview paths, Workshop tags, lobby metadata in all three languages, empty strings and normal defaults.
  • npm run build passes.
  • A separate C++17 compilation and runtime check verifies generated literals preserve the expected UTF-8 bytes for quotes, paths, newlines, empty text, Unicode and control bytes followed by digits.

These are client-side SDK guides; there is no HTTP upload or lobby-creation endpoint, no API key is needed, and no Steam mutation was performed. The generated calls reference ISteamUGC and ISteamMatchmaking. I have not linked or executed the full examples against Steamworks, C# or Godot runtimes.

Signed-off-by: Emilio Castejón <107069576+ect2000@users.noreply.github.com>
@ect2000

ect2000 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

The SDK string fix and regression tests are ready for review. If there is another focused tool bug or maintenance task you would like help with, I have availability to continue. I am also interested in paid collaboration if you have a budget; we can agree on scope, fee and delivery before starting.

Signed-off-by: Emilio Castejón <107069576+ect2000@users.noreply.github.com>
Signed-off-by: Emilio Castejón <107069576+ect2000@users.noreply.github.com>
@TMHSDigital
TMHSDigital merged commit dc17b30 into TMHSDigital:main Oct 25, 2026
5 checks passed
TMHSDigital added a commit that referenced this pull request Oct 25, 2026
…parity (#54) (#75)

* fix: escape user strings in SDK guides

Signed-off-by: Emilio Castejón <107069576+ect2000@users.noreply.github.com>

* fix(sdk-guides): Steamworks.NET enum names, C# Workshop guide, input parity, registered call results

- createLobby: C# uses ELobbyType.k_ELobbyType* (Steamworks.NET keeps the
  native names); C++/C# register their CallResult; GDScript connects the
  signal and renames the shadowing connect parameter to this_connect
- uploadWorkshopItem: adds the promised Steamworks.NET C# block; GDScript
  sets description and tags; C++ registers CreateItem and SubmitItemUpdate
  call results and checks the Workshop legal agreement flag
- Tests for each, on top of #51's escaping

Fixes #54

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

---------

Signed-off-by: Emilio Castejón <107069576+ect2000@users.noreply.github.com>
Co-authored-by: Emilio Castejón <107069576+ect2000@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

SDK guide tools break generated code when inputs contain quotes or Windows backslash paths

2 participants