# B2 — Egeko anatomy, second independent pass (2026-09-18)

A second read-only pass over `maptara_san_provider_egeko` returned after `B-egeko-anatomy.md`
was already written and after the HTML report had been published. It is **not** a duplicate:
it re-derives the same structure with a finer per-entry-point breakdown and disagrees with
pass 1 on two numbers. Both passes are kept. Where they disagree, this file records the
disagreement rather than silently picking a winner.

## Disagreements with pass 1 (`B-egeko-anatomy.md`)

| Claim | Pass 1 | Pass 2 | Resolution |
|---|---|---|---|
| Reusable transport lines | ~185 (13% of 1448) | ~230 (16% of 1448) | Both are method-span estimates, ±3 lines per span, with different boundaries for `require_auth` and `LogPlugin`. **Treat as 185–230 / 13–16%.** The argument does not change: a transport-only driver split touches under a fifth of the module. |
| WSDL fetch timeout | "inherits zeep's 300 s default" | "`Transport` gets no `timeout=`, runs on `requests`' default — can hang indefinitely" | **Neither is verified.** What is verified: `TIMEOUT = 30` is passed to `Client(...)` at `egeko_request.py:274` and **not** to `Transport(...)` at `:273`. The fallback value is UNKNOWN until `odoo/tools/zeep.py` is read. The finding — the WSDL GET is outside the 30 s cap, in a cron worker — stands either way. |
| `__manifest__.py` licence line | `:49` in base / `:30` in egeko | `:30` in egeko | Consistent; the `:49` figure was for `provider_base`. No conflict. |

## Net-new findings in pass 2

1. **The manifest lies about dependencies.** `__manifest__.py:21-23` declares only
   `maptara_san_provider_base`, but `models/maptara_provider.py:16` does
   `from ...maptara_base.utils import convert_german_date` — a *relative* import reaching
   across addon boundaries — and `:426` uses `self.env['maptara.document.service']` from
   `maptara_document_manager_api`. Both resolve only transitively via base
   (`maptara_san_provider_base/__manifest__.py:28-31`). Breaks the day base drops either.

2. **`getClosedMessages()` is used as a session-liveness ping** (`egeko_request.py:290`),
   response discarded, on every operation once the session is >10 min old. Whether that
   operation is side-effect-free at opta data is UNKNOWN. Doubles the call count.

3. **zeep's private `_value_1` is load-bearing** (`egeko_request.py:384`), and business code
   does `getattr(response.document, 'fileNumber')` on a live zeep object
   (`maptara_provider.py:605-608`). The business layer is directly coupled to zeep today;
   a driver boundary must return plain dicts/bytes or this leak simply moves.

4. **`LogPlugin.marshalled` calls `context.envelope.prune()`** (`egeko_request.py:234-235`) —
   empty elements are stripped from the wire payload by a *logging* plugin. A semantic
   decision hiding in observability code.

5. **Six copy-pasted credential/constructor blocks** at `maptara_provider.py:450, 471, 526,
   595, 629, 676`. A `provider.driver()` accessor deletes all six.

6. **Dead code:** `get_measure_code()` (`maptara_provider.py:191-195`) is called nowhere;
   `'measureCode': ''` is hardcoded at `:296` with a 9-line justification. `wizard/` is an
   empty package imported by `__init__.py:3`.

7. **Unexplained magic constants on every position:** `'serviceType': '01'` (`:301`),
   `'serviceIndicator': ... or '00'` (`:300`), `'serviceText': 'k.A.'` (`:376`),
   `'ownContribution': '0,00'` (`:297`, not routed through `de_decimal`). No comment, no
   source document cited. If opta data ever defines a second service type this is a silent
   data-quality bug.

8. **No HTTP status code is inspected anywhere in the module.** No `status_code`, no
   `raise_for_status`. Every failure mode — SOAP Fault, HTTP 500, DNS, TLS, a `TypeError` in
   our own dict — arrives as the same `UserError`, distinguishable only by stringified text.

9. **Two login paths, one honest.** `_web_authenticated` collapses every failure to `False`
   (`:301-303`) and the module's own docstring calls that useless (`:454-458`);
   `probe_egeko_credentials` (`:451-561`) duplicates the login rather than fixing it.

10. **`tools/fixtures/ours-S07001-20260813.xml` is a verbatim production capture.** Not read
    for personal data. Grep it for patient names and insurance numbers before it is copied
    anywhere.

## Test-coverage read (pass 2, more precise than pass 1)

83 tests, all offline. Pass 2 estimates **~45% of runtime lines, ~30% of branches**, and
names the uncovered set exactly: the ~45-key `document` dict (`maptara_provider.py:335-378`),
the appendix/MDM path (`:398-441`), `LogPlugin`, the resend `del internPrescriptionId`, the
`_get_cost_estimate_egeko` response parsing, and the "empty document response marks error and
must never delete, or the cron loops forever" invariant (`:656-670`).

Its recommendation matches R0 in the HTML report: characterisation tests for those five
before moving a line, with `tools/ekv_body_diff.py` wired into CI as the format oracle.
