Issue #2078: Driver: a merge whose lowered files conflict is re-lowered by the compiler built from the merged sources, not the old binary

Open and answer this issue on GitHub.

ready · opened 2026-11-18 · updated 2026-11-18 · 0 comments

Found while: running the performance lane’s driver (Benchmarks Game, #1611), 2026-11-18. Related: #1430 (re-lowering a conflicted merge), #1333 (regenerating a clean merge), #1916 (the tree worktree).

Probe

When the driver merges origin/develop before the next issue, the merge conflicts in crates/nikaia-std/src/compiler/lowered.rs. Develop has added a new method, NodeId::at, which tree_build.nika calls. The driver aborts:

error[NK1171]: `node_id::NodeId` has no method called `at`.
    --> target/ledger-tree/crates/nikaia-std/src/compiler/tree_build.nika:154:9
ESCALATE drive: merging origin/develop before the next issue, merge conflicted in crates/nikaia-std/src/compiler/lowered.rs, re-lowering failed (lower-std before the build), merge aborted (drive.nika ce846b53)

Resolving the merge by hand in this order worked (commit 208ef57f):

  1. Take their lowered.rs.
  2. Remove one stale import (E0432).
  3. cargo build --profile fast -p nikaia.
  4. lower-std with the new binary.
  5. Build again.

Cause

scripts/drive.nika, drive_merge_regenerate, the block after let first = ... {build}. When the first build of the merged tree fails, the driver runs LOWER (drive_merge_lower) with the binary from before the merge. That compiler only knows the declarations of the old side. So it refuses every .nika file that uses something develop newly declared (NK1171), and the merge is aborted.

The first build usually fails for a small reason in the taken lowered files, such as a stale use, a missing field, or the digest. The old binary cannot fix those, because it cannot lower the new sources at all.

Done when

The driver merges a develop that adds a method used by a lowered .nika file, with a conflict only in lowered.rs, and needs no hand work. The log shows MERGE <sha8> re-lowered crates/nikaia-std/src/compiler/lowered.rs, and the short checks are green.

To build

  1. In drive_merge_regenerate, when the first BUILD fails, do not reach straight for the old binary’s LOWER. First try to make the merged sources build:
    • Write the old binary’s lowering only for the files whose .nika side is unchanged by the merge.
    • Or, preferably, bootstrap the compiler without the lowered std. Check whether lower-std has or can get a mode that needs only the Rust parts.
    • Decide which of the two in the build and note it in the comment. If neither is possible without a new compiler feature, report it as blocked.
  2. Keep the old binary as the last fallback only, and say in the ESCALATE text which step failed, e.g. lower-std with the binary from before the merge refused <file>: <first error>.
  3. Add a .nika test (tests/compiler/tests/ or the driver’s script tests) that recreates a lowered-only conflict, with a new method on their side, and expects the merge to settle.
  4. Update the comment at the top of scripts/drive.nika (the #1430 paragraph) and the one on drive_merge_regenerate.

Files

Back to Open Issues