feat: neuroglancer view (2/6): API — CRUD, read link, delete guard - #423
Draft
allison-truhlar wants to merge 8 commits into
Draft
feat: neuroglancer view (2/6): API — CRUD, read link, delete guard#423allison-truhlar wants to merge 8 commits into
allison-truhlar wants to merge 8 commits into
Conversation
…(mark_broken/cascade)
… mark-broken only
No cascade-delete of Views; delete guard discloses only the caller's own dependent Views (no cross-user leak) and marks all layers broken on confirm. sharing_mode is unenforced for now (future 'public' viewing PR).
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.
Neuroglancer Views — PR 2 of 6 (stacked)
The HTTP layer for Neuroglancer Views, stacked on #422 (PR 1, data model).
Backend-only; no frontend, no schema change / no migration.
Base: merge #422 first — this PR targets
ngviews-01-model.What's in this PR
/api/neuroglancer/views—POST(client-builtng_state+layer list; resolves each layer's Data Link
sharing_key→ id),GET(list),GET/{short_key},PUT/{short_key}(rename/restate),DELETE/{short_key}.All owner-scoped;
Viewresponses never exposeedit_key.GET /ngview/{key}— resolves byread_key, serves theView's
ng_stateJSON (Cache-Control: no-store) for the embedded NG iframe(PR 6). Read-only, unauthenticated, mirrors the existing
/ng/{short_key}.GET /api/proxied-path/{sharing_key}/views—the caller's own Views backed by a Data Link (powers the delete dialog and the
Properties "Appears in N Views" in PR 5).
DELETE /api/proxied-path/{sharing_key}takes aconfirmflag; returns 409 with the caller's own dependent Views whenunconfirmed; on confirm marks all layers on the link
brokenand deletes it.sharing_mode→Literal['private','read']; two DB helpers(
mark_view_layers_broken, owner-filteredget_views_for_data_link).Review decisions (product calls made during review)
Views. The 409 list and dependent-views endpoint are owner-scoped — other
users' Views are never disclosed. On confirm, all layers on the link are
marked
broken(any owner, for referential integrity) so other users' Viewsdegrade gracefully and surface as broken when opened. Follow-up: a broken
indicator in the other user's Data Links table.
sharing_modeis not enforced yet — every View is readable by itsread_key(bearer token);'private'is a stored label only. Follow-up: afuture PR adds
'public'(unauthenticated / listed) viewing + enforcement.{"detail": {message, dependent_views}}, unlike the app's usual{"error": str}(the globalexception handler stringifies dict details, so the route returns a
JSONResponsedirectly).Testing
pixi run -e test test-backend→ 787 passed. Covers CRUD round-trip +owner-scoping 404s, unknown-sharing-key 400,
/ngviewread-key resolution(short_key rejected, unknown 404,
no-store), the owner-filtered dependentlookup, and the delete guard (409 lists only own Views → confirm marks the
layer broken + deletes the link).
Stack