# Test, observe, and wire BLOGE for production

## When to use

Use this task when a graph moves beyond a local example: tests must describe failure behavior, operations need signals, Spring owns wiring, or capacity/failover claims are being made. Stop before adding production modules that have no stated operational owner.

## Inspect first

- Read the repository test conventions and effective Maven module graph.
- Locate Operator registration, graph loading, `GraphEngine` construction, and any `GraphEngineCustomizer`.
- Inventory logs, metrics, traces, execution identity, and incident queries.
- Identify the exact workload and failure claim before designing a capacity or takeover experiment.

## Required inputs

Obtain the behaviors to prove, failure classes, required observability fields, Spring bean ownership, deployment topology, expected concurrency, service limits, lease/routing model, and acceptance thresholds.

## Implementation path

1. Add a focused graph/Operator test for the changed behavior and one controlled failure.
2. Add module-level integration only when wiring, persistence, or runtime boundaries are involved.
3. Emit or verify signals that answer: which execution, which node, which attempt, which decision, and which terminal state.
4. In Spring, prefer starter-managed `GraphEngine`, discovered `@BlogeOperator` beans, and loaded graph beans; customize one concern at a time.
5. Benchmark the bottleneck with attributable inputs and report environment, command, throughput, latency, error, and saturation.
6. Test lease takeover and stable routing separately from raw capacity.

## MUST / SHOULD / MAY

- **MUST** report focused, module, and full-reactor results as different evidence scopes.
- **MUST** treat `Tests run: 0` and skipped tests as non-evidence.
- **MUST** avoid double-registering Operators or replacing starter beans without accepting full ownership.
- **SHOULD** propagate stable execution and business identity into logs/metrics/traces.
- **SHOULD** make capacity claims attributable to a documented environment and workload.
- **MAY** override one Spring component through an explicit customizer when its ownership remains clear.

## Failure patterns

- Mock-only tests prove wiring: add the smallest real loader/registry/runtime boundary needed by the claim.
- A successful HTTP response proves graph success: inspect terminal graph and node outcomes.
- Defining a custom registry makes annotated Operators disappear: choose automatic discovery or full manual ownership, not both accidentally.
- A timeout is called failover: test lease expiry, epoch/fencing, takeover, and stale-owner rejection.

## Validation

Run the focused test first, affected module tests second, and full reactor only when shared contracts or repository policy require it. Verify at least one failure path in logs/metrics/traces. Record benchmark and failover evidence with their limits.

## Evidence

- [Graph testing](/en/v/0.9.8-RC1/18-testing-your-graphs)
- [Production observability](/en/v/0.9.8-RC1/19-observability-in-production)
- [Spring wiring](/en/v/0.9.8-RC1/20-spring-and-production-wiring)
- [Capacity and distributed boundaries](/en/v/0.9.8-RC1/22-distributed-capacity)
- [Validation scopes](/agent/en/v/0.9.8-RC1/reference/validation-scopes.md)
