Michael Usachenko (50ba1344) at 18 Mar 23:56
The query pipeline was a single module inside gkg-server, tightly coupled to gRPC streaming, ClickHouse, and JWT authentication. This made it impossible to reuse for local query execution (e.g. MR 590 which runs queries against DuckDB from the CLI).
This MR breaks the pipeline into layered crates so that the core framework and shared logic can be composed differently depending on the context — full server pipeline with auth/redaction/hydration, or a minimal local pipeline that skips all of that.
The pipeline is built around a PipelineStage trait with a .then() chain pattern. Each stage reads the previous stage's output from a shared context, does its work, and returns its own output. The runner enforces stage ordering at compile time via phantom types.
The server composes all eight stages:
Security → Compilation → Execution → Extraction → Authorization → Redaction → Hydration → Output
The CLI can compose just the stages it needs:
Compilation → Execution → Extraction → Output
Same framework, same shared stages, different composition.
Formatting (Graph, Goon) is no longer a pipeline stage — it happens after the pipeline returns, so the caller decides how to present results.
graph TD
QP["querying-pipeline — framework<br/>(PipelineStage, PipelineRunner, context, observer)"]
QT["querying-types — data model<br/>(QueryResult, NodeRef, ResourceCheck)"]
QSS["querying-shared-stages — reusable stages<br/>(Compilation, Extraction, Output + inter-stage types)"]
QF["querying-formatters — output formatting<br/>(GraphFormatter, GoonFormatter, row_to_json)"]
SRV["gkg-server/pipeline — server stages<br/>(Security, ClickHouse executor, Authorization,<br/>Redaction, Hydration)"]
QP --> QT
QSS --> QP
QSS --> QT
QF --> QSS
QF --> QT
SRV --> QP
SRV --> QSS
SRV --> QF
query_pipeline/ renamed to pipeline/ in gkg-serverRedactionMessage generic that previously threaded through the entire pipeline — the authorization stage now uses ExecuteQueryMessage directlyQueryPipelineService is no longer generic over a formatter typeAll 124 unit tests pass. Full workspace clippy clean. Integration tests updated for new imports.
Enables MR 590 (local DuckDB query execution in CLI).
Michael Usachenko (3f30fb60) at 18 Mar 23:56
Merge branch 'querying-pipeline-types-crates' into 'main'
... and 1 more commit
Not a serious concern right now - will look into profiling soon
Michael Usachenko (50ba1344) at 18 Mar 23:48
chore: readd comments
Michael Usachenko (e42542b9) at 18 Mar 23:42
fix: remove mutex
I ended up removing mutex all together
we can eventually rename it - but this is a good first step
Michael Usachenko (ba3d8445) at 18 Mar 23:28
Merge remote-tracking branch 'origin/main' into querying-pipeline-t...
... and 2 more commits
Michael Usachenko (65f5e359) at 18 Mar 23:27
fix: integration bug
I think remove-llm-comments in AGENTS.md did this unknowningly, will revert
I don't think it makes sense - query engine should be a pure function - separation of concerns
Michael Usachenko (0b8a962f) at 18 Mar 22:55
Michael Usachenko (970dde94) at 18 Mar 22:55
Merge branch 'add-ast-grep-skill' into 'main'
... and 1 more commit
ast-grep 0.42.0 via mise (cargo backend) for AST-based code search and rewrite.claude/skills/ast-grep/SKILL.md teaching the agent when and how to use ast-grep instead of text-based Grep/Edit for structural code transformationsAGENTS.md/CLAUDE.md with ast-grep references in "Where to find things" and "Code quality" sectionsast-grep run -p) and batch rewrite (-r ... -U)has/inside + stopBy: end) and composite (all/any/not) logic--json output, --debug-query, --selector, constraints
try_expression for ?, function_modifiers for async)All examples validated against the codebase:
| Feature | Status |
|---|---|
Pattern search ($X.unwrap()) |
Verified |
Rewrite preview + apply (-U) |
Verified |
| Relational rules (inside impl_item) | Verified |
--json structured output |
Verified |
--debug-query (cst/ast/pattern) |
Verified |
--selector (field_declaration) |
Verified |
constraints (metavar regex) |
Verified |
| Composite rules (all + not + has) | Verified |
Bare .unwrap() ERROR warning |
Verified |
| Node kinds (try_expression, etc.) | Verified |
Michael Usachenko (0b8a962f) at 18 Mar 22:44
fix(tooling): prefix ast-grep commands with mise exec --
Michael Usachenko (0ee8a9d5) at 18 Mar 22:23
fix: remove input param in execute
Michael Usachenko (d98e92eb) at 18 Mar 21:53
fix: remove redaction phase generic rec