(NII-Proposal) feat(files): add dynamic file provider registry for foreign addon support - #1066
Draft
chiku-samugari wants to merge 1 commit into
Conversation
…port
The Files route was guarded by a build-time list of provider names, so a
storage service that GravyValet serves under any other name (a foreign
addon imp) could not be opened.
Changes:
- add `FileProviderRegistryService`, which accepts the built-in names
without a request and fetches the external storage service names from
GravyValet the first time it is asked for a name it does not know
- `metadata` is reserved and always refused as a file provider name
- the first time access of file detail page also triggers this
request because file GUIDs under `files/` are unknown names too
- make `isFileProvider` ask the registry asynchronously and it refuses
the name when the request fails
- fall back to the provider/display name in the connect toasts and the
disconnect dialog when the service has no entry in `AddonServiceNames`
- add `FileProviderType` to document that provider names can be dynamic
Tests:
- add a spec for `FileProviderRegistryService`: built-in and reserved
names need no request, one request serves concurrent and later
lookups, and the failure and timeout paths (report, loader, retry)
- rewrite the `isFileProvider` guard spec against a mocked registry,
including the refusal when the registry rejects
- add a spec for `AddonDialogService`, covering the name in the
disconnect dialog header
- revive the skipped specs of `ConnectConfiguredAddonComponent` and
`ConnectAddonComponent`: the router mock supplies the navigation
state that both components read in their constructor. They now cover
the create/update flows and the name in the success toast
chiku-samugari
force-pushed
the
feat/file-provider-dynamic-registry
branch
from
October 4, 2026 17:58
9fc8552 to
f54ef66
Compare
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.
Purpose
The Files route
/{guid}/files/{provider}is guarded byisFileProvider, which admits only the providernames listed in the build-time constant
FileProvider. A storage service that GravyValet serves under anyother name cannot be opened: the route does not match, the router falls through to the file-detail route,
and the page shows an empty file view for a file that does not exist.
GravyValet PR #318 (Foreign Addon Imps)
lets a deployment add storage add-on implementations as external packages. Such a service is registered in
GravyValet, served by osf.io and WaterButler, listed on the Add-ons page, and browsable in the files
widget of the project overview, but the Files page refuses its name. This PR extends that last build-time allow-list.
Summary of Changes
FileProviderRegistryService, the registry of valid provider names.FileProvidervalues are known from the start and are answered without any request.external_service_nameof every service returned by GravyValet'sGET /v1/external-storage-servicesand keeps the result until the page is reloaded.
ResourceService.getResourceByIddoes for the resource lookup of the
:idguards.isFileProviderask the registry asynchronously instead of the build-time list.FileProviderTypefor theproviderfield of the files state.The type states what the field holds with this PR: a built-in name, or a name that GravyValet lists.
This avoids an empty name in the success toasts and in the header of the disconnect dialog.
AddonDialogServiceConnectConfiguredAddonComponentandConnectAddonComponentthat coverthe create and update flows and the name in the success toast.
Screenshot(s)
n/a
Side Effects
/{guid}/files/{name}with a name other than the built-in providers sends one request to GravyValet(
GET /v1/external-storage-services) before the route is matched, once per page load. This includesthe file-detail URLs
/{guid}/files/{fileGuid}, which share the route prefix and do not use GravyValettoday.
providerof the files state can now be a name thatFileProviderdoes not list. The typeallowed this before (it resolved to
string), so this is a change of the values at run time, not of thetypes.
QA Notes
/{guid}/files/osfstorage,/{guid}/files/googledrive) opens as before;/{guid}/files/<name>opens, including on adirect page load and reload;
/{guid}/files/nope) is still rejected;/{guid}/files/{fileGuid}) opens as before.connecting show the service's name instead of an empty one;
with at least one foreign storage add-on registered.