feat(core): expose registered schemes via OperatorRegistry::schemes#7908
Merged
Conversation
Add a public OperatorRegistry::schemes() accessor that returns the set of registered schemes (HashSet<String>) as a thin read over the existing factories map. For the global registry this is exactly the set that Operator::from_uri can construct. Enrich the from_uri 'scheme is not registered' error with an 'available' context listing the registered schemes, so a wrong dialect or missing services-* feature surfaces an actionable hint instead of a bare error.
There was a problem hiding this comment.
Pull request overview
Adds a public accessor on OperatorRegistry to expose which URI schemes are registered at runtime, and enriches unsupported-scheme errors from load()/from_uri with an “available schemes” hint to make misconfigurations (wrong dialect / missing services-* feature) easier to diagnose.
Changes:
- Introduces
OperatorRegistry::schemes() -> HashSet<String>(with doctest) to expose registered schemes. - Enriches the unsupported-scheme error context with a sorted list of available schemes.
- Adds unit tests for the accessor and for the enriched error output.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
load() held the factories mutex while the ok_or_else closure called schemes(), which re-locked the same non-reentrant mutex and deadlocked on the unsupported-scheme path. Collect the available schemes from the guard already held instead of re-locking.
Member
|
The scheme availability is solid and thanks to bring PR this quick. I'll jump back to issues to clarify design a bit in details. |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #7904.
Rationale for this change
OperatorRegistryalready stores every registered scheme in its internalfactories: Mutex<HashMap<String, OperatorFactory>>, but there was no public way to read those keys back. For the global registry, that set is exactly whatOperator::from_urican construct, and it is otherwise unobservable at runtime (it is fully determined by the compiled-inservices-*features).Without it, a common mistake — a wrong dialect (
s3a://,gs://vsgcs://) or a missingservices-*feature — yields a barescheme is not registerederror with no hint about which schemes are available.What changes are included in this PR?
OperatorRegistry::schemes() -> HashSet<String>, a thin read over the existingfactoriesmap under the current lock.from_urischeme is not registerederror with anavailablecontext that lists the registered schemes (sorted), turning a bare error into an actionable hint.schemes().Output (py bindings)
Are there any user-facing changes?
Yes, additive only:
OperatorRegistry::schemes().from_uriunsupported-scheme error now carries an additionalavailablecontext field listing registered schemes. No existing field or error kind changes; not a breaking change.AI Usage Statement
This PR was prepared with the assistance of an AI coding agent (OpenCode, using an Anthropic Claude model) for implementation and drafting. All changes were reviewed by a human before submission.