Skip to content

fix(o11y): parse Analytics Engine aggregate strings#4244

Merged
jeanduplessis merged 1 commit into
mainfrom
fix/o11y-ae-numeric-strings
Jun 25, 2026
Merged

fix(o11y): parse Analytics Engine aggregate strings#4244
jeanduplessis merged 1 commit into
mainfrom
fix/o11y-ae-numeric-strings

Conversation

@jeanduplessis

Copy link
Copy Markdown
Contributor

Summary

Parses Analytics Engine aggregate strings before validating Gastown health metrics.

Why this change is needed

Cloudflare Analytics Engine serializes SUM(...) values as strings in JSON. The o11y worker expected JSON numbers, so every Gastown health evaluation failed schema validation after the cardinality fix reached production.

How this is addressed

  • Convert non-empty aggregate strings to numbers before strict validation.
  • Continue accepting JSON numbers and nullable aggregates.
  • Reject empty, non-numeric, negative, and non-finite aggregate values.
  • Exercise production-shaped string aggregates in the main query test.

Human Verification

  • O11y test suite: 15 files and 144 tests passed.
  • O11y TypeScript typecheck passed.
  • Independent logic and API-contract reviews found no issues.
  • Production Cloudflare logs confirmed SUM(...) fields arrive as strings.

Reviewer Notes

Human Reviewer Flags

No notable items for human review beyond what the summary covers.

Code Reviewer Agent

Code Reviewer Notes
  • Parsed output remains number | null, preserving downstream metric contracts.
  • Validation rejects malformed numeric strings instead of using permissive coercion defaults.

@kilo-code-bot

kilo-code-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • services/o11y/src/alerting/gastown-health-query.ts
  • services/o11y/test/gastown-health-query.spec.ts

Reviewed by gpt-5.4-20260305 · Input: 41.1K · Output: 5.4K · Cached: 309.8K

Review guidance: REVIEW.md from base branch main

@jeanduplessis jeanduplessis merged commit d9d14bb into main Jun 25, 2026
16 checks passed
@jeanduplessis jeanduplessis deleted the fix/o11y-ae-numeric-strings branch June 25, 2026 06:57
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