Skip to content

Fix serializer round-trip and robustness bugs (backslash, timezone, date-shaped ids, QName typing, out-of-range ints, anonymous nodes)#18

Merged
amateescu merged 1 commit into
mainfrom
fix/serializer-roundtrip-bugs
Jul 4, 2026
Merged

Fix serializer round-trip and robustness bugs (backslash, timezone, date-shaped ids, QName typing, out-of-range ints, anonymous nodes)#18
amateescu merged 1 commit into
mainfrom
fix/serializer-roundtrip-bugs

Conversation

@amateescu

Copy link
Copy Markdown
Owner

Changes

  • Reject qualified-name local parts containing a backslash when emitting PROV-N and PROV-JSON. PN_CHARS_ESC has no escape for backslash, so decode() cannot tell it from an escaped mark and the name would alias a different one on round trip. The check rides QualifiedNameEscaper::escape()'s existing scan.
  • Parse timezone-less xsd:dateTime values as UTC in the PROV-N, JSON, and XML deserializers, so a document's content no longer depends on the server's default timezone.
  • Treat a date-shaped PROV-N token as a malformed dateTime only when it sits in a formal time slot; a default-namespace identifier such as 2024-01-15-report now round-trips.
  • Validate PROV-JSON section shapes and throw DeserializationException for a scalar where a map is expected, instead of a raw TypeError or a silent zero-record parse.
  • Sign integers outside the 32-bit range as xsd:long in ValueIdentity, matching the serializers, so such a value and its Literal::long() equivalent dedupe and compare as equal.
  • Advance the blank-node counter past an attached bundle's _:bN labels in DocumentBuilder::addBundle(), so a later blank() cannot collide with them after flatten().
  • Emit anonymous records in PROV-JSONLD through a shared BlankLabelMinter (also used by the JSON serializer), which previously dropped them from the graph.
  • Detect the QName datatype by resolved URI so a document binding a non-standard prefix to the XSD namespace (xs:QName) is recognized in JSON and XML, keeping a literal fast path for the standard spellings.
  • Reject a negative ProvNSerializer indentation with a clear message rather than a raw str_repeat error.

@amateescu amateescu merged commit b57ff2a into main Jul 4, 2026
7 checks passed
@amateescu amateescu deleted the fix/serializer-roundtrip-bugs branch July 4, 2026 23:08
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