Skip to content

Refine PII fields in anonymization job and handle anon. records in app#673

Merged
rzueger merged 3 commits intodevelopfrom
claude/investigate-anonym-job-il9yS
Mar 25, 2026
Merged

Refine PII fields in anonymization job and handle anon. records in app#673
rzueger merged 3 commits intodevelopfrom
claude/investigate-anonym-job-il9yS

Conversation

@rzueger
Copy link
Member

@rzueger rzueger commented Mar 25, 2026

  • Add privacyPolicyAcceptedAt (consent timestamp per movement)
  • Add paymentMethod/invoiceRecipientName (nested PII)
  • Remove aircraftType, mtow (not PII without immatriculation)
  • Remove carriageVoucher (boolean, not PII)

https://claude.ai/code/session_01KHZDkEfyznUCcoGCWrGdsY

claude added 3 commits March 25, 2026 09:40
- Add privacyPolicyAcceptedAt (consent timestamp per movement)
- Add paymentMethod/invoiceRecipientName (nested PII)
- Remove aircraftType, mtow (not PII without immatriculation)
- Remove carriageVoucher (boolean, not PII)

https://claude.ai/code/session_01KHZDkEfyznUCcoGCWrGdsY
Anonymized records have immatriculation set to null, which
crashes localeCompare in compareDescending/compareAscending.
Fall back to empty string for null values.

https://claude.ai/code/session_01KHZDkEfyznUCcoGCWrGdsY
Anonymized records have null immatriculation, which can't be
meaningfully grouped in a per-aircraft landing summary. Skip
them and add defensive null-safe sorting.

https://claude.ai/code/session_01KHZDkEfyznUCcoGCWrGdsY
@rzueger
Copy link
Member Author

rzueger commented Mar 25, 2026

@claude review pr

@claude
Copy link

claude bot commented Mar 25, 2026

Claude finished @rzueger's task in 1m 17s —— View job


PR Review

  • Gather context
  • Read changed files
  • Provide review feedback

Overall this is a clean, well-reasoned change with good test coverage. A few observations:

functions/anonymizeMovements.js

The PII field decisions are sound:

  • Removing aircraftType / mtow makes sense — without immatriculation these fields are not linkable to an individual
  • Removing carriageVoucher (boolean) is correct — not PII
  • Adding privacyPolicyAcceptedAt is correct — it's a per-person consent timestamp

The nested paymentMethod.invoiceRecipientName handling is correct. The guard val.paymentMethod && val.paymentMethod.invoiceRecipientName !== undefined properly handles all cases (no paymentMethod, cash with no name, invoice with name). The method field is correctly preserved.

src/util/movements.ts — type not updated

immatriculation is still typed as string (non-nullable) in the Movement interface (movements.ts:11), even though anonymized records will have immatriculation: null in the DB. The tests work around this with as any casts. It would be more accurate to update the interface:

// movements.ts:11
immatriculation: string | null;

This would make the null guards in compareDescending/compareAscending type-safe without the as any workaround. Fix this →

src/util/LandingsReport.ts

The early return if (!immatriculation) return; (line 70) correctly skips anonymized arrivals. As a consequence, the sort fallback at line 95 — (a1.immatriculation || '').localeCompare(a2.immatriculation || '') — is now dead code since no null immatriculations can reach the sort. Not a bug, just slightly misleading defensive code. Up to you whether to simplify back to a1.immatriculation.localeCompare(a2.immatriculation).

Test coverage

Good tests added:

  • Verifies invoiceRecipientName is nulled when present
  • Verifies no spurious update when invoiceRecipientName is absent (cash method)
  • Verifies null immatriculation doesn't crash comparators
  • Verifies aircraftType / mtow are explicitly not anonymized

Summary: Approve with the optional suggestion to update the Movement interface. The logic is correct and all edge cases are covered.

@rzueger rzueger changed the title Refine PII fields in anonymization job Refine PII fields in anonymization job and handle anon. records in app Mar 25, 2026
@rzueger rzueger merged commit 88ca9fd into develop Mar 25, 2026
2 checks passed
@rzueger rzueger deleted the claude/investigate-anonym-job-il9yS branch March 25, 2026 10:51
@rzueger rzueger restored the claude/investigate-anonym-job-il9yS branch March 25, 2026 12:47
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.

2 participants