Skip to content

fix(coordinator): warn only about genuine misfilings, once per record - #5310

Merged
springfall2008 merged 3 commits into
mainfrom
fix/coordinator-warn-once
Sep 30, 2026
Merged

springfall2008 merged 3 commits into
mainfrom
fix/coordinator-warn-once

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Opened by Claude on behalf of @chalfontchubby.

Problem

Every debug dump and every publish logged this three times per Octopus meter:

Warn: Coordinator: device_id looks like an identifier in a clear container - pseudonymised

Octopus's device_id is octopus:{mpan}, which trips the 10-digit shape guard. The MPAN is also reported in account_ids and pseudonymised there, so the redaction is doing exactly what it is designed to do. The warning tells the user nothing they can act on.

Change

  • Judge hits after the walk. Shape-guard hits are held until the whole catalogue has been walked, then judged against every account identifier in it. A hit wholly explained by one (an identity-derived device_id, a cross-link to it, a numeric echo) is still pseudonymised but no longer warned about.
  • Whole-token matching only. A short account id cannot split a longer number's digit run and hide a genuinely misfiled value. A device_id counts as identity-derived only if it embeds one of its own account ids. A number is explained only when its integer part is an identifier. The explained part is replaced by a placeholder rather than removed, so neighbouring digit runs cannot join into something that looks like an identifier.
  • Once per record. The remaining genuine misfilings are logged once per process instead of on every redaction. The dedupe key is the message plus a salted pseudonym of the record's device_id, so a second record misfiling the same field is a new leak and still warns. The log line never contains the raw value.

Note on suppressing repeats

Suppressing repeated warnings is deliberate. A warning that repeats every 5-minute publish for a condition that does not change tells the user nothing new after the first time, and it buries the warnings that do. The first occurrence per record is still logged. The behaviour that matters, pseudonymising the value, is unchanged on every path.

Tests

Added to tests/test_coordinator.py; each fails on the code before its commit:

  • test_identity_derived_values_do_not_warn
  • test_misfiled_identifier_warns_once_per_process
  • test_short_or_unrelated_identities_do_not_hide_misfiled_values
  • test_warning_is_once_per_record_and_ignores_joined_digit_runs

./run_all --quick passes and pre-commit is clean.

🤖 Generated with Claude Code

chalfontchubby and others added 3 commits September 29, 2026 22:43
The catalogue redactor logged "device_id looks like an identifier in a
clear container" for every Octopus meter on every debug dump and publish:
"octopus:{mpan}" trips the 10-digit shape guard even though the MPAN is
reported in account_ids and pseudonymised as designed.

Shape-guard hits are now held until the walk is done and judged against
every account identifier in the document. A hit wholly explained by one
(an identity-derived device_id, a cross-link to it, a numeric echo) is
still pseudonymised but no longer warned about. The remaining genuine
misfilings are logged once per process instead of on every redaction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed values

Review of the warn-once change found three ways the suppression could
hide a genuine misfiling: identity variants were stripped by substring
(a short account id split a longer number's digit run), any device_id
next to an account_ids container counted as identity-derived even when
it embedded none, and numbers were re-judged through their string form.

Variants are now stripped as whole tokens, a device_id is identity only
when it embeds one of its own account ids, and a number is explained
only when its integer part is an identifier.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Review follow-up: the once-per-process key was the container.field label
alone, so one record's misfiling silenced every later record misfiling
the same field. The key now includes the pseudonym of the record's
device_id, so the same record stays quiet on later dumps but a new one
warns.

An explained identifier is replaced by a non-digit placeholder rather
than removed, so the digit runs either side of it cannot join into one
that looks like an identifier. The flush also returns early when there
is nothing pending, which is the steady state once warnings are
deduplicated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants