# Internet Business Report Interference SOP

## Purpose

This operation runs fixed, report-shaped Ride, Food, and Mart reads while the
selected Internet foreground workload remains active. It records one bounded
latency and statement-RU observation stream per report so later analysis can
compare report cost, foreground impact, and RU-model separation.

The operation is part of the existing `run` stage. It does not add a public
stage and the testcase contract is not E2E evidence by itself.

## Fixed business reports

| ID | Domain | Business use |
| --- | --- | --- |
| `ride_report_01` | Ride | Service-area demand, dispatch, assignment, trip fulfillment, and SLA funnel |
| `ride_report_02` | Ride | Driver capacity utilization and dispatch effectiveness |
| `ride_report_03` | Ride | Payment, refund, ledger, and settlement reconciliation |
| `food_report_01` | Food | Merchant preparation capacity and item fulfillment |
| `food_report_02` | Food | Courier batching, pickup/delivery SLA, and capacity utilization |
| `food_report_03` | Food | Payment, refund, ledger, and settlement reconciliation |
| `mart_report_01` | Mart | Inventory reservation, fill rate, and substitution analysis |
| `mart_report_02` | Mart | Store pick-pack capacity and fulfillment throughput |
| `mart_report_03` | Mart | Single/split delivery SLA and courier fulfillment |
| `mart_report_04` | Mart | Payment, refund, ledger, and settlement reconciliation |

Every SQL statement scans the retained domain history and performs the joins,
conditional aggregation, grouping, and ordering required by the report. The
result is bounded to Top 100 rows; the input work is not replaced by a random,
empty, or dynamically selected time range.

## Source configuration

Select one complete domain catalog:

```yaml
operations:
  - id: big_query
    enabled: true
    runtime:
      domains: [food]
      start_after_foreground_ready_seconds: 60
      duration_seconds: 180
      query_timeout_seconds: 120
      interval_seconds: 5
      max_samples_per_query: 32
```

Select a domain pair:

```yaml
operations:
  - id: big_query
    enabled: true
    runtime:
      domains: [ride, mart]
```

Select individual reports. When `domains` is omitted, TiPoC derives `ride`,
`food`, and `mart` ownership from the query IDs:

```yaml
operations:
  - id: big_query
    enabled: true
    runtime:
      query_ids: [ride_report_01, food_report_02, mart_report_04]
```

The complete selection cardinalities are Ride=3, Food=3, Mart=4,
Ride+Food=6, Ride+Mart=7, Food+Mart=7, and all domains=10. Each selected report
owns exactly one worker and one pinned TiDB session when session RU collection
is enabled.

## Statement RU collection

Enable the existing session provider for the run:

```bash
export TIPOC_QUERY_COST_MODE=latency_and_statement_ru
export TIPOC_QUERY_COST_ATTEMPT_RU_SOURCE=tidb_last_query_info
```

RU is read immediately after the business statement on the same session. The
RU probe duration is excluded from the business latency. Provider identity and
RU model are recorded separately; the current model is
`resource_control_rru_plus_wru`. An unavailable provider is recorded with a
missing reason and is never converted to zero RU.

## Prepare and run evidence

Prepare fails closed unless TiDB can `EXPLAIN FORMAT='brief'` every selected
statement against the immutable Ride/Food/Mart database bindings. The binding
retains exact SQL digests, plan digests, operators, and estimated rows.

Run retains:

- selected domains and query IDs;
- started, completed, failed, and canceled counters per report;
- bounded per-execution latency, drained-row, RU, provider, model, and missing-reason observations;
- node worker plans, worker receipts, and the final operation receipt.

The reusable case matrix and required report fields are in
`testcase/internet-big-query-interference.json`.

Recovery and rerun cleanup never start report workers. A configured operation
also fails instead of producing an empty success when its delayed execution
window is empty or any selected report produces no execution sample.
