Well, considering the thread is apparently about your mod, it might fit in the mods section. So glad this isn't my job to decide (I meant the whole thread, not your post )
On the note of things imperfect with the alerts system. If I tell you the first_contact(watch_type 6) alerts do not seem to trigger if I ask for all sight(watch_type 4) alerts, do you maybe remember some other issue that may be in the code? I instead get a type 4 alert. Guess I'll remember known army_ids and change the watch_type to 6 if the alert_id is unknown and the watch_type of the alert is 4. EDIT 2: Thinking about it, is the logic for first_sight maybe something like: if (sight is enabled for unit) show sight event else if (first sight is enabled for unit and whatever determines first sight is true) show first sight ? EDIT 3: Hmm, a test with -nomods shows that a t1 scout that scouts a commander for the first time triggers a "commander detected" message. So no first_sight alert. The player that is scouted gets a first_sight alert. This seems to match with my idea. Was this done to have first_sight show for any unit type, even those that sight does not care about? So basically the first sight of a player is so important it even triggers for i.e. walls or similar unimportant stuff? EDIT: Also yeah this should be in the modding forums, moved.
The alerts system only maintains a single alert for each unit_id and squelches events that are triggered by the same unit. This produce some bugs (you described one of them). The first sight event occurs whenever you see any unit of a player for the first time (even if that unit would not normally give an alert).
Good to know you know of the bugs, maybe you'll get to improve them in the future. The alerts system turns out to be a very important source of information for many mods I make.