Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_code-query-and-request-builders

Query & Request Builders (Safe Parameterized AST & Filter Spec)

6 COMPONENTS · 6 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[![Query & Request Builders (Safe Parameterized AST & Filter Spec) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_code-query-and-request-builders/opengraph-image)](https://archos.sageideas.dev/d/dgm_code-query-and-request-builders)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_code-query-and-request-builders)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_code-query-and-request-builders" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Query & Request Builders (Safe Parameterized AST & Filter Spec) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0["API Filter Params"]
  n1_1["Field Allowlist Guard"]
  n2a_2["Immutable Query AST"]
  n2b_3["Param Binder"]
  n3_4[("Safe Prepared SQL")]
  downstream_5["Downstream & OTel"]
  client_0 -->|"1. Allowlist · Guard"| n1_1
  n1_1 -->|"2a. Build AST · AST"| n2a_2
  n1_1 -->|"2b. Bind vals · Params"| n2b_3
  n2a_2 -->|"3a. Run SQL · SQL"| n3_4
  n2b_3 -->|"3b. Merge · RAM"| n3_4
  n3_4 -.->|"4. Emit / · OTLP/API"| downstream_5

COMPONENT STACK (6)

  • API Filter ParamsSTATELESS
    ?status=open&sort=-created
  • Field Allowlist GuardSTATELESS
    Rejects unknown cols & operators
  • Immutable Query ASTSTATELESS
    Composable WHERE / LIMIT / cursor
  • Param BinderSTATELESS
    Emits $1, $2 placeholders ONLY
  • Safe Prepared SQLSTATEFUL
    Keyset cursor + statement timeout
  • Downstream & OTelSTATELESS
    Consumers, metrics & SLOs

REQUEST & DATA FLOW (6)

  1. API Filter Params → Field Allowlist Guard (Allowlist)[Guard]
  2. Field Allowlist Guard → Immutable Query AST (Build AST)[AST]
  3. Field Allowlist Guard → Param Binder (Bind vals)[Params]
  4. Immutable Query AST → Safe Prepared SQL (Run SQL)[SQL]
  5. Param Binder → Safe Prepared SQL (Merge)[RAM]
  6. Safe Prepared SQL → Downstream & OTel (Emit /)[OTLP/API]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →