Admin audit: fix slow SQLite writes, remove gallery, route contact through /api#28
Merged
Merged
Conversation
modernc.org/sqlite ignores the mattn-style `_journal_mode=WAL` / `_foreign_keys=on` query params, so the DB was running in rollback-journal mode with synchronous=FULL and foreign keys OFF. A single content/settings save took 5-17s under any concurrent access. Use modernc's `_pragma=NAME(VALUE)` syntax to actually enable journal_mode(WAL), busy_timeout(5000), foreign_keys(on), synchronous(normal). Writes drop from seconds to sub-millisecond. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per product decision, remove the gallery entirely and consolidate all form submissions onto /api routes. Gallery removal (public + admin): - Drop routes: GET /gallery, GET /api/gallery, the /admin/gallery redirect, and all /admin/api/gallery* CRUD + the gallery image upload route. - Remove handlers (Gallery, AdminGallery, APIGetGalleryEditForm, APICreate/Update/Delete GalleryItem, APIUpdateGallerySortOrder, APIUploadImage), the gallery + admin_gallery templates, the GalleryItem model/converters, the gallery static-build output, and the GalleryCount stat. The DB table and sqlc queries are left in place (no destructive migration). Contact consolidation: - The contact form now POSTs to /api/contact, which persists via CreateContactSubmission and re-renders the page (previously /api/contact was a no-op stub and the form used POST /contact). Removed the duplicate POST /contact route + ContactSubmit handler. Also: clear the admin sidebar "Loading..." placeholder when Clerk is not configured (e.g. under the dev auth bypass) so it doesn't sit there forever. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Full audit of every admin page (Dashboard, Content, Contacts, Users, Settings) using Chrome DevTools, plus the fixes it surfaced. All five pages render correctly; the issues were functional.
modernc.org/sqliteignores the mattn-style_journal_mode=WAL/_foreign_keysDSN params, so the DB ran in rollback-journal mode withsynchronous=FULLand foreign keys off. Switched to modernc's_pragma=NAME(VALUE)syntax (WAL + busy_timeout + foreign_keys + synchronous=normal). Writes now sub-millisecond./gallery, the orphaned/admin/gallery, all/api/gallery*CRUD + handlers, templates, model/converters, static-build output,GalleryCountstat). DB table + sqlc queries left in place (no destructive migration)./api/contact, which actually persists (it was a no-op stub; the form used a separatePOST /contact). Removed the duplicatePOST /contacthandler so submissions go through one/apipath.Test plan
go build ./...+go build -tags dev ./...,go test -race ./...(both tags),golangci-lint run→ 0 issuesPRAGMA journal_mode=wal)/gallery,/admin/gallery,/api/galleryall return 404POST /api/contact(200); oldPOST /contact→ 405; admin pages all still 200🤖 Generated with Claude Code