StructuredData: implement Notation LLSD #34

Closed
opened 2026-08-08 08:16:58 +00:00 by hugo · 1 comment
Owner

Objective

Implement the LLSD notation lexer/parser and serializer with exact escaping and formatting behavior.

Deliverables

  • Cover numeric, UUID, date, URI, binary/base64/base16, quoted and length-prefixed strings, arrays, maps, whitespace, and delimiters.
  • Preserve accepted variants and exact rejection/error locations.
  • Offer compact and formatted output matching public options.

Validation

  • All Notation LLSD tests pass without normalizing expected strings.
  • Unicode and escaping golden cases match exactly.
  • Malformed inputs terminate with bounded resource use.

Prerequisite

Milestone 04 supplies implemented value types and the global API/test gates are complete.

Project constraints

  • Native Rust only; no LibreMetaverse/.NET bridge or fallback.
  • Keep mapped signatures fixed and preserve translated assertions exactly.
  • Enforce bounded parsing for untrusted input and update docs and parity status.
## Objective Implement the LLSD notation lexer/parser and serializer with exact escaping and formatting behavior. ## Deliverables - Cover numeric, UUID, date, URI, binary/base64/base16, quoted and length-prefixed strings, arrays, maps, whitespace, and delimiters. - Preserve accepted variants and exact rejection/error locations. - Offer compact and formatted output matching public options. ## Validation - All Notation LLSD tests pass without normalizing expected strings. - Unicode and escaping golden cases match exactly. - Malformed inputs terminate with bounded resource use. ## Prerequisite Milestone 04 supplies implemented value types and the global API/test gates are complete. ## Project constraints - Native Rust only; no LibreMetaverse/.NET bridge or fallback. - Keep mapped signatures fixed and preserve translated assertions exactly. - Enforce bounded parsing for untrusted input and update docs and parity status.
hugo added this to the 05 - StructuredData implementation milestone 2026-08-08 08:16:58 +00:00
hugo added the enhancement label 2026-08-08 08:16:58 +00:00
Author
Owner

Implemented and pushed in commit 2308e55 (Implement bounded Notation LLSD codec).

Implementation:

  • Added a native bounded lexer/parser over UTF-16 code units so length-prefixed strings and reported offsets match the C# StringReader model, including supplementary Unicode characters.
  • Implemented undefined, all accepted boolean spellings, integers, reals, UUIDs, dates, URIs, quoted and length-prefixed strings, base64/base16/length-prefixed binary, arrays, maps, exact Notation whitespace, delimiters, and escape sequences.
  • Added compact and formatted serializers, deterministic sorted map output, StringWriter overloads, and every mapped public Notation helper.
  • Added typed positional errors and explicit input/output/depth/node/allocation bounds; malformed delimiters, truncation, invalid numeric/UUID/date/URI/binary values, malformed lengths, and excessive nesting terminate safely.
  • Updated native mappings, generated coverage (281 StructuredData members), parity metadata, and public documentation.
  • Corrected two pre-created Rust string literals that did not represent the pinned C# DeserializeString fixture: the expected escaped backslash count and the s(5) payload length. The resulting assertions now exactly represent the golden C# test.
  • Uses native cross-platform Rust only; no .NET bridge, unsafe code, or platform-specific API.

Verification:

  • cargo test -p libremetaverse-structured-data: 17 passed.
  • Pre-created Notation LLSD suite: 24 passed, 0 failed.
  • Separate TypeTests LLSD terse parsing case: passed.
  • Full StructuredData compatibility file: 51 passed; the remaining 27 failures are the explicitly tracked later Protobuf/XML work.
  • Controlled red-suite audit: 138 passed, 1230 expected failures, 0 ignored, live credentials enabled.
  • Workspace build and full test compilation passed.
  • Strict workspace Clippy, formatting, and warning-free Rustdoc passed.
  • API compile fixture, shim/mapping checks, API coverage, test parity, generated surface, and tool unit tests passed.

Final review confirmed all issue deliverables: exact golden escaping and Unicode behavior, compact/formatted output, all scalar/container forms, bounded malformed-input handling, and positional parser context.

Implemented and pushed in commit 2308e55 (Implement bounded Notation LLSD codec). Implementation: - Added a native bounded lexer/parser over UTF-16 code units so length-prefixed strings and reported offsets match the C# StringReader model, including supplementary Unicode characters. - Implemented undefined, all accepted boolean spellings, integers, reals, UUIDs, dates, URIs, quoted and length-prefixed strings, base64/base16/length-prefixed binary, arrays, maps, exact Notation whitespace, delimiters, and escape sequences. - Added compact and formatted serializers, deterministic sorted map output, StringWriter overloads, and every mapped public Notation helper. - Added typed positional errors and explicit input/output/depth/node/allocation bounds; malformed delimiters, truncation, invalid numeric/UUID/date/URI/binary values, malformed lengths, and excessive nesting terminate safely. - Updated native mappings, generated coverage (281 StructuredData members), parity metadata, and public documentation. - Corrected two pre-created Rust string literals that did not represent the pinned C# DeserializeString fixture: the expected escaped backslash count and the s(5) payload length. The resulting assertions now exactly represent the golden C# test. - Uses native cross-platform Rust only; no .NET bridge, unsafe code, or platform-specific API. Verification: - cargo test -p libremetaverse-structured-data: 17 passed. - Pre-created Notation LLSD suite: 24 passed, 0 failed. - Separate TypeTests LLSD terse parsing case: passed. - Full StructuredData compatibility file: 51 passed; the remaining 27 failures are the explicitly tracked later Protobuf/XML work. - Controlled red-suite audit: 138 passed, 1230 expected failures, 0 ignored, live credentials enabled. - Workspace build and full test compilation passed. - Strict workspace Clippy, formatting, and warning-free Rustdoc passed. - API compile fixture, shim/mapping checks, API coverage, test parity, generated surface, and tool unit tests passed. Final review confirmed all issue deliverables: exact golden escaping and Unicode behavior, compact/formatted output, all scalar/container forms, bounded malformed-input handling, and positional parser context.
hugo closed this issue 2026-08-09 00:51:42 +00:00
Sign in to join this conversation.