◉CLAUDE LABJP
●CC 2.1.332 — No new Claude Code release over the weekend. 2.1.332 (11/25) is still current●ANALYTICS — A fix to search counts in the Enterprise Analytics API may raise numbers from 11/17 onward●SONNET 4.5 — Today, 11/30, is Sonnet 4.5's last day on the Claude API. Move to claude-sonnet-5-5●USAGE — Some users report weekly usage jumping right after upgrading to a higher plan●NEW — New: Does what a Project remembers carry over into your everyday chats?●BILLING — More readers are looking for what to check when a payment won't go through●CC 2.1.332 — No new Claude Code release over the weekend. 2.1.332 (11/25) is still current●ANALYTICS — A fix to search counts in the Enterprise Analytics API may raise numbers from 11/17 onward●SONNET 4.5 — Today, 11/30, is Sonnet 4.5's last day on the Claude API. Move to claude-sonnet-5-5●USAGE — Some users report weekly usage jumping right after upgrading to a higher plan●NEW — New: Does what a Project remembers carry over into your everyday chats?●BILLING — More readers are looking for what to check when a payment won't go through
Articles/Claude Code
⟐ Claude Code/2026-05-18Advanced

Watching a Play Store Staged Rollout with Claude Code — Automating the Halt with Per-Version Crash Rates

How I built, with Claude Code, a staged-rollout monitor that compares per-version crash rates from the Play Developer Reporting API, judges them with a Wilson interval, and halts the release through the Publishing API only when it gets worse.

Claude Code295Android10Play StoreStaged RolloutCrash MonitoringPlay Developer Reporting APIIndie Dev23

✦ Premium Article

It was the week I shipped a larger update to the Android version of my wallpaper app. On the morning after the staged rollout reached 100%, I opened Android Vitals in Play Console and saw a crash graph with a shape I didn't recognize. The culprit was an IndexOutOfBoundsException at the moment a RecyclerView swapped its adapter — something I had never once reproduced on my own devices.

I had been doing a staged rollout. So why didn't I notice before 100%? Looking back, the graph I watched blended the old and new versions together, and I was reading it with the eyes of someone who expects "a few crashes, as usual." A staged rollout limits how many people get hurt. It doesn't tell you that people are getting hurt. I had mixed those two up, and I only saw it clearly after the fix had shipped.

What follows is the monitor I rebuilt with Claude Code afterwards. The short version is the division of labor I ended up with: the math decides, Claude explains, the machine halts, and I widen. I'll walk through fetching, deciding, halting, and keeping a record, with code that runs.


What should you compare to know when to stop?

My first version read Play Console's crash-free users figure and used fixed lines: warn below 99.7%, stop below 99.5%. It ran. It also didn't work well, for two reasons.

The number didn't separate versions. During a staged rollout most people are still on the old build, so the new build's crashes get diluted. A new build at 5% could double its crash rate and the blended figure would barely move.

And daily numbers wobble. A wallpaper app is used differently on weekends, so comparing Tuesday's number for a rollout that started Monday against the previous version's 28-day average isn't really a comparison.

So I rewrote the comparison as one rule:

Compare the new and old versions, on the same day, with the same metric.

The metric is the user-perceived crash rate — the share of users who hit at least one crash while actively using the app — because that's what Google Play uses for its quality bar. As of November 2026, Android Developers' Vitals documentation lists the overall bad behavior threshold at 1.09%, and 8% per phone model; for user-perceived ANRs it's 0.47% overall and 8% per phone model. My decision logic treats the official line as the last fence and draws my own app-specific line in front of it.


Step 1: Fetch per-version, per-day crash rates from the Reporting API

The fetch code I first wrote with Claude Code tried to call vitals on the androidpublisher (Publishing API) client, and it never worked. Vitals data lives in a separate API — the Play Developer Reporting API (playdeveloperreporting.googleapis.com) — with its own scope, https://www.googleapis.com/auth/playdeveloperreporting. Splitting the two is what this rewrite does.

You need three things first: enable the Reporting API in Google Cloud, create a service account and keep its key file, and invite that service account under Users and permissions in Play Console with access to view the app. Please check the exact permission names in your own Play Console, since I can't promise they'll read the same in every account.

# vitals_fetch.py
# Fetch the user-perceived crash rate per version and per day from the Play Developer Reporting API
import os
import datetime as dt
from google.oauth2 import service_account
from googleapiclient.discovery import build
 
PACKAGE = os.environ.get("PLAY_PACKAGE", "com.example.wallpapers")
KEY_FILE = os.environ.get("PLAY_SA_KEY", "service_account.json")
SCOPES = ["https://www.googleapis.com/auth/playdeveloperreporting"]
LA = {"id": "America/Los_Angeles"}  # DAILY aggregation only accepts this time zone
 
def client():
    cred = service_account.Credentials.from_service_account_file(KEY_FILE, scopes=SCOPES)
    return build("playdeveloperreporting", "v1beta1", credentials=cred, cache_discovery=False)
 
def latest_daily_end(svc) -> dict:
    """Return the latest date available for DAILY data (latestEndTime)."""
    ms = svc.vitals().crashrate().get(name=f"apps/{PACKAGE}/crashRateMetricSet").execute()
    for f in ms.get("freshnessInfo", {}).get("freshnesses", []):
        if f.get("aggregationPeriod") == "DAILY":
            return f["latestEndTime"]
    raise RuntimeError("No DAILY freshness info")
 
def _dec(m: dict, key: str = "decimalValue") -> float | None:
    v = m.get(key, {}).get("value")
    return float(v) if v is not None else None
 
def query_versions(svc, version_codes: list[int], days: int = 3) -> list[dict]:
    end = latest_daily_end(svc)
    end_t = {"year": end["year"], "month": end["month"], "day": end["day"], "timeZone": LA}
    s = dt.date(end["year"], end["month"], end["day"]) - dt.timedelta(days=days)
    start_t = {"year": s.year, "month": s.month, "day": s.day, "timeZone": LA}
    out = []
    for vc in version_codes:  # one query per version, equality filter only
        body = {
            "timelineSpec": {"aggregationPeriod": "DAILY", "startTime": start_t, "endTime": end_t},
            "dimensions": ["versionCode"],
            "metrics": ["userPerceivedCrashRate", "crashRate", "distinctUsers"],
            "filter": f"versionCode = {vc}",
            "pageSize": 1000,
        }
        res = svc.vitals().crashrate().query(name=f"apps/{PACKAGE}/crashRateMetricSet", body=body).execute()
        for row in res.get("rows", []):
            st = row["startTime"]
            rec = {"date": f'{st["year"]}-{st["month"]:02d}-{st["day"]:02d}', "version_code": vc}
            for m in row.get("metrics", []):
                rec[m["metric"]] = _dec(m)
                ci = m.get("decimalValueConfidenceInterval")
                if ci:  # prefer the API's own interval when it returns one
                    rec[m["metric"] + "_ci"] = (float(ci["lowerBound"]["value"]), float(ci["upperBound"]["value"]))
            out.append(rec)
    return sorted(out, key=lambda r: (r["date"], r.get("version_code", 0)))
 
if __name__ == "__main__":
    import json, sys
    codes = [int(x) for x in sys.argv[1:]] or [310, 311]
    print(json.dumps(query_versions(client(), codes), ensure_ascii=False, indent=2))

The code handles four quirks that the official reference spells out:

  • The end date comes from freshnessInfo.latestEndTime, not from today. Data lags, and asking for a day that hasn't been aggregated yet just returns nothing.
  • DAILY data is bucketed in America/Los_Angeles. "Yesterday" as I see it in Japan in the morning can be a different day.
  • distinctUsers is rounded to the nearest 10, 100, 1,000 and so on, depending on size, and the reference warns against aggregating it further because the same people get counted twice. So I decide one day at a time.
  • Values come back as google.type.Decimal strings. In my case the rate arrived as a fraction (0.0021 meaning 0.21%), but I'd ask you to check the unit once against what Play Console shows for the same day and version. Getting this wrong shifts every decision by a factor of 100.

I can't run this without real credentials in an article, so I checked the parsing with a fake client that returns responses in the shape the reference documents. Here is what it printed:

{'date': '2026-11-12', 'version_code': 310, 'userPerceivedCrashRate': 0.0021, 'distinctUsers': 52000.0}
{'date': '2026-11-12', 'version_code': 311, 'userPerceivedCrashRate': 0.0038, 'distinctUsers': 2600.0}

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Get fetch code that pulls the user-perceived crash rate per version and per day from the Play Developer Reporting API, so the new and old builds are compared on the same day
✦Use a Wilson-interval decision function, with its real test output, that avoids false alarms while only a few hundred people have the new build
✦Automate only the halt through the Publishing API, keep widening the rollout as a human call, and know what halting does not undo
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⟐ Claude Code2026-11-26
Per Callback, or Once at the Door? Deciding What Claude Code Should Touch on the Day I Installed an Ads SDK Migration Skill
Android's ads SDK is changing generations, and every callback will now arrive on a background thread. The official migration skill says to switch to the UI thread inside each callback; I chose to switch once, at the entrance of my ad wrapper layer. Three tools — an inventory scanner, an entrance-level normalizer, and a PreToolUse hook that fences Claude Code's edits on the migration branch — and the reasoning behind the choice.
⟐ Claude Code2026-11-19
My Porting Checklist Was Written in SwiftUI Terms, and It Couldn't Find a Single Purchase Item in My Objective-C Code
I built a small pipeline that hands Claude Code only the checks relevant to the file I'm editing, out of a 113KB list of 33 Android pitfalls. Three scripts, and how a SwiftUI vs Objective-C vocabulary gap let the most important items slip through.
⟐ Claude Code2026-08-12
When Paying Users Still See Ads: Collapsing the Ad-Free Check Into One Place
A user who paid to remove ads still sees them. The cause is rarely a missing flag — it is a check that lives in too many places. Here is how I inventoried every ad call with Claude Code and folded the decision into a single gate.