Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ build_target() {
}

build_target "${SRC}/verisimdb/fuzz" fuzz_octad_id
build_target "${SRC}/verisimdb/fuzz" fuzz_vql_parser
build_target "${SRC}/verisimdb/fuzz" fuzz_vcl_parser

# Optional seed corpora — empty for now, will populate as we discover
# interesting inputs. Comment in once corpora exist:
# cp -r "${SRC}/verisimdb/fuzz/corpus/fuzz_octad_id" "${OUT}/fuzz_octad_id_seed_corpus" 2>/dev/null || true
# cp -r "${SRC}/verisimdb/rust-core/fuzz/corpus/fuzz_vql_parser" "${OUT}/fuzz_vql_parser_seed_corpus" 2>/dev/null || true
# cp -r "${SRC}/verisimdb/rust-core/fuzz/corpus/fuzz_vcl_parser" "${OUT}/fuzz_vcl_parser_seed_corpus" 2>/dev/null || true
2 changes: 1 addition & 1 deletion examples/load-sample-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ for vql_file in "${VQL_DIR}"/*.vql; do
# Escape double quotes in the query for JSON payload
ESCAPED_QUERY=$(echo "$QUERY" | sed 's/"/\\"/g')

RESULT=$(curl -sf -X POST "${API_URL}/vql/execute" \
RESULT=$(curl -sf -X POST "${API_URL}/vcl/execute" \
-H "Content-Type: application/json" \
-d "{\"query\": \"${ESCAPED_QUERY}\"}" 2>/dev/null || echo '{"error": "query execution failed or server unreachable"}')

Expand Down
2 changes: 1 addition & 1 deletion examples/smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ fi

# 4. Execute a VQL query — test the query engine
echo "4. VQL query"
VQL_RESP=$(curl -sf -X POST "${API_URL}/vql/execute" \
VQL_RESP=$(curl -sf -X POST "${API_URL}/vcl/execute" \
-H "Content-Type: application/json" \
-d '{"query":"SELECT * FROM hexads LIMIT 5"}' 2>/dev/null || echo "FAILED")

Expand Down
6 changes: 3 additions & 3 deletions ffi/zig/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Targets recent Zig (0.14+).
| GET | `/api/v1/health` | Combined (gateway + Rust + Elixir)
| GET | `/api/v1/octads*` | Rust core
| POST | `/api/v1/octads` | Rust core
| POST | `/api/v1/vql/execute` | Rust core
| POST | `/api/v1/vcl/execute` | Rust core
| GET | `/api/v1/drift/*` | Rust core
| GET/POST | `/api/v1/search/*` | Rust core
| GET | `/api/v1/provenance/*` | Rust core
Expand All @@ -90,14 +90,14 @@ type Query {
}

type Mutation {
executeVql(query: String!): VqlResult
executeVcl(query: String!): VclResult
}
----

Variables expected:

* `driftScore` — `variables.entityId` (string)
* `executeVql` — `variables.query` (string)
* `executeVcl` — `variables.query` (string)

== Configuration (env vars)

Expand Down
22 changes: 11 additions & 11 deletions ffi/zig/src/graphql.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Minimal GraphQL routing — parses { "query": "...", "variables": {} } and
// dispatches by query-substring to backend HTTP calls. Matches the V gateway's
// field-routing approach: not a full GraphQL parser, but enough to expose
// health / telemetry / octads / driftScore / executeVql.
// health / telemetry / octads / driftScore / executeVcl.

const std = @import("std");
const Config = @import("config.zig").Config;
Expand Down Expand Up @@ -93,30 +93,30 @@ pub fn handle(
}
}

// executeVql mutation
if (std.mem.indexOf(u8, query, "executeVql") != null or
// executeVcl mutation
if (std.mem.indexOf(u8, query, "executeVcl") != null or
std.mem.indexOf(u8, query, "mutation") != null)
{
const vql_val = variables.get("query") orelse {
return errorBody(allocator, 200, "VQL mutation requires variables.query");
const vcl_val = variables.get("query") orelse {
return errorBody(allocator, 200, "VCL mutation requires variables.query");
};
if (vql_val != .string) {
if (vcl_val != .string) {
return errorBody(allocator, 200, "variables.query must be a string");
}
const payload = try std.fmt.allocPrint(allocator, "{{\"query\":\"{s}\"}}", .{vql_val.string});
const payload = try std.fmt.allocPrint(allocator, "{{\"query\":\"{s}\"}}", .{vcl_val.string});
defer allocator.free(payload);
const url = try std.fmt.allocPrint(allocator, "{s}/vql/execute", .{cfg.rust_url});
const url = try std.fmt.allocPrint(allocator, "{s}/vcl/execute", .{cfg.rust_url});
defer allocator.free(url);
if (proxy.postJson(allocator, url, payload)) |r| {
defer allocator.free(r.body);
const out = try std.fmt.allocPrint(
allocator,
"{{\"data\":{{\"executeVql\":{s}}}}}",
"{{\"data\":{{\"executeVcl\":{s}}}}}",
.{r.body},
);
return .{ .status = 200, .body = out };
} else |_| {
return dataNull(allocator, "executeVql", "VQL execution failed");
return dataNull(allocator, "executeVcl", "VCL execution failed");
}
}

Expand Down Expand Up @@ -150,7 +150,7 @@ pub fn handle(
return errorBody(
allocator,
200,
"Unrecognised query. Supported: health, telemetry, octads, driftScore, executeVql",
"Unrecognised query. Supported: health, telemetry, octads, driftScore, executeVcl",
);
}

Expand Down
4 changes: 2 additions & 2 deletions ffi/zig/src/router.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// REST route dispatch. Mirrors the V gateway endpoints:
// /api/v1/health combined gateway+rust+elixir health
// /api/v1/octads* → Rust core /octads*
// /api/v1/vql/execute → Rust core /vql/execute
// /api/v1/vcl/execute → Rust core /vcl/execute
// /api/v1/drift/* → Rust core /drift/*
// /api/v1/search/* → Rust core /search/*
// /api/v1/provenance/* → Rust core /provenance/*
Expand Down Expand Up @@ -53,7 +53,7 @@ pub fn route(
if (std.mem.startsWith(u8, subpath, "/octads")) {
return forward(allocator, cfg.rust_url, subpath, method, request_body);
}
if (std.mem.eql(u8, subpath, "/vql/execute") and method == .POST) {
if (std.mem.eql(u8, subpath, "/vcl/execute") and method == .POST) {
return forward(allocator, cfg.rust_url, subpath, method, request_body);
}
if (std.mem.startsWith(u8, subpath, "/drift/") and method == .GET) {
Expand Down
Loading