* tools(sentry): add org-wide volume report and fix the metric we measure on The AGE-105 gate is a measured number, so it needs a repeatable query. It also needed a correction: `accepted` is the wrong headline. The org is over its error quota, so Sentry rejects nearly everything and `accepted` reads ~0 for every project - a blown org and a fixed one look identical on that column. The demand metric is `submitted` = accepted + rate_limited. scripts/sentry-volume-report.mjs takes named --window ranges and prints per-project submitted / accepted / rate_limited / client_discard plus the per-hour and projected per-month rate, so before/after comparisons run the exact same query instead of being re-derived by hand each time. Records the pre-rollout baseline in docs/analytics.md: opencode-mobile at 4.71/h (3,441/mo), 87% of the org's post-box-bot demand, from two windows that agree to within 0.2%. Co-Authored-By: Paperclip <noreply@paperclip.ing> * test(sentry): pin the noise gate against 90d of real production events The gate's unit tests prove it behaves as specified. Nothing proved the spec was aimed at the right targets. Replaying the actual 90d census of the opencode-mobile Sentry project (648 events, 11 issues) through the gate's own precedence shows 96.9% hard-dropped as transport noise and every observed crash class (OOM, ANR, IllegalStateException) still allowlisted -> ~87 events/month against a 1,500/month target. Also records two findings from measuring the org directly: * The error quota resets on the 4th. The 5,000-event month opened 2026-08-04 and was spent by 08-08; the org has accepted zero errors since. 2026-09-04 is the date the gate has to hold by, and it is why 'submitted' is the metric. * Server-side levers are unavailable on this plan. A per-key rate limit PUT returns HTTP 200 and silently discards the value (verified for three window sizes), custom inbound filters are absent, spike protection 403s. The client gate is the only control that exists, so its coverage is the whole margin. Refs AGE-105 Co-Authored-By: Paperclip <noreply@paperclip.ing> * tools(sentry): split client_discard by reason so gate drops aren't confused with quota backoff Raw client_discard cannot show whether the noise gate works. Today 100% of opencode-mobile's client_discard is ratelimit_backoff -- the SDK backing off a 429 because the ORG is over quota -- which rises when things get WORSE. Gate drops land in a different reason: @sentry/core records before_send when beforeSend returns null. - stats_v2 now groups by reason as well as project/outcome - the before_send vs ratelimit_backoff split always prints; --by-reason adds the full per-project reason table - before_send > 0 is install-share-independent, so it proves the gate is live on real devices days before a monthly rate can bend - documents that release-level segmentation is impossible while over quota: rate_limited events are never stored, so release tags stop (last value 0.4.12, 2026-08-08). Version share comes from Play, not Sentry. * ci(sentry): block a Play release whose bundle lost the noise gate The AGE-105 quota fix is entirely client-side (every server-side lever on this plan is dead), so the gate being *in the shipped binary* is the whole safety margin. That is also the one thing Sentry cannot tell us: while the org is over quota nothing is stored, release tags stop dead at 0.4.12, and a release:0.4.14 query returns empty in a way that reads like success. Grep the Hermes bundle inside the AAB instead, before the Play upload step: the gate's reason codes, the transport drop-list regex, the noise.dropped_since_last tag only applyNoiseGate() writes, and a baked-in DSN (a release built without EXPO_PUBLIC_SENTRY_DSN makes Sentry a silent no-op). Verified to discriminate on real artifacts - the v0.4.14 build now on Play production passes, pre-gate v0.4.13 fails all six markers. Also records the rejected alternative: persisting gate state across cold starts pays off only under ~94 active devices (2,633 session envelopes/7d vs a 6h cooldown), and the install base is above that. --------- Co-authored-by: engineer <engineer@macbookpro.lan> Co-authored-by: Paperclip <noreply@paperclip.ing>
155 lines
6.5 KiB
YAML
155 lines
6.5 KiB
YAML
name: Publish to Google Play Store
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
push:
|
|
tags: ["v*"]
|
|
workflow_dispatch:
|
|
inputs:
|
|
track:
|
|
description: "Play track to release to"
|
|
required: false
|
|
default: "internal"
|
|
type: choice
|
|
options:
|
|
- internal
|
|
- alpha
|
|
- beta
|
|
- production
|
|
status:
|
|
description: "Release status (draft = uploads without going live/review; completed = submit)"
|
|
required: false
|
|
default: "completed"
|
|
type: choice
|
|
options:
|
|
- completed
|
|
- draft
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
EXPO_PUBLIC_SENTRY_DSN: ${{ secrets.EXPO_PUBLIC_SENTRY_DSN }}
|
|
EXPO_PUBLIC_POSTHOG_KEY: ${{ secrets.EXPO_PUBLIC_POSTHOG_KEY }}
|
|
EXPO_PUBLIC_CHATWOOT_INBOX_IDENTIFIER: ${{ secrets.EXPO_PUBLIC_CHATWOOT_INBOX_IDENTIFIER }}
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: 17
|
|
|
|
- name: Setup Android SDK
|
|
uses: android-actions/setup-android@v4
|
|
|
|
- name: Cache Gradle
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
~/.gradle/caches
|
|
~/.gradle/wrapper
|
|
android/.gradle
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('android/**/*.gradle*', 'android/gradle/wrapper/gradle-wrapper.properties') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gradle-
|
|
|
|
- name: Cache Android build outputs
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
android/app/build/intermediates
|
|
android/build
|
|
android/app/.cxx
|
|
key: ${{ runner.os }}-android-build-${{ hashFiles('package-lock.json', 'android/**/*.gradle*') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-android-build-
|
|
|
|
- name: Install dependencies
|
|
run: npm install --legacy-peer-deps
|
|
|
|
- name: Bump android.versionCode in app.json
|
|
# Play Store rejects duplicate versionCodes, so derive a monotonic value
|
|
# from github.run_number + offset. expo prebuild reads this into build.gradle.
|
|
# Offset 100 skips past historical collisions (run 31 collided with a
|
|
# manual upload at versionCode 31). Next run = run_number + 100.
|
|
run: |
|
|
node -e "const f='app.json';const j=require('./'+f);j.expo.android=j.expo.android||{};j.expo.android.versionCode=${{ github.run_number }}+100;require('fs').writeFileSync(f,JSON.stringify(j,null,2)+'\n')"
|
|
echo "versionCode now: $(node -p "require('./app.json').expo.android.versionCode")"
|
|
|
|
- name: Set Sentry release identifiers
|
|
# sentry.gradle (applied from android/app/build.gradle) defaults the
|
|
# upload's --release/--dist to `${applicationId}@${versionName}+${versionCode}`,
|
|
# which does NOT match the release/dist Sentry.init() reports at runtime
|
|
# (`opencode-mobile@${app.json version}`, see src/lib/sentry.ts). That
|
|
# mismatch made every uploaded source map land under a release Sentry
|
|
# never looks up, so symbolication silently failed. Pin the Gradle-side
|
|
# values to exactly what the app reports. (Only expo.version matters
|
|
# here, not the android.versionCode bumped above.)
|
|
run: |
|
|
VERSION=$(node -p "require('./app.json').expo.version")
|
|
echo "SENTRY_RELEASE=opencode-mobile@${VERSION}" >> "$GITHUB_ENV"
|
|
echo "SENTRY_DIST=${VERSION}" >> "$GITHUB_ENV"
|
|
echo "Sentry release=opencode-mobile@${VERSION} dist=${VERSION}"
|
|
|
|
- name: Purge stale generated sources
|
|
# The Android build cache (restore-keys prefix fallback) can restore a
|
|
# generated autolinking tree from a previous package id. Gradle then
|
|
# reuses ReactNativeApplicationEntryPoint.java referencing the OLD
|
|
# package (ai.opencode.mobile.BuildConfig) and compileReleaseJavaWithJavac
|
|
# fails. Delete generated sources so prebuild + Gradle regenerate them
|
|
# for the current package (cc.agentlabs.opencode).
|
|
run: rm -rf android/app/build/generated android/build/generated android/app/build/intermediates
|
|
|
|
- name: Expo prebuild
|
|
run: npx expo prebuild --platform android --no-install
|
|
|
|
- name: Decode keystore
|
|
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/app/release.keystore
|
|
|
|
- name: Build AAB
|
|
working-directory: android
|
|
env:
|
|
RELEASE_STORE_FILE: release.keystore
|
|
RELEASE_STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
|
RELEASE_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
|
RELEASE_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
|
run: ./gradlew bundleRelease
|
|
|
|
- name: Verify the Sentry noise gate is in the artifact
|
|
# AGE-105: the org error quota is defended ONLY by the client-side gate
|
|
# (every server-side lever on this Sentry plan was checked and is dead:
|
|
# per-key rate limit silently no-ops with a 200, custom inbound filters
|
|
# absent, spike protection 403). If a build ships without the gate — or
|
|
# without a DSN, which makes Sentry a silent no-op — the org goes back
|
|
# over quota, and while it is over quota Sentry stores nothing, so the
|
|
# regression is invisible in Sentry itself until the monthly reset.
|
|
# Grep the shipped Hermes bundle instead. Verified to discriminate:
|
|
# v0.4.14 passes, pre-gate v0.4.13 fails.
|
|
run: node scripts/verify-release-bundle.mjs android/app/build/outputs/bundle/release/app-release.aab
|
|
|
|
- name: Upload AAB artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: app-release-bundle
|
|
path: android/app/build/outputs/bundle/release/app-release.aab
|
|
|
|
- name: Publish to Play Store
|
|
uses: r0adkll/upload-google-play@e738b9dd8f2476ea806d921b64aacd24f34515a5 # v1.1.5
|
|
with:
|
|
serviceAccountJsonPlainText: ${{ secrets.PLAY_STORE_SERVICE_ACCOUNT_JSON }}
|
|
packageName: cc.agentlabs.opencode
|
|
releaseFiles: android/app/build/outputs/bundle/release/app-release.aab
|
|
track: ${{ github.event.inputs.track || 'internal' }}
|
|
status: ${{ github.event.inputs.status || 'completed' }}
|
|
whatsNewDirectory: distribution/whatsnew
|