Stream negotiated canonical model reads with snapshot framing
Foundry Go checks / check (push) Failing after 10m37s
Foundry Go checks / check (pull_request) Failing after 10m45s

This commit is contained in:
2026-11-09 02:01:46 +08:00
parent ff88865e91
commit e38254821a
4 changed files with 198 additions and 0 deletions
@@ -214,6 +214,16 @@ func TestCanonicalModelMigrationAndIncrementalLifecycle(t *testing.T) {
if call("GET", base+"/model", nil, "", 200)["model"].(map[string]any)["complete"] != true {
t.Fatal("initial read has no explicit coverage")
}
// Negotiate the same authenticated canonical read as a streamed transfer.
streamRequest := httptest.NewRequest("GET", base+"/model", nil)
streamRequest.Header.Set("Authorization", "Bearer "+token)
streamRequest.Header.Set("Accept", modelStreamType)
streamWriter := httptest.NewRecorder()
mux.ServeHTTP(streamWriter, streamRequest)
streamed := streamRecords(t, streamWriter)
if streamWriter.Code != 200 || streamWriter.Header().Get("Content-Type") != modelStreamType || len(streamed) < 2 || streamed[0]["projectId"] != root || streamed[len(streamed)-1]["kind"] != "complete" || !modelEqual(streamed[0]["versions"], read().Versions) {
t.Fatal("authenticated stream lost canonical snapshot coverage")
}
// An object created and removed inside one transaction still has a lifecycle fact.
ghostID := modelTestID(4000)
ghost := modelTestNode(ghostID, root)