| @@ -694,7 +694,7 @@ func TestRemoteCloudModeDoesNotCreateLocalDB(t *testing.T) { · 693 unmodified lines |
| 694 | 694 | t.Setenv("HOME", dir) |
| 695 | 695 | t.Setenv("CRAWL_REMOTE_TOKEN", "test-token") |
| 696 | 696 | |
| 697 | | − var sawQuery bool |
| 697 | + var queryArgSets [][]string |
| 698 | 698 | server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 699 | 699 | if got := r.Header.Get("authorization"); got != "Bearer test-token" { |
| 700 | 700 | http.Error(w, "missing bearer", http.StatusUnauthorized) |
| @@ -723,7 +723,12 @@ func TestRemoteCloudModeDoesNotCreateLocalDB(t *testing.T) { · 22 unmodified lines |
| 723 | 723 | http.Error(w, "unexpected query", http.StatusBadRequest) |
| 724 | 724 | return |
| 725 | 725 | } |
| 726 | | − sawQuery = true |
| 726 | + argNames := make([]string, 0, len(req.Args)) |
| 727 | + for name := range req.Args { |
| 728 | + argNames = append(argNames, name) |
| 729 | + } |
| 730 | + sort.Strings(argNames) |
| 731 | + queryArgSets = append(queryArgSets, argNames) |
| 727 | 732 | _ = json.NewEncoder(w).Encode(crawlremote.QueryResult{ |
| 728 | 733 | Values: []map[string]any{{ |
| 729 | 734 | "thread_id": 10, |
| @@ -790,8 +795,10 @@ func TestRemoteCloudModeDoesNotCreateLocalDB(t *testing.T) { · 60 unmodified lines |
| 790 | 795 | if err := searchApp.Run(ctx, []string{"--config", configPath, "--json", "search", "openclaw/openclaw", "--query", "remote"}); err != nil { |
| 791 | 796 | t.Fatalf("remote search: %v", err) |
| 792 | 797 | } |
| 793 | | − if !sawQuery || !strings.Contains(searchOut.String(), `"remote search"`) { |
| 794 | | − t.Fatalf("remote search did not use worker query: saw=%v out=%s", sawQuery, searchOut.String()) |
| 798 | + if len(queryArgSets) != 1 || |
| 799 | + !slices.Equal(queryArgSets[0], []string{"limit", "mode", "owner", "query", "repo"}) || |
| 800 | + !strings.Contains(searchOut.String(), `"remote search"`) { |
| 801 | + t.Fatalf("remote search query args=%v out=%s", queryArgSets, searchOut.String()) |
| 795 | 802 | } |
| 796 | 803 | ghSearchApp := New() |
| 797 | 804 | var ghSearchOut bytes.Buffer |
| @@ -802,6 +809,10 @@ func TestRemoteCloudModeDoesNotCreateLocalDB(t *testing.T) { · 4 unmodified lines |
| 802 | 809 | if !strings.Contains(ghSearchOut.String(), `"number": 42`) || !strings.Contains(ghSearchOut.String(), `"url": "https://github.com/openclaw/openclaw/issues/42"`) { |
| 803 | 810 | t.Fatalf("remote gh search output = %s", ghSearchOut.String()) |
| 804 | 811 | } |
| 812 | + if len(queryArgSets) != 2 || |
| 813 | + !slices.Equal(queryArgSets[1], []string{"kind", "limit", "owner", "query", "repo", "state"}) { |
| 814 | + t.Fatalf("remote gh search query args=%v", queryArgSets) |
| 815 | + } |
| 805 | 816 | doctorApp := New() |
| 806 | 817 | var doctorOut bytes.Buffer |
| 807 | 818 | doctorApp.Stdout = &doctorOut |
| @@ -829,8 +840,15 @@ func TestRemoteCloudModeDoesNotCreateLocalDB(t *testing.T) { · 21 unmodified lines |
| 829 | 840 | func testSnapshotPublishContract() crawlremote.Contract { |
| 830 | 841 | contract := crawlremote.BaseContract() |
| 831 | 842 | contract.Apps = []crawlremote.AppSpec{{ |
| 832 | | − App: "gitcrawl", |
| 833 | | − Queries: gitcrawlCloudReaderQuerySpecs(), |
| 843 | + App: "gitcrawl", |
| 844 | + Queries: []crawlremote.QuerySpec{ |
| 845 | + {Name: "gitcrawl.threads.search", Args: []string{"owner", "repo", "query", "kind", "state", "mode", "limit"}}, |
| 846 | + {Name: "gitcrawl.clusters.related", Args: []string{"owner", "repo", "number"}}, |
| 847 | + {Name: "gitcrawl.clusters.list", Args: []string{"owner", "repo", "status", "min_size"}}, |
| 848 | + {Name: "gitcrawl.clusters.members", Args: []string{"owner", "repo", "cluster_id"}}, |
| 849 | + {Name: "gitcrawl.pull_requests.review_context", Args: []string{"owner", "repo", "number"}}, |
| 850 | + {Name: "gitcrawl.coverage", Args: []string{"dataset"}}, |
| 851 | + }, |
| 834 | 852 | IngestTables: []crawlremote.IngestTableSpec{ |
| 835 | 853 | {Name: "repositories", Columns: gitcrawlRepositoryColumns}, |
| 836 | 854 | {Name: "threads", Columns: gitcrawlThreadColumns}, |