Runtime controls and repository boundaries#4
Conversation
| func NewRouter(cfg config.Config) http.Handler { | ||
| router := chi.NewRouter() | ||
| router.Use(requestID) | ||
| requests := requestlog.NewService() |
There was a problem hiding this comment.
Request recording is created at the top router composition level because it is cross-service SandStack behavior. It should not leak into individual OpenStack service handlers.
| networkService := appnetwork.NewService() | ||
| volumeService := appvolume.NewService() | ||
|
|
||
| router.Mount("/_sandstack", admin.NewRouterWithState(func() { |
There was a problem hiding this comment.
The reset endpoint receives a single composed reset function. This keeps admin routing separate from the concrete services while still making reset behavior cover all in-memory runtime state.
| ) | ||
| } | ||
|
|
||
| func NewServiceWithRepository( |
There was a problem hiding this comment.
This constructor is the main app-layer boundary introduced in this PR: callers can supply a repository, clock, and ID generator without changing handler code. Other services follow the same replacement-friendly direction.
| } | ||
|
|
||
| return nil | ||
| func (s *Service) Reset() { |
There was a problem hiding this comment.
Reset is intentionally part of the runtime contract because SandStack needs disposable test state. It is not an OpenStack API behavior; the admin router is the only caller that should expose it.
9964df1 to
791c424
Compare
ba99115 to
6a40197
Compare
Summary
Main Review Points
Verification