Skip to content

fix(realunit): log Aktionariat confirm-link rejections at warn instead of error#4199

Draft
Danswar wants to merge 1 commit into
developfrom
fix/expected-rejection-log-levels
Draft

fix(realunit): log Aktionariat confirm-link rejections at warn instead of error#4199
Danswar wants to merge 1 commit into
developfrom
fix/expected-rejection-log-levels

Conversation

@Danswar

@Danswar Danswar commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Why

Part of the error-rate-reduction effort: a user clicking an expired/already-used Aktionariat confirm link produces an ERROR-level log line, although the code already treats the outcome as handled (mapConfirmationStatus buckets 4xx as INVALID). Observed in prod Loki: statuses 400/417, ~2 lines/week — routine user behavior, not a fault.

What

In callAktionariatConfirm, log the failure at warn when the status maps to INVALID, with 429 carved back out to error (throttling is a systemic fault, not a per-link rejection). 5xx / timeout / no-status keep logging at error as before. A 4xx here cannot mean broken integration credentials: the call carries no API key — the confirmation code itself is the credential.

Tests: the 4xx rejection test asserts warn (and no error), a new test pins 429 at error, and the PII-redaction test now checks the warn channel.

Scope notes

Earlier revisions of this PR also touched two other call sites; both were dropped after investigation:

  • AML merge errors: the dominant duplicate-key QueryFailedError was already root-caused and fixed by fix(kyc): assign merged kyc steps absolute sequence numbers #4027 (deployed 07-03, clean since). The remaining "Verified name mismatch" noise (11 lines/30d, single entity) is better addressed at the root (the AML cron re-attempts a merge that deterministically fails) than by log-level games — tracked separately.
  • Sumsub {"type":"test"} webhook ping: 30 days of logs show the only such traffic was self-generated probing during the audit itself; the error line is the tripwire for unsigned webhook calls and stays as is.

Test plan

  • Full local suite green (pre-push hook)
  • Lint / format / type-check clean

@Danswar Danswar marked this pull request as draft July 13, 2026 16:45
@Danswar Danswar changed the title fix(api): downgrade log level for expected Aktionariat/AML/Sumsub rejections fix(api): downgrade log level for expected Aktionariat/AML merge rejections Jul 13, 2026
…d of error

A 4xx from the confirm call is a rejected link (expired code, unknown
email; 400/417 observed in prod) — the same handled outcome that
mapConfirmationStatus buckets as INVALID, not a system fault. The call
carries no API key (the code is the credential), so a 4xx cannot mean
broken credentials. 429 stays at error: throttling is systemic.
5xx/timeout/no-status keep logging at error as before.
@Danswar Danswar changed the title fix(api): downgrade log level for expected Aktionariat/AML merge rejections fix(realunit): log Aktionariat confirm-link rejections at warn instead of error Jul 13, 2026
@Danswar Danswar force-pushed the fix/expected-rejection-log-levels branch from 53aff87 to 659b5ca Compare July 13, 2026 18:59
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