feat: show Creator continuity in Domovoy
CI / test (push) Failing after 15m2s

This commit is contained in:
m
2026-08-16 15:51:18 +03:00
parent eb343cd76e
commit 6a5550b7b0
10 changed files with 201 additions and 28 deletions
+28 -3
View File
@@ -20,7 +20,7 @@ func TestGatewayForwardsOnlyCreatorAllowlist(t *testing.T) {
_, _ = io.WriteString(w, `{"TaskID":"task-1"}`)
}))
defer upstream.Close()
handler, err := newHandler(upstream.URL, upstream.Client())
handler, err := newHandler(upstream.URL, upstream.URL, upstream.Client())
if err != nil {
t.Fatal(err)
}
@@ -34,7 +34,7 @@ func TestGatewayForwardsOnlyCreatorAllowlist(t *testing.T) {
}
func TestGatewayDeniesInternalAndMutationRoutes(t *testing.T) {
handler, err := newHandler("http://core-runtime:8080", http.DefaultClient)
handler, err := newHandler("http://core-runtime:8080", "http://continuity-runtime:8081", http.DefaultClient)
if err != nil {
t.Fatal(err)
}
@@ -42,6 +42,7 @@ func TestGatewayDeniesInternalAndMutationRoutes(t *testing.T) {
{http.MethodPost, "/api/tasks/task-1"},
{http.MethodGet, "/api/principal-bindings/actor/principal"},
{http.MethodPost, "/api/focus-task-commits"},
{http.MethodPost, "/api/prospective-items/item-1"},
{http.MethodGet, "/api/tasks/../../healthz"},
} {
request := httptest.NewRequest(test.method, test.path, nil)
@@ -53,8 +54,32 @@ func TestGatewayDeniesInternalAndMutationRoutes(t *testing.T) {
}
}
func TestGatewayRoutesProspectiveItemToContinuity(t *testing.T) {
continuity := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/v1/creator/prospective-items/item-1" {
t.Fatalf("unexpected Continuity target %s", r.URL.Path)
}
if r.Header.Get("Authorization") != "Bearer bounded-session" {
t.Fatal("authorization header was not forwarded")
}
_, _ = io.WriteString(w, `{"ID":"item-1"}`)
}))
defer continuity.Close()
handler, err := newHandler("http://core-runtime.invalid", continuity.URL, continuity.Client())
if err != nil {
t.Fatal(err)
}
request := httptest.NewRequest(http.MethodGet, "/api/prospective-items/item-1", nil)
request.Header.Set("Authorization", "Bearer bounded-session")
response := httptest.NewRecorder()
handler.ServeHTTP(response, request)
if response.Code != http.StatusOK || !strings.Contains(response.Body.String(), "item-1") {
t.Fatalf("response = %d %s", response.Code, response.Body.String())
}
}
func TestConsoleAndSecurityHeaders(t *testing.T) {
handler, err := newHandler("http://core-runtime:8080", http.DefaultClient)
handler, err := newHandler("http://core-runtime:8080", "http://continuity-runtime:8081", http.DefaultClient)
if err != nil {
t.Fatal(err)
}