Files Plugin: OBO Gateway + Dev Playground#139
Open
atilafassina wants to merge 10 commits intoplugin/filesfrom
Open
Files Plugin: OBO Gateway + Dev Playground#139atilafassina wants to merge 10 commits intoplugin/filesfrom
atilafassina wants to merge 10 commits intoplugin/filesfrom
Conversation
* chore: add files route and UI to dev-playground Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Atila Fassina <atila@fassina.eu> * docs: regen --------- Signed-off-by: Atila Fassina <atila@fassina.eu> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces an OBO (on-behalf-of) gateway for the Files plugin so that all Files routes run under user context when a user token is present, and production requests without a user token are rejected. It also adjusts error propagation for auth-related SDK errors, fixes Files upload URL construction, and adds a dev-playground file browser route.
Changes:
- Add router-level middleware in Files plugin to establish user context via
resolveUserContext(req)+runInUserContext()for all downstream handlers. - Add
resolveUserContext(req)to the basePlugin, and allowexecute()to rethrowApiError401/403 so handlers can return those statuses. - Fix FilesConnector upload URL host normalization and add dev-playground UI/routes for browsing files.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/appkit/src/plugins/files/tests/plugin.test.ts | Updates router mock to include use() for new gateway middleware registration. |
| packages/appkit/src/plugins/files/plugin.ts | Adds OBO gateway middleware and refactors handlers to rely on context + bubble 401/403 ApiErrors. |
| packages/appkit/src/plugin/plugin.ts | Adds resolveUserContext() and changes execute() to rethrow ApiError 401/403. |
| packages/appkit/src/connectors/files/client.ts | Normalizes host to include scheme when building REST upload URL. |
| docs/docs/plugins.md | Documents OBO gateway and new user-context resolution approach. |
| docs/docs/api/appkit/Class.Plugin.md | Adds API docs for resolveUserContext() and updates asUser() throws section. |
| apps/dev-playground/client/src/routes/index.tsx | Adds “File Browser” card to the dev-playground index. |
| apps/dev-playground/client/src/routes/files.route.tsx | New file browser route UI backed by /api/files/* endpoints. |
| apps/dev-playground/client/src/routes/__root.tsx | Adds a nav link to the new Files route. |
| apps/dev-playground/client/src/routeTree.gen.ts | Updates generated route tree to include /files. |
| apps/dev-playground/app.yaml | Adds DATABRICKS_DEFAULT_VOLUME env binding for the dev-playground. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
This PR implements an OBO Gateway and prevents the Files Plugin from using the Service Principal in production.
injectRoutes()401when user token isn't foundresolveUserContext(req)toPlugin403401dev playground
app.ymlto setup UC resourcefiles-api-playground.mp4