Skip to content

fix(parse): register a filing's packages for that load only - #95

Merged
jfrench9 merged 1 commit into
mainfrom
bugfix/package-registrations-per-load
Oct 3, 2026
Merged

jfrench9 merged 1 commit into
mainfrom
bugfix/package-registrations-per-load

Conversation

@jfrench9

@jfrench9 jfrench9 commented Oct 3, 2026

Copy link
Copy Markdown
Member

Summary

Arelle keeps registered taxonomy packages for the life of the process, and xbrlkit never cleared them. In a long-running session (the MCP server) a load could therefore resolve through an earlier load's catalog. load_model now clears the registrations before each load, so a filing resolves through its own packages and no one else's.

Changes

parse/ (convert)

  • _register_packages calls PackageManager.reset() before registering the packages for the load, and when there are none.
  • parse/README.md says a package is registered for the one load.

Tests

  • Two new tests in tests/test_arelle_cache.py drive real Arelle, offline with a cold cache, over small synthetic packages. Both fail without the change.

Output Impact

INTERNAL for a filing loaded in a fresh process: its output is unchanged.

For a process that loads more than one filing, three wrong results go away. Each was reproduced on 0.20.7 with real Arelle:

  • A report with no package, loaded after a package that maps the URL it cites, read that package's taxonomy and loaded. In a fresh process it is refused with the URL unresolved, and now it is refused in both.
  • The same report, after the earlier filing had been unloaded and its files removed, loaded with no facts and no error. It is now refused.
  • Of two packages with different identifiers that map the same URL to different schemas, the first, loaded again after the second, was read through the second's schema and came back with no facts. It now reads its own.

Two versions of one real filing that share a package identifier were not affected before the change, in any load order, and are not affected after it.

Testing

  • The pre-commit hook ran ruff check, ruff format, basedpyright and the suite on the commit: 685 passed, 2 skipped.
  • The three cases above were run on synthetic packages before and after the change.
  • Real filings, one process, after the change: nine loads from filings.xbrl.org in sequence — a .xbri package (7245003GZ2696Y0W1X57-2026-03-31-ESEF-NL-0), a Danish report (549300DAQ1CVT6CXN342-2026-06-30-ESEF-DK-0), a backslash-zipped package (743700G7A9J1PHM3X223-2020-12-31-ESEF-FI-1), three ordinary ESEF packages, and a two-version pair of one filing loaded first, second, first. Fact counts match the same filings loaded in isolated processes.
  • An SEC 10-Q (NVDA 10-Q, parsed from EDGAR with the CDN turned off) loaded between two loads of the same ESEF package; the package's model was identical before and after.

🤖 Generated with Claude Code

Arelle keeps registered taxonomy packages for the life of the process, and
nothing cleared them, so in a long-running session a load could resolve
through an earlier load's catalog: a report with no package read an earlier
package's taxonomy (or, once that filing was unloaded, lost every concept),
and of two packages mapping the same URL the first, read again, was read
through the second. The registrations are now cleared before each load.
@jfrench9
jfrench9 merged commit 54b4761 into main Oct 3, 2026
4 checks passed
@jfrench9
jfrench9 deleted the bugfix/package-registrations-per-load branch October 3, 2026 21:17
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