when running forge test with dirty files, we firstly do a ABI-only compilation which handles dirty files and removes their artifacts from disk. however, we do not write updated cache file as this compilation is ephermal, thus we are ending up with cache file containing artifacts which does not exist, and this causes issues when compiling project normally.
this could be fixed by only removing dirty artifacts when writing cache, but I think this doesn't give us much benefit as we'll overwrite those anyway.
Also changed flow a bit to ensure that we corretly handle graph resultion error when detecting dirty sources.
ref https://t.me/foundry_support/53263
when running
forge test
with dirty files, we firstly do a ABI-only compilation which handles dirty files and removes their artifacts from disk. however, we do not write updated cache file as this compilation is ephermal, thus we are ending up with cache file containing artifacts which does not exist, and this causes issues when compiling project normally.this could be fixed by only removing dirty artifacts when writing cache, but I think this doesn't give us much benefit as we'll overwrite those anyway.
Also changed flow a bit to ensure that we corretly handle graph resultion error when detecting dirty sources.