# Cut over to the first live invoice

> Approve a rehearsed legacy snapshot, import opening receivables once, continue invoice numbers and resume safely after interruption.


Use `telco-cutover` for the first import into an isolated, freshly initialized telco estate. The source snapshot must cover the month before cutover, including its actual advance charges and unbilled usage. Cutover starts on the first of the following month. The worked package starts on 1 January 2027 with €30.35 receivable and invoice number 280. [Rehearse the snapshot](../docs/migration/) · [Prepare live fields and history](../docs/migration-format/)

## Prepare the destination

1. Start contractd, billd and accountingd with their normal schemas, operator configuration and ledger initialized. Keep external customer traffic, bank imports and unrelated operator writes closed until the receipt is ready. Internal delivery from contractd to billd must work. Install the exact tariff versions used in rehearsal.
2. Build the deployment tool with `cargo build --release -p telco-cutover` and put the binary on the operator’s path.
3. Supply `TELCO_CUTOVER_CONTRACTD_URL`, `TELCO_CUTOVER_BILLD_URL` and `TELCO_CUTOVER_ACCOUNTINGD_URL` from your deployment secret store. Each PostgreSQL login needs the corresponding service’s runtime grants. All three connections must reach the same database. Use an individually assigned billing login for the approving operator. The tool records the authenticated session role. Use authenticated TLS for remote database connections.
4. Retain the validated snapshot, separately extracted legacy invoice register, shadow report and review sheet under restricted access. They contain financial evidence. The live package also carries customer and payment details.

## Record the decision

```sh
telco-cutover review package.json --register register.json \
  --target-database telco --ledger-id telco.local/books \
  --approved-by migration_operator > approval.json
```

Review reconciles the register against the recomputed shadow report before contacting the destination. A missing or extra invoice, a different invoice ID, or a difference in net, VAT or gross blocks approval. Review also reads the target billing installation’s identity. It refuses missing invoices, unmapped lines and unexplained residuals. Enter a reason for each listed variance in `approval.json`, including changes that offset each other. Retain the original list and fingerprints. The sheet identifies the exact package, register, report, destination, journal and authorized billing login. Keep it under operator control until apply records the decision.

## Apply or resume

```sh
telco-cutover apply package.json approval.json --register register.json \
  --operator deploy/operator.example.toml --books pricebooks
telco-cutover status --target-database telco
```

Supply the operator TOML and price-book directory used by the target services. The production business date comes from the Europe/Berlin clock. Development or test estates can use the services’ `TELCO_ENVIRONMENT` and `TELCO_CLOCK` settings.

Billing checks the tariff pins and number counters and holds sealing. Contractd installs original agreements, service dates and mandates and retains source-to-target identifiers. Accountingd imports open items with their dunning levels and posts the opening receivable once per account, including any residual. Billd waits for its ordinary contract projection, installs the previous cycle’s advances and usage, then opens sealing at the first live period.

If the process stops, rerun **the same apply command with the same files**. The service receipts identify completed work. If billing is waiting for contract data, restore delivery from contractd to billd and rerun. Keep traffic isolated while investigating a refused import. A conflicting approval, another snapshot or an occupied destination requires reconciliation before proceeding.

## Check the first seal

`status` returns JSON. Before a run it returns `null`. During import, `ready` is false. Once ready, the normal billing pass can seal the first invoice. The receipt includes the accepted register digest and shows the first invoice’s number and recorded time as soon as it exists. `seconds_to_acceptance` measures from the retained review sheet’s validation timestamp to the accepted import. `seconds_to_first_invoice` measures from acceptance to sealing. Keep the review workstation and database clocks synchronized for cross-host timing.

In the worked estate, January seals as **RE-2027-000280 for €60.35**, including €0.38 of unbilled December calls. The €30.35 opening receivable is a separate accounting entry. Replaying the import preserves both the invoice sequence and the opening posting.
