2424#include <store/store.h>
2525#include <pipeline/pipeline.h>
2626#include <foundation/log.h>
27+ #include <sqlite3.h>
2728
2829#include <string.h>
2930#include <stdlib.h>
@@ -1656,7 +1657,9 @@ TEST(contract_edge_parallel_service_edges) {
16561657 {"gql.py" , "def gql(query_string):\n return query_string\n" },
16571658 {"client.py" ,
16581659 "from gql import gql\n\n\ndef fetch_user():\n"
1659- " return gql(\"query GetUser { user { id name } }\")\n\n\n"
1660+ /* The embedded double quote survives extraction from this single-quoted
1661+ * Python string and breaks GRAPHQL_CALLS JSON unless operation is escaped. */
1662+ " return gql('query GetUser { user(name: \"quoted\") { id name } }')\n\n\n"
16601663 "def create_user():\n"
16611664 " return gql(\"mutation CreateUser { addUser(name: \\\"x\\\") { id } }\")\n" },
16621665 /* TRPC_CALLS: local createTRPCProxyClient (same-module resolution). */
@@ -1697,6 +1700,19 @@ TEST(contract_edge_parallel_service_edges) {
16971700 int grpc = store ? cbm_store_count_edges_by_type (store , lp .project , "GRPC_CALLS" ) : -1 ;
16981701 int trpc = store ? cbm_store_count_edges_by_type (store , lp .project , "TRPC_CALLS" ) : -1 ;
16991702 int infra = store ? cbm_store_count_edges_by_type (store , lp .project , "INFRA_MAPS" ) : -1 ;
1703+ int invalid_props = -1 ;
1704+ if (store ) {
1705+ sqlite3_stmt * stmt = NULL ;
1706+ sqlite3 * db = cbm_store_get_db (store );
1707+ if (db && sqlite3_prepare_v2 (db ,
1708+ "SELECT count(*) FROM edges WHERE properties IS NOT NULL "
1709+ "AND properties != '' AND json_valid(properties)=0;" ,
1710+ -1 , & stmt , NULL ) == SQLITE_OK &&
1711+ sqlite3_step (stmt ) == SQLITE_ROW ) {
1712+ invalid_props = sqlite3_column_int (stmt , 0 );
1713+ }
1714+ sqlite3_finalize (stmt );
1715+ }
17001716 if (graphql < 1 || grpc < 1 || trpc < 1 || infra < 1 ) {
17011717 fprintf (stderr ,
17021718 " [EDGE] parallel-service: GRAPHQL_CALLS=%d GRPC_CALLS=%d TRPC_CALLS=%d "
@@ -1709,6 +1725,7 @@ TEST(contract_edge_parallel_service_edges) {
17091725 ASSERT_TRUE (grpc >= 1 );
17101726 ASSERT_TRUE (trpc >= 1 );
17111727 ASSERT_TRUE (infra >= 1 );
1728+ ASSERT_EQ (invalid_props , 0 );
17121729 PASS ();
17131730}
17141731
0 commit comments