hex_compact() (ISEA Z7 backend) emits duplicate cell IDs for mixed-resolution/overlapping input
Defect
R/hex_compact.R:53-78. The compaction loop computes is_child_of_full <- compactable & parents %in% full_parents to remove children once their parent is reconstructed, but if the parent cell itself is already present in ids (alongside all 7 of its children), the parent is never flagged as "a child of a full parent" (its own parents value differs from itself), so it survives untouched while the newly-synthesized parent is also appended.
Reproduction
hex_compact(c("010", "0100","0101","0102","0103","0104","0105","0106"), g) # aperture 7
# c("010", "010") -- a duplicate
Impact
The H3 backend delegates to the vendored compactCells and doesn't have this problem — it's specific to the pure-R ISEA path. Downstream code that assumes hex_compact() output has unique cell IDs (any per-cell join, unique()-free indexing, etc.) will silently double-count that cell.
Fix
Before appending newly-synthesized parents, also drop any input cells that are themselves already a "full parent" being reconstructed (i.e., dedupe the final output against cells already present verbatim in ids), or simply unique() the final result and treat that as a signal to review the loop's edge case rather than papering over it.
hex_compact()(ISEA Z7 backend) emits duplicate cell IDs for mixed-resolution/overlapping inputDefect
R/hex_compact.R:53-78. The compaction loop computesis_child_of_full <- compactable & parents %in% full_parentsto remove children once their parent is reconstructed, but if the parent cell itself is already present inids(alongside all 7 of its children), the parent is never flagged as "a child of a full parent" (its ownparentsvalue differs from itself), so it survives untouched while the newly-synthesized parent is also appended.Reproduction
Impact
The H3 backend delegates to the vendored
compactCellsand doesn't have this problem — it's specific to the pure-R ISEA path. Downstream code that assumeshex_compact()output has unique cell IDs (any per-cell join,unique()-free indexing, etc.) will silently double-count that cell.Fix
Before appending newly-synthesized parents, also drop any input cells that are themselves already a "full parent" being reconstructed (i.e., dedupe the final output against cells already present verbatim in
ids), or simplyunique()the final result and treat that as a signal to review the loop's edge case rather than papering over it.