feat(named-queries): add expand_merge_request and expand_work_item

What does this MR do and why?

Adds one named query for merge requests and one for work items. Each returns a bounded, immediate graph neighborhood for the given IDs. The entity context expansion design needs one query per type, so a client gets a type's neighbors in a single billed call. Notes and mentions are left out so they don't fill the limit.

Related to #1262

Testing

The named-query loader tests pass, and so does the compile test that checks the JSON and GQL forms produce the same query. mise test:fast passes apart from the loader count, which I updated.

Performance Analysis

  • This merge request does not introduce any performance regression. These are plain neighbors queries bounded by limit.
Agent context: long-form analysis, file-by-file walkthroughs, profiler output, alternatives considered
  • config/named_queries/expand_merge_request.yaml and expand_work_item.yaml: params node_ids (1 to 500 ints) and limit (1 to 500). The entity is fixed per query. Direction is both, with rel_types capped at 10 by the schema.
  • MergeRequest edges: AUTHORED, ASSIGNED, REVIEWER, APPROVED, MERGED, HAS_LABEL, IN_MILESTONE, IN_PROJECT, HAS_HEAD_PIPELINE, CLOSES. Dropped: HAS_NOTE, MENTIONS, FIXES, HAS_DIFF, HAS_LATEST_DIFF and others.
  • WorkItem edges: AUTHORED, ASSIGNED, HAS_LABEL, IN_MILESTONE, IN_PROJECT, IN_GROUP, CLOSES, RELATED_TO, CONTAINS. Dropped: HAS_NOTE, MENTIONS, reopened/closed events.
  • Spec: ADR 020 (kg!2677, not merged yet). Names and params follow it.
  • Query count bumped from 12 to 14 in the loader test and the querying README.
  • Ran: cargo nextest run -p named-queries, cargo nextest run -p integration-tests --test local named_queries, mise test:fast, mise lint:code. mise lint:docs has one link error on .gitlab/.argo/mr_template_doc_ai.md that this change doesn't touch.
  • The corpus-smoke job (needs ClickHouse) also runs every named query; not run locally.
  • !2818 removes the JSON DSL. Whichever MR lands second drops the json: blocks from these two YAML files and fixes the query count in the loader test.
  • Truncation: the neighbors order_by only takes a center-node property, so it can't prioritize edge types. The descriptions say the cut is unordered and clients must check pagination.truncated.
  • Branch pipelines: not checked.
Edited by Dmitry Gruzd

Merge request reports

Loading
Loading