Skip to content

fix(ingester): template underscore-glued ids in message normalization - #3

Merged
sagnik11 merged 1 commit into
mainfrom
posthog-code/underscore-id-normalization
Jul 23, 2026
Merged

fix(ingester): template underscore-glued ids in message normalization#3
sagnik11 merged 1 commit into
mainfrom
posthog-code/underscore-id-normalization

Conversation

@sagnik11

Copy link
Copy Markdown
Member

What

\b never matches between _ and a digit (both are word characters), so underscore-glued ids — prj_1013, user_42, order_9f3ac2d144 — escaped NUMBER_RE and LONG_HEX_RE entirely. One defect fragmented into a separate issue per entity id and never crossed the incident threshold.

Observed live in the production smoke test: 15 identical missing project (project prj_NNNN …) errors → 15 one-event issues → no incident.

Fix

Two new templating passes before the generic number pass:

  • _[0-9a-f]{8,}_<hex>
  • _\d+(\.\d+)?_<n>

Letter-glued digits (sha256, utf8, s3) deliberately stay literal — those are meaningful tokens, not per-entity ids. Verified: the 15 fragmented messages all normalize to one identical string; 4200ms-style cases unchanged.


Created with PostHog Code

\b never fires between _ and a digit (both word chars), so ids like
prj_1013 / user_42 / order_9f3ac2d144 escaped NUMBER_RE and LONG_HEX_RE
entirely — one defect fragmented into an issue per entity id and never
crossed the incident threshold (observed live: 15 events → 15 one-event
issues, no incident). Underscore-glued numbers/hex now template to
_<n>/_<hex>; letter-glued tokens (sha256, utf8) stay literal on purpose.

Generated-By: PostHog Code
Task-Id: 6e0925be-ecd5-42ee-9fde-895c4678bde4
@sagnik11
sagnik11 merged commit 5c52347 into main Jul 23, 2026
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