Screwy PIO build issue with "lib_compat_mode"

fatal error: headerB.h: No such file or directory

headerB.h is in a project local library and ignored unless lib_compat_mode = off

Project structure

|  |___src
|     |___main.cpp
|  |___lib
|     |___libA
|        |___headerA.h
|     |___libB
|        |___headerB.h

libA/headerA.h is included correctly
libB/headerB.h is not included without lib_compat_mode = off

If headerA.h is moved into /lib/libB, then fatal error: headerA.h No such file or directory

/lib/libB/headerA.h is not found even if it is now a completely empty file.

If headerB.h is moved into /lib/libA, neither headerA.h or headerB.h are now found.

headerB.h only contains the following code:

#pragma once

#undef ARDUINO
#if defined (ARDUINO)
  #include "Arduino.h"

Even though ARDUINO is undefined (and wasn’t defined before the #undef anyway), commenting out #include "Arduino.h" resolves the issue and all files are now found and included with lib_compat_mode = soft.

I’d report that to