| @@ -1099,6 +1099,7 @@ func TestCloudPublishSendsLocalRows(t *testing.T) { · 1098 unmodified lines |
| 1099 | 1099 | var snapshotID string |
| 1100 | 1100 | var sqliteImage []byte |
| 1101 | 1101 | var publishedSnapshot *crawlremote.ArchiveSnapshot |
| 1102 | + var publisherStatusSnapshotIDs []string |
| 1102 | 1103 | mutationCounter := 0 |
| 1103 | 1104 | server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 1104 | 1105 | if r.Method == http.MethodGet && r.URL.EscapedPath() == "/v1/contract" { |
| @@ -1216,6 +1217,10 @@ func TestCloudPublishSendsLocalRows(t *testing.T) { · 111 unmodified lines |
| 1216 | 1217 | return |
| 1217 | 1218 | } |
| 1218 | 1219 | if r.Method == http.MethodGet && strings.HasSuffix(r.URL.EscapedPath(), "/publish-status") { |
| 1220 | + publisherStatusSnapshotIDs = append( |
| 1221 | + publisherStatusSnapshotIDs, |
| 1222 | + r.URL.Query().Get("snapshot_id"), |
| 1223 | + ) |
| 1219 | 1224 | if publishedSnapshot == nil { |
| 1220 | 1225 | http.NotFound(w, r) |
| 1221 | 1226 | return |
| @@ -1382,6 +1387,15 @@ func TestCloudPublishSendsLocalRows(t *testing.T) { · 160 unmodified lines |
| 1382 | 1387 | if payload["sqlite_bundle"] == nil { |
| 1383 | 1388 | t.Fatalf("missing sqlite bundle output: %#v", payload) |
| 1384 | 1389 | } |
| 1390 | + for _, requestedSnapshotID := range publisherStatusSnapshotIDs { |
| 1391 | + if requestedSnapshotID != snapshotID { |
| 1392 | + t.Fatalf( |
| 1393 | + "publisher status requested snapshot %q, want %q", |
| 1394 | + requestedSnapshotID, |
| 1395 | + snapshotID, |
| 1396 | + ) |
| 1397 | + } |
| 1398 | + } |
| 1385 | 1399 | privacy, ok := payload["sqlite_bundle_privacy"].(map[string]any) |
| 1386 | 1400 | if !ok || privacy["includes_private_messages"] != true { |
| 1387 | 1401 | t.Fatalf("missing sqlite bundle privacy output: %#v", payload) |
| @@ -1749,6 +1763,7 @@ func TestCloudPublishStageOnlyThenResumesDefaultCutover(t *testing.T) { · 361 unmodified lines |
| 1749 | 1763 | uploadRequests := 0 |
| 1750 | 1764 | ingestRequests := 0 |
| 1751 | 1765 | publisherStatusRequests := 0 |
| 1766 | + var publisherStatusSnapshotIDs []string |
| 1752 | 1767 | readerStatusRequests := 0 |
| 1753 | 1768 | sqliteReadRequests := 0 |
| 1754 | 1769 | cutovers := 0 |
| @@ -1829,16 +1844,32 @@ func TestCloudPublishStageOnlyThenResumesDefaultCutover(t *testing.T) { · 74 unmodified lines |
| 1829 | 1844 | } |
| 1830 | 1845 | if r.Method == http.MethodGet && strings.HasSuffix(r.URL.EscapedPath(), "/publish-status") { |
| 1831 | 1846 | publisherStatusRequests++ |
| 1847 | + requestedSnapshotID := r.URL.Query().Get("snapshot_id") |
| 1848 | + publisherStatusSnapshotIDs = append( |
| 1849 | + publisherStatusSnapshotIDs, |
| 1850 | + requestedSnapshotID, |
| 1851 | + ) |
| 1852 | + if stagedSnapshot == nil { |
| 1853 | + http.NotFound(w, r) |
| 1854 | + return |
| 1855 | + } |
| 1856 | + statusSnapshot := stagedSnapshot |
| 1857 | + if requestedSnapshotID == "" { |
| 1858 | + concurrent := *stagedSnapshot |
| 1859 | + concurrent.ID = strings.Repeat("c", 64) |
| 1860 | + concurrent.SourceSHA256 = concurrent.ID |
| 1861 | + statusSnapshot = &concurrent |
| 1862 | + } |
| 1832 | 1863 | activeSnapshotID := "" |
| 1833 | | − if stagedSnapshot != nil { |
| 1834 | | − activeSnapshotID = stagedSnapshot.ID |
| 1864 | + if statusSnapshot != nil { |
| 1865 | + activeSnapshotID = statusSnapshot.ID |
| 1835 | 1866 | } |
| 1836 | 1867 | _ = json.NewEncoder(w).Encode(crawlremote.PublisherStatus{ |
| 1837 | 1868 | App: "gitcrawl", |
| 1838 | 1869 | Archive: "gitcrawl/openclaw__openclaw", |
| 1839 | 1870 | ActiveSnapshotID: activeSnapshotID, |
| 1840 | | − CoverageComplete: stagedSnapshot != nil, |
| 1841 | | − Snapshot: stagedSnapshot, |
| 1871 | + CoverageComplete: statusSnapshot != nil, |
| 1872 | + Snapshot: statusSnapshot, |
| 1842 | 1873 | }) |
| 1843 | 1874 | return |
| 1844 | 1875 | } |
| @@ -2095,6 +2126,15 @@ func TestCloudPublishStageOnlyThenResumesDefaultCutover(t *testing.T) { · 250 unmodified lines |
| 2095 | 2126 | if publisherStatusRequests != 7 { |
| 2096 | 2127 | t.Fatalf("publisher status requests = %d, want 7", publisherStatusRequests) |
| 2097 | 2128 | } |
| 2129 | + for _, requestedSnapshotID := range publisherStatusSnapshotIDs { |
| 2130 | + if requestedSnapshotID != snapshotID { |
| 2131 | + t.Fatalf( |
| 2132 | + "publisher status requested snapshot %q, want %q", |
| 2133 | + requestedSnapshotID, |
| 2134 | + snapshotID, |
| 2135 | + ) |
| 2136 | + } |
| 2137 | + } |
| 2098 | 2138 | if readerStatusRequests != 3 { |
| 2099 | 2139 | t.Fatalf("reader status requests = %d, want 3 serving-state checks", readerStatusRequests) |
| 2100 | 2140 | } |