Repository navigation
fix(coordinator): warn only about genuine misfilings, once per record - #5310
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opened by Claude on behalf of @chalfontchubby.
Problem
Every debug dump and every publish logged this three times per Octopus meter:
Octopus's
device_idisoctopus:{mpan}, which trips the 10-digit shape guard. The MPAN is also reported inaccount_idsand 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
device_id, a cross-link to it, a numeric echo) is still pseudonymised but no longer warned about.device_idcounts 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.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_warntest_misfiled_identifier_warns_once_per_processtest_short_or_unrelated_identities_do_not_hide_misfiled_valuestest_warning_is_once_per_record_and_ignores_joined_digit_runs./run_all --quickpasses and pre-commit is clean.🤖 Generated with Claude Code