> ## Documentation Index
> Fetch the complete documentation index at: https://docs.moda.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# C

# C — bills, prices, owners and registry

## Goal

Pass the owner rung: bill dollars have an owner and a serving/R\&D/CI/retired
class. Own bill gaps, credential inventory, prices and `manual-bills.ts` in both
the collector and database package. The scoreboard holds current values.
See the [architecture](../architecture.md), not a copied baseline here.

## Metric

Share of bill-backed dollars with owner and class. This is an **interim readiness
query**. The executable diagnostic
below is a conservative **published attribution lower bound**, not approval of
the pending owner registry. Serving attribution names an app; internal ownership
must name an initiator and an explicit CI/R\&D/retired category. Unknown/internal
overhead and unexplained rows are uncovered. Absolute amounts measure exposure;
signed invoice conservation is separately required from E. Do not equate a
caller app with a human-approved registry entry or ignore missing provider bills.

## Proof query

```sql theme={"dark"}
WITH publications AS (
  SELECT day,argMax(ledger_run_id,tuple(ledger_version,published_at,ledger_run_id)) AS run
  FROM moda.cost_ledger_publications
  WHERE day>=toDate(now('UTC'))-7 AND day<toDate(now('UTC')) GROUP BY day
), classified AS (
  SELECT cost_nanos,
    (kind IN ('exact','measured','allocated') AND caller_app!='')
    OR (kind='internal' AND initiator_id!='' AND initiator_kind IN ('ci','eval','experiment','dev','retired')) AS owner_class_known
  FROM moda.cost_ledger_daily FINAL
  PREWHERE day>=toDate(now('UTC'))-7 AND day<toDate(now('UTC'))
  WHERE (day,ledger_run_id) IN (SELECT day,run FROM publications)
)
SELECT sum(abs(toInt128(cost_nanos))) AS bill_backed_exposure_nanos,
  sumIf(abs(toInt128(cost_nanos)),owner_class_known)/nullIf(sum(abs(toInt128(cost_nanos))),0) AS owner_class_lower_bound,
  toUInt8(bill_backed_exposure_nanos>0 AND owner_class_lower_bound>=0.95) AS attribution_prerequisite_pass
FROM classified
SETTINGS readonly=2,max_threads=1,max_bytes_to_read=1000000000,max_result_rows=1000,
  max_execution_time=30,read_overflow_mode='throw',result_overflow_mode='throw'
```

## PRs to adopt now

From the [merged map](../pr-lane-map.md): #11508 (manual PlanetScale invoices),
\#11502 (bounded collector retries), #11326 (runtime key owners), #11269
(per-credential reconciliation), #11265 (per-app keys/deploy inventory).
Coordinate #11515 with A/E; do not push to their PR. The collector's ledger
wiring and database `rate.ts`/`financial-source.ts` belong to E, not C.
E also owns the CI planner, ledger-load/schema-wait helpers, instrumentation and
wiring/retirement tests needed by #11642; that PR waits for the architect's
ownership correction in #11646 to land first.

## Stop-and-ask conditions

Stop on missing invoices, an ambiguous owner/class, replacing provider charges
with estimates, cross-lane edits or any migration/deploy/credential activation.
Do not classify R\&D, CI or retired work as serving to improve tenant coverage.
Follow [standing rules](README.md).

## Exit check

`attribution_prerequisite_pass` must pass with a nonempty denominator. Full owner
exit additionally reconciles this diagnostic to the approved owner registry and
complete bill inventory at the same day/account grain. Until registry proof is
available, **full lane exit is blocked until the approved owner registry exists
and has a registry-backed proof query**, regardless of this lower-bound query.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.