Skip to content

aedes_flytable_update(): don't flag NA root_ids as duplicated - #12

Merged
jefferis merged 1 commit into
mainfrom
fix/flytable-na-rootid-not-duplicated
Aug 9, 2026
Merged

aedes_flytable_update(): don't flag NA root_ids as duplicated#12
jefferis merged 1 commit into
mainfrom
fix/flytable-na-rootid-not-duplicated

Conversation

@jefferis

@jefferis jefferis commented Aug 9, 2026

Copy link
Copy Markdown
Member

Follow-up to #11 (which was already merged, so this is a fresh PR).

Problem

In the duplicate-flagging step, rows are grouped with group_by(root_id, good_status). dplyr collapses all rows with root_id = NA into a single group, so n > 1 marks them as root_duplicated = TRUE — even though we don't actually know their identity and they shouldn't be treated as a group at all.

Fix

Force root_duplicated = FALSE for NA root_ids:

root_duplicated = dplyr::case_when(
  is.na(.data$root_id) ~ FALSE,
  .data$good_status    ~ .data$n > 1,
  TRUE                 ~ FALSE
)

Combined with the existing change detection, an NA-root_id row is written only if it previously carried root_duplicated = TRUE (to clear the stale flag); otherwise FALSE == FALSE and it's left untouched.

Same fix applied in parallel to crantr's crant_seatable_update(). Internal-only; no signature/doc changes.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

group_by(root_id, good_status) collapses all NA-root_id rows into one
group, so n>1 marked them root_duplicated=TRUE even though we don't
know their identity. Force root_duplicated=FALSE for NA root_ids; they
are only written to clear a previously-set TRUE.
@jefferis
jefferis merged commit 2e901a7 into main Aug 9, 2026
2 checks passed
@jefferis
jefferis deleted the fix/flytable-na-rootid-not-duplicated branch August 9, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant