Expand description
Hand-authored extension on crate::MaintenanceModule — the safe default route composer.
Why a separate file: the generator rewrites src/lib.rs’s generated impl region on every
metaphor make, so anything hand-added there is clobbered. This file is never touched by the
generator (declared in metaphor.codegen.yaml user_owned, wired via a // <<< CUSTOM pub mod
in lib.rs), so the delivery survives regen. Rust permits multiple impl MaintenanceModule blocks,
so the method lives here while the struct, builder, and generated all_crud_routes() stay in
lib.rs.
The invariant-bypass closure (council 2026-08-02, rec #1): the generated
crate::MaintenanceModule::all_crud_routes mounts unguarded generic CRUD — including a PATCH
whose DTO exposes status / parts_cost / total_cost / journal_id / accounting_post_id — on
MaintenanceVisit, so a caller can flip a visit to completed with no inventory issue and no
journal, routing around every invariant crate::MaintenanceWriteService enforces. The same
closure covers MaintenanceRequest: its generated PATCH would expose stage_id,
kanban_state, close_date, and the successor markers — the exact columns the
clone-on-done engine owns. The schema offers no attribute to restrict those PATCHes and
all_crud_routes is generated wholesale, so the closure is delivered here, at the composer: use
[Self::read_only_routes] as the production surface; reserve all_crud_routes() / routes() for
trusted/admin/seeding contexts. The validated write path (wiring MaintenanceWriteService and
MaintenanceRequestWriteService into the module) is a separate, later step.