Skip to content

Commit e57cf5b

Browse files
committed
Refactor deeply nested JSON to fix Windows CI C1060
The 9-level nested JSON initializer at line 549 exhausts MSVC compiler heap even with single-threaded builds on GitHub's 16GB Windows runners. Solution: Build the nested schema programmatically instead of using nested initializers. This significantly reduces compiler memory pressure while producing identical runtime results. Tested locally: All 30 Part 2a tests pass.
1 parent ee21a06 commit e57cf5b

1 file changed

Lines changed: 27 additions & 14 deletions

File tree

tests/server/interactions_part2a.cpp

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,31 @@ std::shared_ptr<server::Server> create_schema_edge_server()
520520
"tools/list",
521521
[](const Json&)
522522
{
523+
// Build deeply nested schema programmatically to avoid MSVC C1060 on CI
524+
Json value_schema;
525+
value_schema["type"] = "string";
526+
527+
Json level2_props;
528+
level2_props["value"] = value_schema;
529+
530+
Json level2_schema;
531+
level2_schema["type"] = "object";
532+
level2_schema["properties"] = level2_props;
533+
534+
Json level1_props;
535+
level1_props["level2"] = level2_schema;
536+
537+
Json level1_schema;
538+
level1_schema["type"] = "object";
539+
level1_schema["properties"] = level1_props;
540+
541+
Json nested_props;
542+
nested_props["level1"] = level1_schema;
543+
544+
Json nested_input_schema;
545+
nested_input_schema["type"] = "object";
546+
nested_input_schema["properties"] = nested_props;
547+
523548
return Json{
524549
{"tools",
525550
Json::array(
@@ -533,20 +558,8 @@ std::shared_ptr<server::Server> create_schema_edge_server()
533558
Json{{"name", "additional"},
534559
{"inputSchema",
535560
Json{{"type", "object"}, {"additionalProperties", true}}}},
536-
// Tool with deeply nested schema
537-
Json{{"name", "nested_schema"},
538-
{"inputSchema",
539-
Json{{"type", "object"},
540-
{"properties",
541-
Json{{"level1",
542-
Json{{"type", "object"},
543-
{"properties",
544-
Json{{"level2",
545-
Json{{"type", "object"},
546-
{"properties",
547-
Json{{"value",
548-
{{"type",
549-
"string"}}}}}}}}}}}}}}}}})}};
561+
// Tool with deeply nested schema (built programmatically)
562+
Json{{"name", "nested_schema"}, {"inputSchema", nested_input_schema}}})}};
550563
});
551564

552565
srv->route("tools/call",

0 commit comments

Comments
 (0)