Cloudflare has two billing systems that must agree: PAYGO (self-serve) and Enterprise (contract). When the PAYGO team changes how a product is billed, the Enterprise side has no way to know. Changes slip through, causing billing discrepancies that can go unnoticed for months.
A system that automatically watches the PAYGO billing repo for changes, figures out which Enterprise products are affected, and alerts the team within 24 hours — with a JIRA ticket and a proposed code fix ready to go.
Every day, the system checks the PAYGO billing repo for newly merged code changes. It looks specifically at the files that define billing routes — the rules for how each product's usage is calculated.
Runs dailyFor each code change, the system reads the diff and identifies: was a billing route added, modified, or removed? Did the query logic change? Did the data source change?
AutomatedA hand-built mapping file connects all 129 PAYGO billing routes to their Enterprise counterparts. The system looks up each changed route to find which Enterprise product is affected — accounting for the fact that names often differ between the two systems.
Context layerA formatted notification is sent to the team's Google Chat space with the affected products, a summary of what changed, links to the code changes, and who made them.
AutomatedA JIRA ticket is generated with all the details: which routes changed, which Enterprise files need updating, and a proposed action plan.
Engineer-triggeredThe system reads the PAYGO code change and the Enterprise SQL side-by-side, proposes the equivalent edit, and opens a Draft merge request for an engineer to review. For brand-new products, it hands off to the pipeline scaffolding tool.
AI-assistedDaily notification to the team with affected products, change summary, and action items
Pre-filled ticket with change details, affected files, and proposed action plan
A merge request with proposed SQL changes, ready for engineer review
PAYGO / self-serve billing · GitLab project 4410 · 129 billing routes
Python CLI runs on schedule (cron / Airflow)uv run main.py check --notify
Polls GitLab REST API every day
Engineer loads the skill in OpenCodeLoad usage-api-sync skill
Uses GitLab MCP (already authed)
gitlab_client.py calls GitLab REST APIGET /projects/4410/merge_requests?state=merged
Lookback window: configurable (default 7 days)
For each MR, fetch /changes endpoint.
Keep only files under internal/sources/
diff_parser.py extracts route-level changes:
• New Route{} structs → added
• Removed Route{} structs → removed
• Changed Source/Reader → modified
• *_reader.go changes → query logic
route_mapper.py loads the YAML mapping.
Each route → vb_product, vb_table, vb_config_group
Flags unmapped routes as NEW
state.py checks .monitor_state.json — skips already-seen MRs.notifier.py builds Card V2 JSON and POSTs to GChat webhook.
Shared mapping file read
by both paths
route_name → vb_product
route_name → vb_table
route_name → config_group
+ source, retention, notes
Mapped? → update VB SQL
Unmapped? → new pipeline
PAYGO-only? → verify w/ PM
Removed? → flag for review
AI agent uses gitlab-mcp-server toolgitlab.request({ path: '/projects/4410/merge_requests' })
Auth handled by MCP — no tokens needed
Agent fetches /changes for each MR,
filters for internal/sources/,
uses LLM reasoning to classify changes
Reads route_mapping.yaml from disk.
Applies decision rules from SKILL.md.
Produces English-language summary of impact.
Pre-fills ticket: summary, description table,
affected VB files, proposed action.
Uses jira CLI or Jira MCP to create.
Proposes SQL edits to VB query files.
Opens a Draft MR via POST /merge_requests.
For new products: invokessetup-variable-usage-pipeline skill.
Card V2 message to
"DIA <> Variable Billings" space
Products affected, change summary,
MR links, authors, action required
Project: DIA · Type: Task
Labels: variable-billing, usage-api-sync
Change details table, affected VB files,
proposed action (update SQL / new pipeline)
Branch with proposed changes to
VB SQL / config / mappings
Auto-generated from usage-api diff
via GitLab MCP POST /merge_requests
vb_product is not nullUPDATE VB SQLvb_product: null (marked PAYGO-only)VERIFY WITH PMSource field changed on a route (upstream table swap)TICKET + VERIFY SOURCEDaysRetention changedNO VB ACTIONDescription changedUPDATE MAPPING NOTES