admin_ops — GeoPackage import and map-module composition over HTTP - #713
admin_ops — GeoPackage import and map-module composition over HTTP#713nofurtherinformation wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88c0751a4b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
peterrrock2
left a comment
There was a problem hiding this comment.
Responses to reviewer required section:
-
A non-UUID string in overlay_ids currently surfaces as a 500 from the existence check rather than a 422 (no injection risk — queries are parameterized and layer/slug fields are regex-validated).
- I would prefer to validate overlay_ids as UUIDs at the request boundary:
- malformed UUID -> 422
- valid but nonexistent UUID -> 404
- I would prefer to validate overlay_ids as UUIDs at the request boundary:
-
Confirm the scope choice (create:districtr_maps) is the boundary you want for composing modules.
- I think this is the appropriate boundary, assuming this scope continues to be issued only to CMS admins. It makes sense that an admin who can import the source data and create map modules can also configure other stuff about the module.
88c0751 to
59f2b1e
Compare
59f2b1e to
f411677
Compare
Two scope-gated endpoints so an admin UI can run data operations that were CLI-only: POST /api/admin/gerrydb/import and /api/admin/districtr-map/compose. Compose chains the same steps as the CLI commands (shatterable view when a child layer is given, create map, extent, parent-child edges, group membership, overlay links) as a background task, after validating cheap preconditions in-request so callers get 404/409 instead of a silent background failure. Modules are always composed hidden (visible=false) — flip them on after review. Nothing calls these until the CMS exists, so this is inert on deploy. 24 tests cover the scope gate, slug/SQL-identifier validation, step ordering, and the overlay attachment. Reviewer note: a non-UUID string in overlay_ids currently surfaces as a 500 from the existence check rather than a 422.
…alidation Review feedback on #713: - run_gerrydb_import commits its owned session: import_gerrydb_view's final gerrydbtable upsert lands after its last internal commit, so the registration was rolled back on close and compose 404'd on the layer. - create_parent_child_edges is now reached through create_or_copy_parent_child_edges, extracted from load_data's private wrapper: SET LOCAL statement_timeout='0' (large states exceed 120s) and copy a compatible map's edge partition instead of recomputing. - Layer identifiers validate via assert_safe_ident (leading digits are not valid unquoted PostgreSQL identifiers). - Shatterable slugs are rejected when slug + '_shatterable' would pass PostgreSQL's 63-char identifier limit and silently truncate. - child_layer must differ from parent_layer. - overlay_ids are typed UUIDs (malformed input 422s instead of a DataError 500). - The compose-time 'visible' flag is gone: modules always compose hidden, publishing is a deliberate second step after review. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
f411677 to
2963d20
Compare
|
Notes:
Responses to review comments
|
|
A lot of this PR is superseded by dev work relating to the graph updates. I think the actual endpoints and auth matters look good here, which is what matters most from this PR in the stack |
Description
Stacked on
cutover/pr3-comment-scoping. Inert on deploy: nothing calls these until the CMS exists.POST /api/admin/gerrydb/importandPOST /api/admin/districtr-map/compose.visible=false) — flip them on after review.Reviewers
Checklist
Screenshots (if applicable):
N/A — no UI.
Review required
overlay_idscurrently surfaces as a 500 from the existence check rather than a 422 (no injection risk — queries are parameterized and layer/slug fields are regex-validated).create:districtr_maps) is the boundary you want for composing modules.