docs(validation): give the context walker a true justification - #150
Conversation
- pyld does expose the flattened context via public process_context - what it does not do is resolve a term's scoped @context - callers expand with no document loader, so it cannot resolve later - successive calls share no memory, so the cycle bound stays here
Release previewNo version bump from the current commits (stays at Changelog preview (truncated)Preview via python-semantic-release and conventional commits. |
📊 Benchmark ResultsClick to see benchmark comparisonThreshold: 1.3x (30% slower triggers a regression warning) Note: Benchmarks are informational only and won't fail the build. 💡 Tip: Download the |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Conclusion holds, both mechanisms are stated wrong. Scoped context. So "by the time that reference is reached there is nothing left to resolve it against" is not the failure. What is true is that pyld does not keep the result: with a loader supplied, Cycles. pyld detects cyclic What has no memory is the hop-by-hop driving that #118 needs for provenance. Worth saying that, since as written it reads as "the processor is unguarded", and the real point is that recovering provenance is what costs you its guard. |
Both conclusions held, both mechanisms were wrong. process_context does not defer a scoped @context to expansion; it resolves eagerly and keeps nothing, raising invalid scoped context when no loader is available. And pyld does detect cyclic @context URLs within one call - what defeats the guard is driving the chain a hop at a time, which is what provenance requires.
📊 Benchmark ResultsClick to see benchmark comparisonThreshold: 1.3x (30% slower triggers a regression warning) Note: Benchmarks are informational only and won't fail the build. 💡 Tip: Download the |
The justification names what pyld does not return; that only holds while the two agree on everything else, and nothing checked it. Both are facts now: the effective term set matches across all 13 committed schemas, and a scoped @context comes back from process_context exactly as authored. Where a caller needs only the effective mapping, process_context is the better source - it applies JSON-LD's override semantics rather than terms()'s later-key-wins flatten.
📊 Benchmark ResultsClick to see benchmark comparisonThreshold: 1.3x (30% slower triggers a regression warning) Note: Benchmarks are informational only and won't fail the build. 💡 Tip: Download the |
Closes #118 by taking its second branch: "if it does not hold, record which specific capability is missing so the module has a justification that survives review."
The walker stays.
context_resolution.pyis unchanged apart from its docstring, which was arguing from a premise that had already been disproven.What was wrong
Two claims:
JsonLdProcessor.process_context.Diffed across all 13 top-level fixtures, pyld reproduces the walker's top-level flattening faithfully and in places better: it reports pre-expanded IRIs where the walker reports compact CURIEs, and on
Organization.schema.json'semployees, a@reverseterm, the walker's.get("@id")yieldsNonewhere pyld surfaces the reverse target.What is actually missing
process_contextnever resolves a term's scoped@context. It leaves the value exactly as authored and defers it to expansion, so{"@id": ..., "@context": "Pet.schema.json"}comes back as an unresolved string. Two committed fixtures use that form:Organization.schema.json(address) andPersonWithPet.schema.json(pets).That would be harmless if expansion could resolve it later, but the callers here expand without a document loader:
pipeline.py:487callscheck_predicateswith nooptions, andcheck_predicatesdefaultsoptionstoNone. Demonstrated onOrganization.schema.json's real context:So something has to embed the scoped content eagerly, which is most of what
_resolve_inlinedoes today.Successive calls share no memory of prior hops, so nothing stops a caller re-entering the processor around a reference cycle. The stack in
_walk_referenceandmax_scoped_depthin_resolve_inlineare that bound, and delegating the per-hop merge to pyld does not eliminate them.Verification
Docstring only, no code path touched.
mainmake check: exit 0