What happens
Configuring and building this repository from a git worktree placed inside
the repository (.claude/worktrees/<name>/, which is where the agent harness
puts them) fails every Qt AUTOMOC target under -Weverything -Werror:
$ cmake --build build/ladder-srv --target ladder_ledger_tests -j 8
FAILED: [code=1] examples/ledger/CMakeFiles/ladder_ledger_gui_lib.dir/ladder_ledger_gui_lib_autogen/mocs_compilation.cpp.o
.../build/ladder-srv/examples/ledger/ladder_ledger_gui_lib_autogen/BZS2EH3DBT/moc_budget_presenter.cpp:9:10: error:
multiple candidates for header '../../../../../../examples/ledger/gui_lib/budget_presenter.hpp' found;
directory '.../build/ladder-srv/examples/ledger/ladder_ledger_gui_lib_autogen/BZS2EH3DBT/../../../../../../examples/ledger/gui_lib'
chosen, ignoring others including '/home/yaraslau/repo/morph/.claude/worktrees/agent-a99217a5bca2f10a4/examples/ledger/include'
[-Werror,-Wshadow-header]
9 | #include "../../../../../../examples/ledger/gui_lib/budget_presenter.hpp"
| ^
8 errors generated.
Eight such errors for ladder_ledger_gui_lib (one per moc'd class), and the
same for ladder_pastebin_gui_lib — every rung with a gui_lib/.
Why
moc emits its include as a path relative to the build tree, with enough ..
segments to climb back to the source root. clang resolves that relative path
against every -I directory as well, and one of them is
<worktree>/examples/<rung>/include. Climbing six levels from there escapes the
worktree entirely:
/home/yaraslau/repo/morph/.claude/worktrees/agent-XXXX/examples/ledger/include
+ ../../../../../.. -> /home/yaraslau/repo/morph
+ examples/ledger/gui_lib/budget_presenter.hpp <- exists, in the MAIN checkout
so a second, different-but-identically-named candidate really is on the search
path, and clang's -Wshadow-header fires. In a plain checkout the same climb
lands somewhere that does not exist, there is one candidate, and nothing is
reported. The nesting of .claude/worktrees/ inside the repository is what
makes the escaped path resolve.
Verification status
Reproduced, on worktree-agent-a99217a5bca2f10a4 (base commit 2a035fe8),
Arch Linux, clang version 22.1.8, Qt6, preset clang-release with
-DMORPH_BUILD_LADDER=ON -DMORPH_LADDER_RUNGS=all -DMORPH_BUILD_NET=ON -DMORPH_BUILD_QT=ON -DMORPH_BUILD_TESTS=ON. Output above is the real compiler
output, trimmed only for width.
Not verified: that a plain (non-nested) checkout builds these targets on
this machine — no non-worktree build of ladder_*_gui_lib was performed here.
The mechanism above says it should, and no ladder_*_tests binary exists in any
of the main checkout's build trees to contradict or confirm it. Not verified on
any other clang version; -Wshadow-header is recent, so older clangs are
probably unaffected.
Not caused by the branch: no gui_lib/ source is touched by the work this
was found under (a fix for morph#367, which only touches
examples/ledger/src/models/ledger_model.cpp and tests).
Impact
Any agent or contributor working in a worktree under .claude/worktrees/ cannot
build a rung's test binary at all, because ladder_<rung>_tests links
ladder_<rung>_gui_lib when MORPH_BUILD_QT=ON. The workaround used for #367
was a second build directory configured with
-DMORPH_ENABLE_STRICT_COMPILATION=OFF, which drops -Werror and lets the
diagnostic through as a warning — at the cost of not compiling the tests under
the project's real warning set.
Options
- Add
-Wno-shadow-header to the AUTOMOC targets' warning set (it diagnoses a
build-layout coincidence here, not anything about the code).
- Or put worktrees outside the repository, if the harness can be told to.
- Or set
CMAKE_AUTOMOC_PATH_PREFIX/an absolute moc include so the emitted
path does not climb.
What would change the verdict
Close it when a rung's ladder_<rung>_tests builds clean under the project's
own strict warning set from a worktree at .claude/worktrees/<name>/. Re-open
if a newer clang extends -Wshadow-header to a case a plain checkout also hits.
What happens
Configuring and building this repository from a git worktree placed inside
the repository (
.claude/worktrees/<name>/, which is where the agent harnessputs them) fails every Qt AUTOMOC target under
-Weverything -Werror:Eight such errors for
ladder_ledger_gui_lib(one per moc'd class), and thesame for
ladder_pastebin_gui_lib— every rung with agui_lib/.Why
mocemits its include as a path relative to the build tree, with enough..segments to climb back to the source root. clang resolves that relative path
against every
-Idirectory as well, and one of them is<worktree>/examples/<rung>/include. Climbing six levels from there escapes theworktree entirely:
so a second, different-but-identically-named candidate really is on the search
path, and clang's
-Wshadow-headerfires. In a plain checkout the same climblands somewhere that does not exist, there is one candidate, and nothing is
reported. The nesting of
.claude/worktrees/inside the repository is whatmakes the escaped path resolve.
Verification status
Reproduced, on
worktree-agent-a99217a5bca2f10a4(base commit2a035fe8),Arch Linux,
clang version 22.1.8, Qt6, presetclang-releasewith-DMORPH_BUILD_LADDER=ON -DMORPH_LADDER_RUNGS=all -DMORPH_BUILD_NET=ON -DMORPH_BUILD_QT=ON -DMORPH_BUILD_TESTS=ON. Output above is the real compileroutput, trimmed only for width.
Not verified: that a plain (non-nested) checkout builds these targets on
this machine — no non-worktree build of
ladder_*_gui_libwas performed here.The mechanism above says it should, and no
ladder_*_testsbinary exists in anyof the main checkout's build trees to contradict or confirm it. Not verified on
any other clang version;
-Wshadow-headeris recent, so older clangs areprobably unaffected.
Not caused by the branch: no
gui_lib/source is touched by the work thiswas found under (a fix for morph#367, which only touches
examples/ledger/src/models/ledger_model.cppand tests).Impact
Any agent or contributor working in a worktree under
.claude/worktrees/cannotbuild a rung's test binary at all, because
ladder_<rung>_testslinksladder_<rung>_gui_libwhenMORPH_BUILD_QT=ON. The workaround used for #367was a second build directory configured with
-DMORPH_ENABLE_STRICT_COMPILATION=OFF, which drops-Werrorand lets thediagnostic through as a warning — at the cost of not compiling the tests under
the project's real warning set.
Options
-Wno-shadow-headerto the AUTOMOC targets' warning set (it diagnoses abuild-layout coincidence here, not anything about the code).
CMAKE_AUTOMOC_PATH_PREFIX/an absolute moc include so the emittedpath does not climb.
What would change the verdict
Close it when a rung's
ladder_<rung>_testsbuilds clean under the project'sown strict warning set from a worktree at
.claude/worktrees/<name>/. Re-openif a newer clang extends
-Wshadow-headerto a case a plain checkout also hits.