Phase 9 wiring: name the Hub project internet_control
The Hub routes by the project name in its human-owned routing.md, which already names this project `internet_control` (the placeholder row from the Hub brief). The frozen contract requires the /capabilities name to match that row, so /capabilities now reports `internet_control` as well. Found while wiring the live Hub (approved confirmation 60b235f3): the Hub routed the screen-time question to `internet_control` and returned `no_client` against a project registered as `internet_use_control`. Aligning the name, rather than editing the Hub repository or its routing file, makes the end-to-end round-trip work. Live proof after the rename and the Hub registration: POST http://192.168.20.13:8788/ask {"text":"how long have the kids been on screen today?","asker":"sam","source":"console"} 200 {"status":"ok","answer":"The kids have had 1h 22m of screen time today.", "route":{"kind":"project","project":"internet_control"}} Repository, module and service names are unchanged; only the Hub-facing project string changed. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -193,7 +193,7 @@ func TestPermissionsAndUnknowns(t *testing.T) {
|
||||
|
||||
func TestDefaultCapabilities(t *testing.T) {
|
||||
c := DefaultCapabilities()
|
||||
if c.Project != "internet_use_control" {
|
||||
if c.Project != "internet_control" {
|
||||
t.Errorf("project = %q", c.Project)
|
||||
}
|
||||
if len(c.Topics) == 0 || len(c.People) == 0 {
|
||||
|
||||
@@ -15,8 +15,12 @@
|
||||
// property, not a comment (TestAskWritesNothing).
|
||||
package hub
|
||||
|
||||
// ProjectName is the value the Hub matches in routing.md.
|
||||
const ProjectName = "internet_use_control"
|
||||
// ProjectName is the value the Hub matches in routing.md. The Hub's topic map
|
||||
// (and src/understand/rules.go) already names this project `internet_control`,
|
||||
// and the contract requires the /capabilities name to match that row, so this
|
||||
// is the Hub-facing name. The repository and the service keep the fuller
|
||||
// "Internet Use Control" name.
|
||||
const ProjectName = "internet_control"
|
||||
|
||||
// Capabilities is the GET /capabilities reply. The Hub reads it to route a
|
||||
// question to this project. Keep the topic list short and plain; it holds no
|
||||
|
||||
@@ -90,7 +90,7 @@ func TestCapabilitiesRequiresToken(t *testing.T) {
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil {
|
||||
t.Fatalf("decode: %v", err)
|
||||
}
|
||||
if body.Project != "internet_use_control" {
|
||||
if body.Project != "internet_control" {
|
||||
t.Errorf("project = %q", body.Project)
|
||||
}
|
||||
if len(body.Topics) == 0 {
|
||||
@@ -202,7 +202,7 @@ func TestNotifyDeliversThroughApprise(t *testing.T) {
|
||||
|
||||
srv, st := newHubTestApp(t, testHubToken, stub.URL)
|
||||
rec := hubRequest(t, srv.Handler(), http.MethodPost, "/notify",
|
||||
`{"from":"internet_use_control","level":"important","message":"3 emails need a decision.","person":"sam"}`,
|
||||
`{"from":"internet_control","level":"important","message":"3 emails need a decision.","person":"sam"}`,
|
||||
testHubToken)
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, want 200 (%s)", rec.Code, rec.Body.String())
|
||||
|
||||
Reference in New Issue
Block a user