Skip to content

feat(validation): ✨ abort validation when the file descriptor is not valid JSON#181

Merged
kikkomep merged 3 commits into
crs4:developfrom
kikkomep:feat/unconditional-validation-abort
Jun 24, 2026
Merged

feat(validation): ✨ abort validation when the file descriptor is not valid JSON#181
kikkomep merged 3 commits into
crs4:developfrom
kikkomep:feat/unconditional-validation-abort

Conversation

@kikkomep

Copy link
Copy Markdown
Member

When the RO-Crate file descriptor (ro-crate-metadata.json) is not valid JSON, the metadata cannot be read, so every check that depends on it used to fail and flood the report with false positives.

This PR introduces an unconditional abort mechanism in the validation framework and uses it to fail fast on unparsable metadata: the "File Descriptor JSON format" check now reports a precise issue (parse error message and line/column) and aborts the run, so the only reported failure is the JSON-format one.

What changes

  • ValidationContext: add aborted/abort_reason state and an abort_validation() method
  • The validation loop, the per-requirement check loop, and the forced SHACL run now stop as soon as the context is aborted
  • The "File Descriptor JSON format" check (RO-Crate 1.1 and 1.2) catches JSONDecodeError, reports an ad-hoc issue with the error position, and aborts
  • Tests: assert the new "is not valid JSON" message and that an invalid-JSON crate aborts with exactly one issue and no false positives

kikkomep added 3 commits June 24, 2026 12:56
Add an abort mechanism to the validation framework so a check can stop the
whole run when the metadata is unreadable (e.g. the file descriptor is not
valid JSON), instead of letting later checks emit false positives.
…lidation

Make the "File Descriptor JSON format" check (RO-Crate 1.1 and 1.2) catch
JSONDecodeError explicitly: report a precise issue with the parse error
message and line/column, then call context.abort_validation() so no metadata
is read and downstream checks don't emit false positives.
@kikkomep kikkomep merged commit f113d1f into crs4:develop Jun 24, 2026
2 checks passed
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