| 47 | 47 | | 2. Permissions: Account · Billing · Read; Account · Account Analytics · Read. |
| 48 | 48 | | 3. Account resources: Include · the g1t account. No zone permissions. |
| 49 | 49 | | 4. `cd services/billing && npx wrangler secret put CLOUDFLARE_BILLING_TOKEN`. |
| 50 | | − | 5. In sudo, Costs & margin → **Read the bill now**. |
| 50 | + | 5. In sudo, Costs & margin → **Run the analysis now**. |
| 51 | 51 | | |
| 52 | 52 | | Alerts are emailed through the `EMAIL` binding (Cloudflare Email Sending) |
| 53 | 53 | | to `COSTS_ALERT_EMAIL` (`hey@flagon.io`). An empty value sends none. |
| ⋯ |
| 66 | 66 | | replaces, never adds. |
| 67 | 67 | | 2. g1t's own counts for the same days (replaced per day). |
| 68 | 68 | | 3. Snapshot `pending_usage` into `pending_days`. |
| 69 | | − | 4. Reconcile those days into `margin_days` and `workspace_costs` |
| 69 | + | 4. Reconcile the last 31 days (further back after a gap) into |
| 70 | + | `margin_days` and `workspace_costs` |
| 70 | 71 | | (replaced per day). |
| 71 | 72 | | 5. Drift over the last 7 days into `cost_drift`. |
| 72 | 73 | | 6. Unit costs over the last 30 days, proposed to the price book. |
| ⋯ |
| 74 | 75 | | 8. Open, update and close margin alerts; email new ones. |
| 75 | 76 | | 9. Email owners on the plan about rises to come. |
| 76 | 77 | | |
| 77 | | − | **Read the bill now** in sudo (`admin_run_costs`) runs step 2 at once. |
| 78 | + | **Run the analysis now** at the top of sudo's Costs & margin page |
| 79 | + | (`admin_run_costs`) runs all of step 2 at once, alerts included, with no |
| 80 | + | need to wait for 04:17 UTC. Running it twice is safe: every step replaces |
| 81 | + | what it wrote. |
| 78 | 82 | | |
| 79 | 83 | | ## Reconciliation math |
| 80 | 84 | | |
| ⋯ |
| 169 | 173 | | Cloudflare's as it took (proposals as above). |
| 170 | 174 | | - **Drift threshold**. |
| 171 | 175 | | |
| 172 | | − | It applies from the next run; **Read the bill now** applies it at once. |
| 176 | + | It applies from the next run; **Run the analysis now** applies it at once. |
| 173 | 177 | | Every change is in the audit log (`cost_mapping`). |
| 174 | 178 | | |
| 175 | 179 | | ## Which raw meters are operations |