LDF - No such file or directory with chain+ and a conditional referencing an undefined macro

I have already reviewed LDF documentation Library Dependency Finder (LDF) — PlatformIO v6.1 documentation
and I feel like what I have should work. I did see this post which is similar ( "FS.h: No such file or directory" with ldf_mode deep+ ) but the outcome there was that someone filed a bug report and I’m not sure it went anywhere. The workaround is not appropriate in my situation.

Minimal repro:
platformio.ini:

[env:native]
platform = native
lib_ldf_mode = deep+
build_flags = -D NATIVE

src/main.cpp:

#include <lib1.hpp>

int main()
{
    my_struct data;
    data.value = 123;
}

lib/lib1/src/lib1.hpp:

#ifndef LIB1_DEFINE
#define LIB1_DEFINE

#ifdef NATIVE
#include <stdint.h>
#endif

#ifdef SOMETHINGUNDEFINED
#include "Arduino.h"
#endif

typedef struct my_struct {
    int32_t value;
} my_struct;

#endif

When I add the preprocessor conditional the build fails. Not having this snippet results in success.

#ifdef SOMETHINGUNDEFINED
#include "Arduino.h"
#endif

Similar thing happens if I do something along the lines of

#ifdef NATIVE
#include <stdint.h>
#else
#include "Arduino.h"
#endif

I have tried all the modes of lib_ldf_mode just in case.
Am I doing something wrong here? Are there any workarounds? The use case here is developing some libraries in a project I’m working on and I would like to run unit tests on native platform.

If I use this library structure, no matte what the content of the .hpp file is, it does not compile at all.

src\main.cpp:1:10: fatal error: lib1.hpp: No such file or directory

It only starts working when I add a lib/lib1/library.json file to it, interestingly. But then even with

#ifdef SOMETHINGUNDEFINED
#include "Arduino.h"
#endif

it works correctly and does not try to find Arduino.h

And if you go the way of a library.json you can also just put the libLDFMode as deep+ in there.

Can you check that GitHub - maxgerhardt/ldf-test-internal works correctly?

Thanks. Adding the library.json file worked.

As far as lib structure, I was just following this example: platformio-examples/unit-testing/calculator at develop · platformio/platformio-examples · GitHub
This project has a lib/calculator/src/calculator.h