Skip to content

Fix date-shaped identifier misparsing in PROV-N and silent skipping of malformed PROV-JSON record bodies#20

Merged
amateescu merged 1 commit into
mainfrom
fix-date-shaped-identifiers-and-json-body-validation
Jul 6, 2026
Merged

Fix date-shaped identifier misparsing in PROV-N and silent skipping of malformed PROV-JSON record bodies#20
amateescu merged 1 commit into
mainfrom
fix-date-shaped-identifiers-and-json-body-validation

Conversation

@amateescu

Copy link
Copy Markdown
Owner

Changes

  • ProvNDeserializer: a date-prefixed token matching the full dateTime
    shape (e.g. 2024-01-15T100000) was parsed as a DateTimeImmutable
    whenever it matched that shape, regardless of grammar position. An
    identifier like entity(2024-01-15T100000) reused in wasGeneratedBy's
    entity slot would silently come back as a date instead of an identifier.
    Only the grammar position ($expectTime), not the token shape, can tell
    an identifier from a datetime — the check now gates on that.
  • JsonSerializer: add assertRecordBody(). A scalar record body such as
    {"entity":{"ex:e1":"notamap"}} was silently skipped (if (!is_array($instance)) continue;).
    It now throws DeserializationException, matching how other malformed
    PROV-JSON shapes are already handled. Covers entity/activity/agent
    records and both scruffy-list and single-instance relation bodies.
  • ProvNSerializer: cosmetic normalization of the lang-tag regex's
    character class ordering; no behavior change.
  • ConstraintValidator: doc comment correction — rules 22-23 are
    key/merging rules (unifying records that share an identifier across a
    document), distinct from the transitive graph reasoning rules
    (31-32, 35, 41-49) that are the rest of the unsupported set.
  • JsonLdSerializer: doc comment clarifying that a relation with a null
    subject formal is omitted from output, since JSON-LD attaches a relation
    as a property of its subject node.

@amateescu amateescu merged commit 76cf90e into main Jul 6, 2026
7 checks passed
@amateescu amateescu deleted the fix-date-shaped-identifiers-and-json-body-validation branch July 6, 2026 12:11
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