Skip to content

Fix 440 - #448

Open
BambOoxX wants to merge 4 commits into
JuliaIO:masterfrom
BambOoxX:fix-440
Open

BambOoxX wants to merge 4 commits into
JuliaIO:masterfrom
BambOoxX:fix-440

Conversation

@BambOoxX

@BambOoxX BambOoxX commented Oct 27, 2026 •

Copy link
Copy Markdown

The point of this PR is to solve #440.

In particular, it shows that the current implementation shadows (and breaks) any implementation that is not in the registry table of format/extensions/packages, if one implementation is already registered.

Main point of debate IMHO

Current situation

The main problem with the current implementation is that if somebody registers some format, the current implementation is breaking for any unregistered implementation.
This is exactly what happened in #440. I had a working implementation, and because @maucejo added his package to the registry table, that led to my own package failing its tests with newer versions of FileIO.jl.

Current solution

It is possible to use save(format"<FORMAT>", <path>, <data>) to avoid the issue, but that implies that FileIO.jlforces users with custom implementations to revise their codebase if the registry table is updated, something that feels somewhat brittle, especially given that the semantic versioning of registry table modifications is minor revision stage.
In addition, it sort of means that the registered package is "more important" that the unregistered one(s), since FileIO.jl errors if you don't load the official package, even if you have declared a proper implementation.

Proposal

While the initial implementation forces to use the first available format matching some extension, I propose to use the last one.
I know it defeats the loading order problem in Principle-of-operation:-module-qualification, but my opinion is that problem is already there, just reverted, between the official registry table and the custom implementation.
The logic behind choosing the last available implementation is the following

  • If no implementation is loaded : it falls back to the current behavior, error with suggestion to use the registered package for the selected extension
  • If one local implementation is loaded : allows to use it instead of failing
  • If multiple implementations are available :
    • uses the last one only if no magic byte is available or if the format is :UNKNOWN i.e. the only way to make a selection is the extension
    • uses the current behavior otherwise

Comments

  • This implementation solves the shadowing issue with respect to the official registry table.
  • It looks like it might lead to conflicts with current unofficial implementations due to loading order sensitivity, but I don't think there is a high probability of that
    • First, because the use case of having multiple packages for loading the same files is probably limited,
    • Second, because this case is limited to unregistered formats, since otherwise the official format takes precedence anyway
  • There are probably things I am missing, but I wanted to submit this for review since only minor modifications were required to pass the tests

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.96%. Comparing base (6f9b1a1) to head (20942d3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #448      +/-   ##
==========================================
+ Coverage   91.18%   91.96%   +0.77%     
==========================================
  Files          11       11              
  Lines         715      722       +7     
==========================================
+ Hits          652      664      +12     
+ Misses         63       58       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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