Repository navigation
Client layer: rebase advertised links, refuse redirects, add calls the filesystems need - #60
Merged
Merged
Conversation
…s the filesystems need URLs the server advertises in `_links` are rebased onto the configured host so paging and download links work behind a proxy or port-forward. The session never follows a redirect, because `requests` would carry the `apiKey` header to the new host. `doDelete` tolerates a leading slash. `upload_file` and `upload_attachment_by_global_id` take `filename=`, `list_folder_tree` takes `page_size=`, and the Inventory client gains `get_workbench_by_id` and `attach_gallery_file_by_global_id`. Inventory CSV import goes through the shared session. The existing filesystem tests now expect the redirect flag on every request. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
tilorspace
added this pull request to stack #65
September 21, 2026 12:29
tilorspace
marked this pull request as ready for review
September 21, 2026 12:43
_rebase_url swapped scheme and host but kept the server's path, so a client configured with a path prefix (https://proxy/rspace) followed next-page and download links to https://proxy/api/v1/... and lost /rspace. Re-anchor the part from /api/ on under our own base path, the same base relative requests use. Links without /api/ keep their path. Raised in review of PR #60. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Covers the review's test gaps: doDelete single-slash URLs (regression for delete_document), upload_file and upload_attachment_by_global_id filename=, list_folder_tree page_size=, get_workbench_by_id id forms and includeContent, attach_gallery_file_by_global_id body, and CSV parse through the shared session with redirects off and the client timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tilorspace
added a commit
that referenced
this pull request
Oct 12, 2026
fs-stack/2 was rebased onto main after #60 was squash-merged; its content is unchanged, so the feature branch keeps its own tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tilorspace
added a commit
that referenced
this pull request
Oct 12, 2026
… suite (#61) A standard-library mock of the ELN (/api/v1) and Inventory (/api/inventory/v1) endpoints the filesystem classes use, under rspace_client/tests/mock_rspace. Nothing here is installed with the package. - server.py serves an in-memory dataset from fixtures.py and counts requests, so a test can assert what a listing costs. - The dataset carries the cases a filesystem has to get right: duplicate names, names that look like global IDs, system folders in Home, sections large enough to paginate, a document with text and non-text fields, a signed document, a bench with attachments. - conftest.py starts one server for the whole pytest session; MockServerTestCase resets its fixtures before every test. No test uses it yet; #68 adds the fsspec filesystem tests, the Galaxy contract test and the plugin check tool that run against it. Stack: part 2 of the original PyFilesystem stack (#58). Parts 3 to 5 (#62, #63, #64) were closed when the filesystem moved to fsspec; the client layer (#60) and this mock are framework-neutral and were kept. #68, the fsspec filesystem, is now based on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Changes to the two REST clients that the filesystem work needs, and fixes that stand on their own.
_linksare rebased onto the configured base URL, path prefix included. Next-page and download links then work behind a port-forward, in a container, or behind a proxy that serves RSpace under a sub-path such as/rspace.requestskeeps custom headers such asapiKeyacross a redirect to another host, which would hand the key to that host.doDeletetolerates a leading slash, which fixesdelete_document.ELNClient.upload_fileandInventoryClient.upload_attachment_by_global_idtake an optionalfilename=;list_folder_treetakespage_size=.InventoryClient.get_workbench_by_id(the containers endpoint answers 422 for a bench) andattach_gallery_file_by_global_id(the "link from Gallery" the web interface offers).upload_attachment_by_global_id.The existing filesystem tests are updated to expect
allow_redirects=Falseon every request.Review follow-up
https://proxy/rspacefollowed links tohttps://proxy/api/v1/...and lost/rspace.client_methods_test.pycovers each changed or new client method:doDeleteURLs, the multipartfilename=,page_size=,get_workbench_by_id,attach_gallery_file_by_global_id, and CSV import through the shared session./rspace: before the fix every followed link returned 404, after it ELN paging, Gallery downloads and Inventory paging all work. The Galaxy 26.1 file source works through the same proxy.Stack
This started as part 1 of a five-part stack towards a unified PyFilesystem (#58). On 2026-10-06 the filesystem moved to fsspec instead, so parts 3 to 5 (#62, #63, #64) were closed without merging. This client layer and the offline mock server (#61) don't depend on the filesystem framework and are kept.
rspace_client.fsas an fsspec filesystem, built on Add an offline mock of the RSpace ELN and Inventory APIs for the test suite #61; replaces Add rspace_client.fs: the Gallery, Inventory and ELN Workspace as one PyFilesystem #62 to Pin what Galaxy's RSpace file source relies on, and add a plugin check tool #64🤖 Generated with Claude Code