Skip to content

Commit 7db609b

Browse files
claudehyperpolymath
authored andcommitted
refactor(elixir): VCL rename stage C — VQL* modules -> VCL* (internal)
Stage C of the VQL->VCL rename (#84): the Elixir orchestration layer. VeriSim Consonance Language is the canonical name; "VQL" is the retired misnomer. These modules are internal — no external Elixir callers, and no Elixir HTTP route (the /vql/execute surface lives in the Rust api) — so this is a clean hard-rename with no back-compat shims. Renamed (git mv + identifiers): - lib/verisim/query/vql_{bridge,executor,proof_certificate,type_checker}.ex -> vcl_*; modules VeriSim.Query.VQL{Bridge,Executor,ProofCertificate, TypeChecker} -> VCL* - test/support/vql_test_helpers.ex -> vcl_test_helpers.ex (VeriSim.Test.VQLTestHelpers -> VCLTestHelpers) - 12 test modules test/verisim/**/vql_*_test.exs -> vcl_* - fixtures test/fixtures/vql/*.vql -> test/fixtures/vcl/*.vcl Preserved (cross-layer contracts owned by other stages, NOT Elixir-internal): - "vql-bridge/vql_parser_port.js" — ReScript/JS parser path (bridge falls back to the built-in parser when absent) - "type:vql_query" — Rust full-text search tag (verisim-api index contract) - vql_dt_active — telemetry JSON key consumed by the PanLL dashboard These move with Stage B (Rust/clients) and the JS-bridge/dashboard stages. Verified locally (hex is proxy-blocked here, so mix cannot fetch deps): all 23 changed Elixir files parse (Code.string_to_quoted!), all are mix-format-clean, and a case-insensitive grep leaves only the 8 intentional contract lines. Real mix compile/test runs on CI. Refs #84. https://claude.ai/code/session_01W9Voe3JceP66Bna9FT4jME
1 parent fcf9719 commit 7db609b

33 files changed

Lines changed: 364 additions & 364 deletions

elixir-orchestration/lib/verisim/hypatia/scan_ingester.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ defmodule VeriSim.Hypatia.ScanIngester do
2424
2525
VeriSimDB storage
2626
27-
Hypatia VQL queries
27+
Hypatia VCL queries
2828
2929
## Usage
3030

elixir-orchestration/lib/verisim/query/vql_bridge.ex renamed to elixir-orchestration/lib/verisim/query/vcl_bridge.ex

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
# SPDX-License-Identifier: MPL-2.0
22

3-
defmodule VeriSim.Query.VQLBridge do
3+
defmodule VeriSim.Query.VCLBridge do
44
@moduledoc """
5-
Bridge between the ReScript VQL parser and Elixir VQL executor.
5+
Bridge between the ReScript VCL parser and Elixir VCL executor.
66
77
Manages a long-running Deno/Node process that runs the compiled ReScript
8-
VQL parser. Communication uses JSON over stdin/stdout with length-prefixed
8+
VCL parser. Communication uses JSON over stdin/stdout with length-prefixed
99
framing for reliable message boundaries.
1010
1111
## Architecture
1212
13-
VQL String ──► VQLBridge (GenServer)
13+
VCL String ──► VCLBridge (GenServer)
1414
1515
1616
Port (stdin/stdout JSON)
1717
1818
19-
Deno process running compiled VQLParser.res
19+
Deno process running compiled VCLParser.res
2020
2121
22-
Parsed AST (JSON) ──► VQLExecutor
22+
Parsed AST (JSON) ──► VCLExecutor
2323
2424
## Usage
2525
26-
{:ok, ast} = VQLBridge.parse("SELECT GRAPH, VECTOR FROM HEXAD abc-123")
27-
{:ok, results} = VQLExecutor.execute(ast)
26+
{:ok, ast} = VCLBridge.parse("SELECT GRAPH, VECTOR FROM HEXAD abc-123")
27+
{:ok, results} = VCLExecutor.execute(ast)
2828
"""
2929

3030
use GenServer
@@ -42,9 +42,9 @@ defmodule VeriSim.Query.VQLBridge do
4242
end
4343

4444
@doc """
45-
Parse a VQL query string into an AST map.
45+
Parse a VCL query string into an AST map.
4646
47-
Returns `{:ok, ast}` where ast is a map matching the VQLParser.AST types,
47+
Returns `{:ok, ast}` where ast is a map matching the VCLParser.AST types,
4848
or `{:error, reason}` on parse failure.
4949
"""
5050
def parse(query_string, timeout \\ @default_timeout) do
@@ -66,44 +66,44 @@ defmodule VeriSim.Query.VQLBridge do
6666
end
6767

6868
@doc """
69-
Parse a VQL mutation (INSERT / UPDATE / DELETE).
69+
Parse a VCL mutation (INSERT / UPDATE / DELETE).
7070
"""
7171
def parse_mutation(query_string, timeout \\ @default_timeout) do
7272
GenServer.call(__MODULE__, {:parse_mutation, query_string}, timeout)
7373
end
7474

7575
@doc """
76-
Parse a VQL statement (query or mutation).
76+
Parse a VCL statement (query or mutation).
7777
"""
7878
def parse_statement(query_string, timeout \\ @default_timeout) do
7979
GenServer.call(__MODULE__, {:parse_statement, query_string}, timeout)
8080
end
8181

8282
@doc """
83-
Parse and execute a VQL query string in one call.
84-
Combines VQLBridge.parse/1 with VQLExecutor.execute/2.
83+
Parse and execute a VCL query string in one call.
84+
Combines VCLBridge.parse/1 with VCLExecutor.execute/2.
8585
"""
8686
def parse_and_execute(query_string, opts \\ []) do
8787
case parse(query_string) do
88-
{:ok, ast} -> VeriSim.Query.VQLExecutor.execute(ast, opts)
88+
{:ok, ast} -> VeriSim.Query.VCLExecutor.execute(ast, opts)
8989
{:error, _} = error -> error
9090
end
9191
end
9292

9393
@doc """
94-
Parse and execute a VQL statement (query or mutation).
94+
Parse and execute a VCL statement (query or mutation).
9595
"""
9696
def parse_and_execute_statement(query_string, opts \\ []) do
9797
case parse_statement(query_string) do
98-
{:ok, ast} -> VeriSim.Query.VQLExecutor.execute_statement(ast, opts)
98+
{:ok, ast} -> VeriSim.Query.VCLExecutor.execute_statement(ast, opts)
9999
{:error, _} = error -> error
100100
end
101101
end
102102

103103
@doc """
104-
Type-check a parsed VQL-DT AST.
104+
Type-check a parsed VCL-DT AST.
105105
106-
Sends the AST to the ReScript type checker (VQLBidir.synthesizeQuery)
106+
Sends the AST to the ReScript type checker (VCLBidir.synthesizeQuery)
107107
via the Deno/Node subprocess. Returns inferred types, proof obligations,
108108
and composition strategy.
109109
@@ -142,12 +142,12 @@ defmodule VeriSim.Query.VQLBridge do
142142

143143
case start_port(state) do
144144
{:ok, port} ->
145-
Logger.info("VQLBridge started with #{runtime}")
145+
Logger.info("VCLBridge started with #{runtime}")
146146
{:ok, %{state | port: port}}
147147

148148
{:error, reason} ->
149149
Logger.warning(
150-
"VQLBridge: parser process unavailable (#{reason}), falling back to built-in parser"
150+
"VCLBridge: parser process unavailable (#{reason}), falling back to built-in parser"
151151
)
152152

153153
{:ok, state}
@@ -157,7 +157,7 @@ defmodule VeriSim.Query.VQLBridge do
157157
@impl true
158158
def handle_call({:typecheck, _ast}, _from, %{port: nil} = state) do
159159
# Type checking requires the ReScript subprocess — no fallback.
160-
# Callers MUST handle this error; silently passing would defeat VQL-DT.
160+
# Callers MUST handle this error; silently passing would defeat VCL-DT.
161161
{:reply, {:error, :type_checker_unavailable}, state}
162162
end
163163

@@ -240,14 +240,14 @@ defmodule VeriSim.Query.VQLBridge do
240240
end
241241

242242
{:error, _} ->
243-
Logger.warning("VQLBridge: received malformed data from parser port")
243+
Logger.warning("VCLBridge: received malformed data from parser port")
244244
{:noreply, state}
245245
end
246246
end
247247

248248
@impl true
249249
def handle_info({port, {:exit_status, status}}, %{port: port} = state) do
250-
Logger.warning("VQLBridge: parser process exited with status #{status}")
250+
Logger.warning("VCLBridge: parser process exited with status #{status}")
251251

252252
# Reply to all pending requests with error
253253
for {_id, from} <- state.pending do
@@ -257,7 +257,7 @@ defmodule VeriSim.Query.VQLBridge do
257257
# Try to restart
258258
case start_port(state) do
259259
{:ok, new_port} ->
260-
Logger.info("VQLBridge: parser process restarted")
260+
Logger.info("VCLBridge: parser process restarted")
261261
{:noreply, %{state | port: new_port, pending: %{}}}
262262

263263
{:error, _} ->
@@ -486,7 +486,7 @@ defmodule VeriSim.Query.VQLBridge do
486486

487487
# Split multi-proof specs on AND/OR connectors into a list.
488488
# "EXISTENCE(a) AND PROVENANCE(b)" → [%{raw: "EXISTENCE(a)"}, %{raw: "PROVENANCE(b)"}]
489-
specs = VeriSim.Query.VQLTypeChecker.parse_proof_specs(%{raw: raw})
489+
specs = VeriSim.Query.VCLTypeChecker.parse_proof_specs(%{raw: raw})
490490

491491
proof =
492492
case specs do
@@ -556,7 +556,7 @@ defmodule VeriSim.Query.VQLBridge do
556556

557557
:error ->
558558
raise ArgumentError,
559-
"Unknown VQL token #{inspect(str)} — not in @safe_atoms allowlist"
559+
"Unknown VCL token #{inspect(str)} — not in @safe_atoms allowlist"
560560
end
561561
end
562562

elixir-orchestration/lib/verisim/query/vql_executor.ex renamed to elixir-orchestration/lib/verisim/query/vcl_executor.ex

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# SPDX-License-Identifier: MPL-2.0
22
# Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3-
defmodule VeriSim.Query.VQLExecutor do
3+
defmodule VeriSim.Query.VCLExecutor do
44
@moduledoc """
5-
VQL Executor - Executes VQL queries and mutations parsed by the ReScript VQL parser.
5+
VCL Executor - Executes VCL queries and mutations parsed by the ReScript VCL parser.
66
77
Supports three phases:
88
1. Dependent-type queries with multi-proof composition
@@ -11,9 +11,9 @@ defmodule VeriSim.Query.VQLExecutor do
1111
1212
## Execution Pipeline
1313
14-
1. Parse VQL query (done by ReScript VQLParser)
15-
2. Type-check if PROOF clause present (VQLTypeCheckerVQLBidir)
16-
3. Generate execution plan (VQLExplain)
14+
1. Parse VCL query (done by ReScript VCLParser)
15+
2. Type-check if PROOF clause present (VCLTypeCheckerVCLBidir)
16+
3. Generate execution plan (VCLExplain)
1717
4. Classify conditions (pushdown vs cross-modal)
1818
5. Route to appropriate modality stores
1919
6. Evaluate cross-modal conditions post-fetch
@@ -23,14 +23,14 @@ defmodule VeriSim.Query.VQLExecutor do
2323
require Logger
2424

2525
alias VeriSim.{QueryRouter, RustClient, Telemetry}
26-
alias VeriSim.Query.VQLProofCertificate
26+
alias VeriSim.Query.VCLProofCertificate
2727

2828
@doc """
29-
Execute a parsed VQL query.
29+
Execute a parsed VCL query.
3030
3131
## Parameters
3232
33-
- `query_ast` - Parsed VQL query from ReScript VQLParser
33+
- `query_ast` - Parsed VCL query from ReScript VCLParser
3434
- `opts` - Execution options
3535
3636
## Options
@@ -56,7 +56,7 @@ defmodule VeriSim.Query.VQLExecutor do
5656
end
5757

5858
@doc """
59-
Execute a VQL mutation (INSERT / UPDATE / DELETE).
59+
Execute a VCL mutation (INSERT / UPDATE / DELETE).
6060
"""
6161
def execute_mutation(mutation_ast, opts \\ []) do
6262
timeout = Keyword.get(opts, :timeout, 30_000)
@@ -77,7 +77,7 @@ defmodule VeriSim.Query.VQLExecutor do
7777
end
7878

7979
@doc """
80-
Execute a VQL statement (query or mutation).
80+
Execute a VCL statement (query or mutation).
8181
"""
8282
def execute_statement(statement_ast, opts \\ []) do
8383
case statement_ast do
@@ -91,13 +91,13 @@ defmodule VeriSim.Query.VQLExecutor do
9191
end
9292

9393
@doc """
94-
Execute a VQL query string (includes parsing).
94+
Execute a VCL query string (includes parsing).
9595
"""
9696
def execute_string(query_string, opts \\ []) do
9797
start_time = System.monotonic_time()
9898

9999
result =
100-
case VeriSim.Query.VQLBridge.parse(query_string) do
100+
case VeriSim.Query.VCLBridge.parse(query_string) do
101101
{:ok, ast} -> execute(ast, opts)
102102
{:error, reason} -> {:error, {:parse_error, reason}}
103103
end
@@ -165,7 +165,7 @@ defmodule VeriSim.Query.VQLExecutor do
165165
projections = extract_projections(query_ast)
166166

167167
if proof_specs do
168-
# VQL-DT path: type-check → execute → verify proofs → bundle certificate
168+
# VCL-DT path: type-check → execute → verify proofs → bundle certificate
169169
execute_dt_query(
170170
query_ast,
171171
proof_specs,
@@ -228,7 +228,7 @@ defmodule VeriSim.Query.VQLExecutor do
228228
end
229229
end
230230

231-
# VQL-DT execution — type check, execute, verify proofs, bundle certificate
231+
# VCL-DT execution — type check, execute, verify proofs, bundle certificate
232232
defp execute_dt_query(
233233
query_ast,
234234
proof_specs,
@@ -243,42 +243,42 @@ defmodule VeriSim.Query.VQLExecutor do
243243
projections,
244244
timeout
245245
) do
246-
alias VeriSim.Query.{VQLBridge, VQLTypeChecker}
246+
alias VeriSim.Query.{VCLBridge, VCLTypeChecker}
247247

248248
# Step 1: Type-check the query to get proof obligations and composition strategy.
249249
# Tries three strategies in order:
250-
# 1. ReScript bidirectional type checker (VQLBridge.typecheck — full formal system)
251-
# 2. Elixir-native type checker (VQLTypeChecker — validates types, generates obligations)
250+
# 1. ReScript bidirectional type checker (VCLBridge.typecheck — full formal system)
251+
# 2. Elixir-native type checker (VCLTypeChecker — validates types, generates obligations)
252252
# 3. Bare AST extraction (last resort — no validation, just structuring)
253253
type_info =
254-
case VQLBridge.typecheck(query_ast) do
254+
case VCLBridge.typecheck(query_ast) do
255255
{:ok, info} ->
256256
info
257257

258258
{:error, :type_checker_unavailable} ->
259259
# ReScript subprocess not running. Use the Elixir-native type checker
260260
# which validates proof types, modality compatibility, and composition.
261261
Logger.info(
262-
"VQL-DT: Using Elixir-native type checker (ReScript subprocess unavailable)"
262+
"VCL-DT: Using Elixir-native type checker (ReScript subprocess unavailable)"
263263
)
264264

265-
case VQLTypeChecker.typecheck(query_ast) do
265+
case VCLTypeChecker.typecheck(query_ast) do
266266
{:ok, info} ->
267267
info
268268

269269
{:error, reason} ->
270270
# Native type checker rejected the query — this is a real type error.
271-
Logger.error("VQL-DT: Type checking failed: #{inspect(reason)}")
271+
Logger.error("VCL-DT: Type checking failed: #{inspect(reason)}")
272272
nil
273273
end
274274

275275
{:error, reason} ->
276-
Logger.error("VQL-DT: Type checking failed: #{inspect(reason)}")
276+
Logger.error("VCL-DT: Type checking failed: #{inspect(reason)}")
277277
nil
278278
end
279279

280280
if is_nil(type_info) do
281-
{:error, {:type_check_failed, "VQL-DT query type checking failed"}}
281+
{:error, {:type_check_failed, "VCL-DT query type checking failed"}}
282282
else
283283
# Step 2: Execute the query (get data)
284284
{pushdown_conditions, cross_modal_conditions} = classify_conditions(where_clause)
@@ -314,7 +314,7 @@ defmodule VeriSim.Query.VQLExecutor do
314314
:conjunction
315315

316316
# Step 4b: Generate independently verifiable certificates for
317-
# each proof obligation using VQLProofCertificate. Each artifact
317+
# each proof obligation using VCLProofCertificate. Each artifact
318318
# from the verifier becomes the witness for its corresponding
319319
# obligation, yielding a hash-sealed certificate.
320320
verifiable_certificates =
@@ -323,7 +323,7 @@ defmodule VeriSim.Query.VQLExecutor do
323323
|> Enum.map(fn {obligation, artifact} ->
324324
witness = if is_map(artifact), do: artifact, else: %{raw: artifact}
325325

326-
case VQLProofCertificate.generate_certificate(obligation, witness) do
326+
case VCLProofCertificate.generate_certificate(obligation, witness) do
327327
{:ok, cert} -> cert
328328
{:error, _} -> nil
329329
end
@@ -875,7 +875,7 @@ defmodule VeriSim.Query.VQLExecutor do
875875
else
876876
# No specific entity — log a warning but allow for global queries.
877877
Logger.warning(
878-
"VQL-DT: Access proof without entity ID — global query, skipping entity-level check"
878+
"VCL-DT: Access proof without entity ID — global query, skipping entity-level check"
879879
)
880880

881881
{:ok, %{type: :access, entity_id: nil, authorized: true, scope: :global}}
@@ -1209,7 +1209,7 @@ defmodule VeriSim.Query.VQLExecutor do
12091209
# ---------------------------------------------------------------------------
12101210

12111211
# Proof obligation structuring and composition determination are now handled
1212-
# by VeriSim.Query.VQLTypeChecker, which provides richer validation and
1212+
# by VeriSim.Query.VCLTypeChecker, which provides richer validation and
12131213
# enrichment (witness fields, circuit names, time estimates).
12141214

12151215
# ===========================================================================
@@ -2019,7 +2019,7 @@ defmodule VeriSim.Query.VQLExecutor do
20192019
steps = []
20202020

20212021
# Step 1: Parse (already done)
2022-
steps = [%{operation: "Parse VQL", cost_ms: 1, notes: "Already completed"} | steps]
2022+
steps = [%{operation: "Parse VCL", cost_ms: 1, notes: "Already completed"} | steps]
20232023

20242024
# Step 2: Type check (if proofs present)
20252025
steps =

0 commit comments

Comments
 (0)