Skip to content

Preserve dynamic anchor resource bases and caller scope - #424

Open
MbappeWU wants to merge 1 commit into
python-jsonschema:mainfrom
MbappeWU:fix-dynamic-anchor-resource-base
Open

MbappeWU wants to merge 1 commit into
python-jsonschema:mainfrom
MbappeWU:fix-dynamic-anchor-resource-base

Conversation

@MbappeWU

@MbappeWU MbappeWU commented Oct 5, 2026 •

Copy link
Copy Markdown

When a dynamic anchor selects an override nested inside camera.json, subsequent #/$defs/size references still resolve against base.json. The valid payload in python-jsonschema/jsonschema#1362 then raises PointerToNowhere.

Retain the matched dynamic resource URI without entering that resource's relative $id again. Record the actual caller in resolver history, rather than inferring it from the new target URI. This also distinguishes a foreign A#x reference whose initial target is replaced from a normal reference that first enters A and then follows #x. A later B#y correctly selects B in the first path and A in the second. Nonconsecutive revisits remain in the evaluation path; repeated consecutive callers do not grow the scope.

This follows Draft 2020-12 dynamic-reference URI replacement and dynamic scope. No public API, dependency, version or workflow changes are included. The anonymous-root registration handled by #367 remains separate; its private compatibility controls pass with this change. PR #423's empty-fragment lookup is also separate.

Validation:

  • Original Nox Python 3.14 coverage session: 508 passed, 100% coverage; unchanged baseline: 503 passed, 100%. Original style, typing, mypy and documentation-style sessions pass.
  • Full local pytest including the pinned suite: 810 passed, one existing pytest deprecation warning. The first collection attempt lacked jsonschema in the private environment; installing the suite dependency resolved collection without source or lockfile changes.
  • Exact final added regressions against immutable original source: 4 failed, 1 passed, 167 deselected. Final controls include the two real public paths, nested overrides without $id, cross-directory relative IDs, follow-up pointers, and repeated scope history.
  • Native Hatchling/hatch-vcs wheel and sdist pass strict Twine and archive integrity. All 14 runtime/typing files and 40 regular tracked sdist members match final source; the pinned suite Gitlink is excluded.
  • A fresh neutral Python 3.14 wheel install passes the five retained public regression methods. The original issue's three JSON blocks also validate successfully through jsonschema, while wrong-type and missing-field controls are rejected. The identical integration helper raises PointerToNowhere on the exact original implementation.
  • Independent AI code/URI review passes. An additional input-review agent could not start because of the agent thread limit; URI/input behavior was checked by that independent reviewer and directly by the primary agent. No second independent agent review is claimed.

Local spelling cannot run without native Enchant. The unmodified original CI in the fork now passes all 44 jobs at 8dc7a35, including all three spelling jobs, style, typing, mypy, documentation builders and packaging. Every Python 3.13/3.14/3.14t/3.15 test job across Linux, macOS and Windows reports 508 passed; the additional coverage job also passes. All original commands and matrices are retained.

The local full-history build produced 0.37.1.dev250+g8dc7a350b; the original shallow-checkout packaging job produced 0.1.dev1+g8dc7a350b. These are validation snapshots. Tag-only publishing steps were skipped, and the temporarily enabled fork scheduler was disabled after the exact run completed.

Upstream CI still requires maintainer approval. Upstream review, merge and release remain pending. No check or workflow was weakened.

AI assistance: OpenAI Codex and gpt-5.6-luna sub-agents prepared the implementation, regressions and review. These validations do not claim human review.

@MbappeWU
MbappeWU marked this pull request as ready for review October 5, 2026 23:08

This branch has not been deployed

No deployments
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