Skip to content

Resolve taxonomy namespaces from trusted schema references - #182

Merged
manusimidt merged 1 commit into
manusimidt:mainfrom
mariuszlipinski:fix/referenced-schema-resolution
Aug 10, 2026
Merged

Resolve taxonomy namespaces from trusted schema references#182
manusimidt merged 1 commit into
manusimidt:mainfrom
mariuszlipinski:fix/referenced-schema-resolution

Conversation

@mariuszlipinski

@mariuszlipinski mariuszlipinski commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add opt-in namespace resolution from XSD URLs referenced by already parsed schemas and linkbases.
  • Preserve static mappings and trusted local-cache resolution ahead of referenced-schema fetching.
  • Restrict referenced candidates to schema hosts derived from the bundled namespace map, deduplicate and bound candidates, and require an exact normalized targetNamespace match.
  • Add the SEC CEF 2026 namespace mapping and focused coverage for schema references, linkbase references, relative URLs, trust boundaries, candidate bounds, mismatches, normalization, and local-cache host relationships.

Why

A filing can load a presentation or linkbase taxonomy that references the canonical schema declaring its fact namespace. If that canonical schema is absent from both the static map and local cache, the current parser cannot resolve the namespace even though an authoritative schema relationship was already parsed.

The new behavior is disabled by default. Callers must opt in, and unresolved namespaces continue to raise TaxonomyNotFound.

Dependency

PR #183 restores the upstream CI baseline with current Ruff and mypy releases and removes the external-network cache test. It is intentionally kept separate and must land before this resolver PR can show a green matrix.

Validation

  • ruff check xbrl/ns_map.py xbrl/taxonomy.py
  • ruff format --check xbrl/ns_map.py xbrl/taxonomy.py
  • mypy xbrl/ns_map.py xbrl/taxonomy.py --check-untyped-defs
  • ruff check tests/test_namespace_resolution.py tests/test_ns_map.py
  • ruff format --check tests/test_namespace_resolution.py tests/test_ns_map.py
  • mypy tests/test_namespace_resolution.py tests/test_ns_map.py --check-untyped-defs
  • pytest -q tests/test_namespace_resolution.py tests/test_ns_map.py — 10 passed
  • The resolver plus Stabilize CI with current tools and deterministic tests #183 changes pass the combined local suite with 22 tests

Comment thread tests/test_ns_map.py
from xbrl.ns_map import NS_MAP


def test_cef_2026_namespace_mapping() -> None:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this unit test is really necessary, but ok, better too much than to little :D

@manusimidt
manusimidt merged commit 95bb4c7 into manusimidt:main Aug 10, 2026
0 of 5 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.

2 participants