Skip to content

fix(build-engine): keep on-disk spelling when re-rooting a compile database (#2048) - #2051

Merged
zackees merged 1 commit into
mainfrom
agent/reroot-spelling-capture
Nov 17, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/reroot-spelling-capture

Conversation

@zackees

@zackees zackees commented Nov 17, 2026

Copy link
Copy Markdown
Member

The bug

compile_database::merge::relative_spelling built the emitted relative path out
of normalize_for_key components. On a case-insensitive host that key is
case-folded, so the spelling inherited the fold:

left:  ../opt/idf/components/freertos/freertos-kernel/tasks.c
right: ../opt/idf/components/freertos/FreeRTOS-Kernel/tasks.c

full / macos / Test failed on every branch with a current main merged in
(572 passed / 2 failed, #2048): reroot_spells_sources_relative_to_the_project
plus merge_adds_framework_entries_only_idf_compiled, whose delegated entry
lookup is spelled the same way. A compile database is opened by tooling (IDE
indexers, replay), so a folded component names a file that does not exist on a
case-sensitive volume. Linux is green at the same commit, which is why only the
macOS cells caught it.

The fix

Two parallel component lists, on purpose:

  • the key components (comparison) decide how much of the two paths is
    shared — matching stays case-insensitive where the platform says so;
  • the on-disk components are what gets emitted.

relative_spelling keeps its signature and calls the new
relative_spelling_with(path, base, comparison), which takes the key function
as a parameter. That seam is what makes the macOS behaviour testable on Linux.
.. count is unchanged (base_key.len() - common), and path normalization is
done by a small path_components helper returning borrowed Components rather
than a PathBuf, so no new std::path::PathBuf enters a path-linted file.

Tests (real output)

Three new tests in merge_tests.rs, and the fold is injected so CI on Linux
covers the macOS path:

  • relative_spelling_keeps_the_on_disk_case_when_the_key_folds_it
  • relative_spelling_matches_case_insensitively_but_emits_the_source_spelling
  • relative_spelling_unchanged_when_the_key_does_not_fold (pins the .. climb
    and .-collapsing behaviour of the un-folded case)

RED with the old emission semantics (key components emitted verbatim):

test result: FAILED. 10 passed; 2 failed; 0 ignored
  left: "build/freertos-kernel/tasks.c"
 right: "Build/FreeRTOS-Kernel/tasks.c"

GREEN after:

soldr cargo test -p fbuild-build-engine --lib
test result: ok. 577 passed; 0 failed; 6 ignored

Gates: cargo fmt --check exit 0, clippy -p fbuild-build-engine --all-targets --no-deps exit 0 (the 6 unfulfilled_lint_expectations
warnings are pre-existing on this crate), ci/run_dylint.py --package fbuild-build-engine exit 0, ci/enforce_platform_boundary.py --print-totals =
rows=44; dylint_rows=43.

Scope

Behaviour only changes where the key and the spelling disagree — i.e. macOS and
Windows. Linux output is byte-identical. #2049 (windows-msvc large_futures)
is a separate defect and stays open.

Fixes #2048.

…tabase

relative_spelling built the emitted path out of the case-folded comparison keys, so on macOS/Windows `FreeRTOS-Kernel/tasks.c` was written `freertos-kernel/tasks.c` — a path that does not resolve on a case-sensitive volume. Key components now decide only how much of the two paths is shared; the emitted tail comes from the original components. Fixes #2048.
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zackees
zackees added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 2efbfce Nov 17, 2026
49 of 52 checks passed
zackees added a commit that referenced this pull request Nov 18, 2026
Brings #2051 (reroot relative spelling), #2057 (rp2040 large future),
#2058 (respell has_root / native tool spelling / renesas OnceCell), #2059
(bench framework + tracing feature) and #2063/#2067. Only conflict was
fbuild-toolchain esp32.rs test fixture, resolved to main's #2058 native-spelling
semantics (explicit native_name let-binding).
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 18, 2026
@zackees
zackees deleted the agent/reroot-spelling-capture branch November 24, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

fix(build-engine): reroot lowercases source spelling on macOS (2 full/macos tests red)

1 participant