I found a rather interesting bug with Smart Folders and extended attributes on the current release macOS.
I have been using Unix based systems for a long, long time, long enough that I worked on systems where a 5 MB disk drive was a large drive, and worked with data volumes that required magnetic tape.
I am now working on a personal project creating some ML models, so have large amounts of data sitting in datasets that I need to copy and rearrange depending on the ML model I am creating. In order to conserve disk space and save time, I use a lot of hard links instead of making copies of data in the different data sets I need. I can hard link to the files in a 20GB data set a lot faster than copying 20GB of data, even on an SSD - it is about an order of magnitude faster, in fact.
Aside: for those that don't know about hard links, a files data is stored in an area of the disk, while the file name and the information about where it exists is stored in the directory file (folder in macOS terms). You can have multiple references to the same data on disk in different directories, and those references can have different names. These are called hard links to the file. The space a file uses is shared among all the references, and the space is only freed when the last link to it is deleted.
I also have some applications that will review the various files in the datasets and apply Finder Tags to indicate files that need manual review. Finder Tags are extended attributes so are stored with the file's data instead of with the directory entry in a folder. So if I have a raw data set, a processed data set, and a training set, a single file on disk might have three references to it. If I tag that file with a Red tag, then that file should be listed as tagged in all three directories (raw, processed, training).
Now to make it easier to find those tagged files amongst the hundreds of thousands of files that make up the data set, I created a Smart Folder to search in the processed directory for files tagged Red. This fails in two ways:
1. If I have tagged 2000 files, the Smart Folder will only contain a small fraction of the tagged files it should have found. (If I instead search the entire hard drive, it should show 6000 tagged files as it should report every path to a tagged file, even if the file itself is the same. This does work correctly, but is useless for my purposes.)
2. The Smart Folder should only contain files in the file path from the processed files directory, but instead will also contain file paths in the raw and training directories - it is finding tagged files, but returning the wrong file reference.
I have filed Feedback on this issue.