When run on the stacked branch, self._text_refs has 5024 members in the set, while file_id_parent_map only has 4875 keys. So, lots of them are missing. In comparison, when run on the matching generated branch, self._text_refs has 10372 members and file_id_parent_map has 10372 keys.
At this point, my guess is that this is a bug in reconcile when running on a stacked branch. I'll investigate more next week (unless someone smarter jumps in and solves it).
So I've tracked this down to line 1289 in groupcompress_ repo.py giving unexpected results:
file_ id_parent_ map = source_ vf.get_ parent_ map(self. _text_refs)
When run on the stacked branch, self._text_refs has 5024 members in the set, while file_id_parent_map only has 4875 keys. So, lots of them are missing. In comparison, when run on the matching generated branch, self._text_refs has 10372 members and file_id_parent_map has 10372 keys.
At this point, my guess is that this is a bug in reconcile when running on a stacked branch. I'll investigate more next week (unless someone smarter jumps in and solves it).