Merge updates from upstream#113
Merged
Merged
Conversation
Extend HttpRequester with `offline` and `no_cache` options, plus fetch_fresh/has_cached/clear_cache/cache_info/reset helpers. Add an OfflineCacheMissError and an _OfflineFallbackSession that yields a 504 when requests_cache is unavailable, mirroring the only-if-cached behavior. Emit standardized `CachedHttpRequester:` log lines describing each request's cache outcome.
Introduce `get_user_cache_dir()` (honoring `XDG_CACHE_HOME`, falling back to `~/.cache/rocrate-validator`) and `get_default_http_cache_path()`, plus the `USER_CACHE_DIR_NAME` / `USER_CACHE_FILE_NAME` constants, so the HTTP cache can be located under a stable, user-level directory instead of the previous `/tmp` prefix.
Cover the offline/no-cache flags, fetch_fresh, has_cached, clear_cache, cache_info, reset and the _OfflineFallbackSession 504 behavior, plus the standardized cache-outcome log messages.
Introduce `cache_warmup` helpers that discover external artifacts declared by profile descriptors via `prof:hasResource`/`prof:hasArtifact` and prefetch them so subsequent offline runs resolve every required resource from the local HTTP cache. Add the `ROCRATE_VALIDATOR_AUTO_WARM` environment variable to toggle automatic warm-up.
Introduce `install_document_loader()` that patches rdflib's `source_to_json` so remote `@context` resolution goes through HttpRequester, benefiting from the HTTP cache and honoring offline mode (raising OfflineCacheMissError on offline cache misses). The install is idempotent and reversible via `uninstall_document_loader()` for tests.
Expose `offline` and `no_cache` flags on ValidationSettings and default `cache_path` to the persistent user HTTP cache so consecutive online/ offline runs share the same store. Validate that `offline` and `no_cache` are mutually exclusive. Install the JSON-LD document loader so rdflib's remote `@context` resolution goes through the cache.
…e `validate` command
Introduce `rocrate-validator cache` with `info`, `reset` and `warm` subcommands to inspect, clear and pre-populate the persistent HTTP cache used by offline validation. `warm` discovers cacheable URLs from profile descriptors and can also prefetch remote RO-Crates.
…m-up and cache CLI
Redirect XDG_CACHE_HOME to a session-scoped tmp dir so tests never touch the developer's real ~/.cache, and default ROCRATE_VALIDATOR_AUTO_WARM=0 per test to prevent unintended network calls. Tests that need warm-up opt in explicitly.
validation statistics
extra_profiles_path
When a NodeShape lives in the profile root and does not declare sh:severity, fall back to the most severe level among its PropertyShapes instead of defaulting to REQUIRED. Also corrects the return type annotation of __compute_requirement_level__ from LevelCollection to RequirementLevel.
`ValidationResult.failed_requirements` and `failed_checks` now consider only issues whose severity is at least the configured `requirement_severity`, matching the behavior already documented for the validation context. Previously every recorded issue was returned, regardless of the threshold.
Skip sh:ValidationResult nodes whose check severity is below the requested `requirement_severity` while iterating pyshacl results, so they never become Issues. This makes every consumer of `ValidationResult._issues` consistent with the threshold (not just `failed_requirements`/`failed_checks`) and avoids materializing non-actionable violations.
…heck.get_source_snippet method
fix(validate): resolve profiles from --extra-profiles-path during validation
Rebuild `ShapesList.get_shape_property_graph` to include only triples reachable from the target property shape (constraints and RDF lists used by sh:and/sh:or/sh:xone) plus the `sh:property` link triple, instead of subtracting sibling properties from the node-shape graph. The previous subtractive approach could leak shared blank nodes and risked breaking sibling constructs in the merged shapes graph.
feat(cli): show requirement check via `describe profile`
feat(core): support offline validation and HTTP cache management
fix: support non-HTTP URI schemes for (Web)Data Entities (#176)
- 🚀 crate-ci/typos: v1.41.0 → v1.47.0 - 📦 actions/upload-artifact: v4 → v7 - 📥 actions/download-artifact: v4 → v8 - 🖊️ sigstore/gh-action-sigstore-python: v3.0.0 → v3.3.0
fix(http): reconfigure HttpRequester singleton in place instead of resetting it
Author
|
Skimmed the changes and there's nothing that touches files that we have changed, so no conflicts. And all tests pass! So I will go ahead and merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.