Split bunyip-web's admin handlers and routes (DEV-517) #455
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/DEV-517-bunyip-web-admin-split"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes the bunyip-web half of DEV-517. Vas' note on the ticket: bunyip-web's admin panel had deviated too far from a8n-tools' structure (a8n splits handlers and isolates routing in
routes/admin.rs), so realign the panel toward a8n as part of this ticket. That is what this does. No behaviour change: same routes, same handlers, same 59 admin tests.What moved
bunyip-web/src/handlers/admin.rswas 7,965 lines and 155 handlers. It is nowhandlers/admin/, one module per section banner the file already carried: dashboard, audit, error_log, seed, ip_bans, rate_limits, users, memberships, feedback, applications, application_groups, entitlements, tier_settings, email_config, auto_ban_settings, backup, stripe, plustests. Largest file is nowusers.rsat 1,148 lines.main.rswired all 80 admin routes inline. They now live inbunyip-web/src/routes/admin.rsbehindroutes() -> Router<AppState>, merged bymain, which drops from 574 lines to 285.Three things the original banners did not line up with
#[cfg(test)]modules interleaved through the file tail, and each reaches across several sections (the markup tests alone touch applications, auto-ban, email, tier and users). Tearing them apart would have meant rewriting them, so they move together intohandlers/admin/tests.rs, which glob-imports each section module to re-expose the items under one name space. Everyuse super::...inside the test modules is unchanged.DocFormhad been appended under the Stripe banner. They move toapplications.email,email_save,email_test,EmailSettingsForm,email_update_body) had been appended under the auto-ban banner. They move toemail_config, which until now held only the settings-card markup.Visibility
Helpers that were private to one flat module are now private to a submodule. The ones another section or the tests reach are
pub(super): visible across the admin module tree, still invisible outside it. Same set of items, same call sites, nothing newly public on the crate surface.Five helpers that more than one section uses moved up into
handlers/admin/mod.rs:title_caseandpager(already shared),PageQuery(was in the memberships section, used by feedback and rate_limits),refuse_non_super_admin(was in ip_bans, used by rate_limits) andwith_attachment_hardening(was in feedback, used by backup and seed).Review notes
The commits are ordered so the mechanical parts are separable: the verbatim split, then the item moves, then the import prune, then the route extraction.
Route table equivalence was checked mechanically, not by eye: the same 80 path literals and the same 87 handler references, in the same order, before and after.
just check-build,just check-clippyandjust check-fmtare clean, andcargo test -p bunyip-webis 177 passed, the same as main.Not in this PR
The other DEV-517 follow-up, reconciling a8n's
userstable with bunyip's, is deliberately out. a8n has no feature that reads any of the eight columns it is missing, and the sqlx 0.7-vs-0.8 split blocks sharing theUserrow even once the columns match, so the a8n side starts with the sqlx upgrade instead (separate PR on a8n-tools/saas).