v0.185.1 — E-2: the offer endpoints were mounted where nothing routed to them

Registered as /api/backup-target inside ServeStorageAPI, which main.go mounts ONLY
at /api/storage/. Live result: endpoint not found, while every unit test passed --
the tests called the handlers directly and never travelled the mount. Caught by
the first live call, which is why the live call is part of the procedure.

Moved to /api/storage/backup-target[/assign]. A new test asserts the dispatcher
source contains both paths, so a handler nothing routes to fails the suite --
the seam-wiring rule applied to a route rather than a button.
This commit is contained in:
2026-07-29 09:13:13 +02:00
parent 3f7cf2a965
commit cdaeb36972
4 changed files with 53 additions and 4 deletions
+2 -2
View File
@@ -356,9 +356,9 @@ func (s *Server) ServeStorageAPI(w http.ResponseWriter, r *http.Request) {
s.handleStorageRegister(w, r)
// E-2 Parts 3+4. State drives the degraded banner and the OFFER; assign is the offer's
// ACCEPTANCE and the ONLY writer of the role — registration above deliberately does not set it.
case r.URL.Path == "/api/backup-target" && r.Method == http.MethodGet:
case r.URL.Path == "/api/storage/backup-target" && r.Method == http.MethodGet:
s.handleBackupTargetState(w, r)
case r.URL.Path == "/api/backup-target/assign" && r.Method == http.MethodPost:
case r.URL.Path == "/api/storage/backup-target/assign" && r.Method == http.MethodPost:
s.handleBackupTargetAssign(w, r)
case r.URL.Path == "/api/storage/migrate" && r.Method == http.MethodPost:
s.handleStorageMigrate(w, r)