fix(webui): mount the capture intake route from the receiver's constant
The bypass mux mounted captureintake's route from a local literal that duplicated captureintake.Path, with a comment acknowledging the drift risk: the kind of duplication that silently stops matching after a rename (archie-core-1175). Reference the constant instead, so the receiver owns the one spelling of the route and a rename there cannot unmount here. The existing routing tests are the drift coverage: TestCaptureIntakeMountedOnBypassMux drives Handler() with a POST to the real path, so a rename on either side that stopped matching would fail it; no new test is needed. This gives internal/webui its first infrastructure import -- the deleted literal existed so webui could mount an http.Handler without depending on the receiver's concrete package, but mounting by the owner's constant is exactly the boundary the intake cutover drew: webui mounts and reads, captureintake owns the write path.
This commit is contained in:
1 file changed
+5
-7
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/domain/messaging"
|
||||
"github.com/samcharles93/archie-core/internal/domain/storecontract"
|
||||
"github.com/samcharles93/archie-core/internal/events"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/captureintake"
|
||||
"github.com/samcharles93/archie-core/internal/logging"
|
||||
"github.com/samcharles93/archie-core/ui"
|
||||
)
|
||||
@@ -338,7 +339,10 @@ func (s *Server) Handler() http.Handler {
|
||||
top.HandleFunc(loginCallbackRoute, s.handleCallback)
|
||||
}
|
||||
if s.CaptureIntake != nil {
|
||||
top.Handle(captureIntakeRoute, s.CaptureIntake)
|
||||
// captureintake.Path is the single spelling of this route: the receiver
|
||||
// owns the route's semantics, so mounting re-spells nothing and a rename
|
||||
// there cannot silently unmount here.
|
||||
top.Handle(captureintake.Path, s.CaptureIntake)
|
||||
}
|
||||
// The chain runs after the credential check and before any handler: the
|
||||
// principal exists only once the credential resolved
|
||||
@@ -347,12 +351,6 @@ func (s *Server) Handler() http.Handler {
|
||||
return top
|
||||
}
|
||||
|
||||
// captureIntakeRoute is the bypass-mux route the host process's capture
|
||||
// receiver mounts on. captureintake.Path is the authority for the route's
|
||||
// semantics; this literal exists so webui can mount an http.Handler without
|
||||
// depending on the receiver's concrete package.
|
||||
const captureIntakeRoute = "POST /webhooks/capture/{source}"
|
||||
|
||||
// handleHealthz is a liveness probe for local, unauthenticated callers --
|
||||
// most notably the update watchdog script, which polls it after restarting
|
||||
// archied to decide whether the new version came up or the update needs to
|
||||
|
||||
Reference in new issue
Block a user