How is the include directive handled?

I understand we can include additional files to set exclusions but how is it handled?

Say I’m using #include more-ignore-rules.txt, and that text file itself is being synched.

Then I add several files including the file some_file.bin, but I also edit the more-ignore-rules.txt to exclude some_file.bin.

Does syncthing first syncs the “include” files and then resolves everything or is there a risk of some_file.bin being synched since I added the file at the same time that I added the exclusion?

In this later scenario I’m assuming that syncthing is first detecting all the added files and then after that it detects the updated more-ignore-rules.txt, so in the queue there would be in this order: add file1, add file2, … , add some_file.bin, … , update more-ignore-rules.txt.

It does not do that. In other words, you need to make sure that you sync them first manually, e.g. by using

!/more-ignore-rules.txt
/

in the ignore patterns to sync it them first while ignoring the rest.

When it comes to the order of how ignore patterns are processed, Syncthing just goes from the top to the bottom. If there are #included files in there, it will simply import those patterns as if they were in the same place as the #include line is.