Skip to content

bug: nearest() projection passes lint but fails at execution #640

Closed

Description

@ragnorc

What happened

A query projecting the same nearest() expression used for ordering passes lint and then fails with unsupported projection expression: Nearest. This is a compiler/executor contract mismatch, independent of the broader choice of public score API.

Freshly reproduced on released 0.10.0 using local files, a supplied three-dimensional vector and no embedding provider.

Steps to reproduce

Create a new disposable graph with schema.pg:

node Doc { slug: String @key vector: Vector(3)? }

Load data.jsonl:

{"type":"Doc","data":{"slug":"v","vector":[1.0,0.0,0.0]}}

Save score.gq:

query q() {
  match { $d: Doc }
  return { $d.slug, nearest($d.vector, [1.0, 0.0, 0.0]) as score }
  order { nearest($d.vector, [1.0, 0.0, 0.0]) }
  limit 3
}
export OMNIGRAPH_HOME="$PWD/operator-config"
store="file://$PWD/repro.omni"
omnigraph init --schema schema.pg "$store"
omnigraph load --data data.jsonl --mode merge --store "$store"
omnigraph lint --schema schema.pg --query score.gq
omnigraph query --query score.gq --store "$store" --json

Lint exits 0 with OK query q (read). Execution exits 1:

unsupported projection expression: Nearest { variable: "d", property: "vector", query: Literal(List([Float(1.0), Float(0.0), Float(0.0)])) }

Expected behavior

Compiler and executor agree: either support a precisely defined score/distance projection, or reject this unsupported projection during compilation with an actionable diagnostic. Do not accept it as executable and fail only after opening/running the query.

Code and regression scope

Compiler type checking and projection execution need a shared capability contract. Test literal-vector and parameterized input, aliasing, null vectors and stored-query compilation. If scores are exposed, verify score meaning/direction rather than only successful serialization.

Related: #606 discusses the broader search/score contract. This issue is the concrete accepted-query/runtime-refusal bug.

Version / environment

Omnigraph 0.10.0; local filesystem; macOS arm64. No @embed, external model, network provider or ANN index is required for this reproduction.

Activity

  1. added
    bugSomething isn't working
    needs-triageAwaiting maintainer triage
    on Sep 5, 2026
  2. self-assigned this
    on Sep 7, 2026
  3. added
    acceptedTriaged and validated; open for a PR
    P-highHigh priority
    and removed
    needs-triageAwaiting maintainer triage
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P-highHigh priorityacceptedTriaged and validated; open for a PRbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions