fix(compiler): drop duplicate alias in neighbors lowering for non-default-PK center nodes

Summary

Neighbors queries against source_code entities (Definition, File, Branch, Directory, ImportedSymbol) returned HTTP 502 with execution_error. When a non-denorm filter combined with a non-default redaction id_column, the lowering pass emitted two joins on the same alias and ClickHouse rejected the SQL with Code 179. MULTIPLE_EXPRESSIONS_FOR_ALIAS. Other domains escaped because their redaction id_column is the primary key.

Relates to gitlab-org/gitlab#599769 (closed).

Change

The dedup subquery now surfaces the redaction column when it differs from the primary key, and the second scan_final join is skipped in that case. See neighbors.rs.

Tests

  • Compiler dialect test asserts one center-table reference per UNION arm.
  • Three new data-correctness subtests run the failing shape through ClickHouse: positive match, empty match, redaction restricted to one parent.
  • 332 compiler unit, 184 local integration, 86 data-correctness subtests pass locally.
Why this only affected source_code

Every source_code node redacts on project_id rather than id (see definition.yaml). Combined with any text filter that is not pre-aggregated onto the edge tags (name, path, fqn, import_path, head_commit_sha, etc.), this hit the buggy code path on every request. core, ci, plan, code_review, and security entities all redact on id, so they took the single-join branch.

Merge request reports

Loading