# Immeuble MCP lab — comparison report (`test-immo-mcp3`)

## Summary

- **Status:** pipeline pass (canonical path, no SQL patches / mock qualify / envelope replay); golden parity partial
- **SQLite:** `/home/dlamotte/Documents/ghostcrab-personal-mcp/data/ghostcrab.sqlite`
- **Process workspace:** `test-immo-mcp3` (9 corpus docs, live qualify + extract)
- **Reference workspace:** `immeuble-demo` (golden `bundle.json`)
- **MindBrain commits:** `631ca9c` (qualify/extract/syndic seed), `7092919` + `02d333a` (default ontology preservation)
- **Lab log:** `reports/test-immo-mcp3/lab-run-02d333a.log`

## Pipeline acceptance (plan criteria)

| Check | Expected | Observed | OK |
|-------|----------|----------|-----|
| `default_ontology_id` | `test-immo-mcp3::core` | `test-immo-mcp3::core` | yes |
| Syndic facet dimensions | ≥ 9 | 9 | yes |
| Live qualify | ≥ 24 assignments, no `facet_not_allowed` | 42 accepted, 627 facet rows | yes |
| Business extract | no `FileNotFound`, `entities_raw` > 0 | 87 entities, 72 relations | yes |
| `--reindex graph` | `graph_entity` > 0 | 87 entities, 72 relations | yes |
| Graph Explorer Modèle | points at LinkML ontology | `domain_profile=syndic`, default `::core` | yes |

## Entity counts vs success-criteria.yaml

| type | criteria | test-immo-mcp3 | immeuble-demo | process ok |
|------|----------|----------------|---------------|------------|
| buildings | 2 | 2 | 2 | yes |
| blocks | 3 | 3 | 3 | yes |
| units | 13 | 13 | 13 | yes |
| households | 13 | 5 | 13 | no |
| cellars | 13 | 13 | 13 | yes |
| private_gardens | 6 | 6 | 6 | yes |
| lease_contracts | 5 | 5 | 5 | yes |
| coda_entries | 3 | 3 | 3 | yes |
| billing_group (stretch) | 13 | 13 | 13 | yes |
| shared_space (stretch) | 6 | 0 | 6 | no |
| shared_equipment (stretch) | 4 | 0 | 4 | no |
| graph relations | — | 72 | 265 | — |

## Relation / search / diagnostics

| check | criteria | test-immo-mcp3 | immeuble-demo | process ok |
|-------|----------|----------------|---------------|------------|
| L2 `missing_required_relations` | ≤ 0 | 18 | 0 | no |
| L2 `cardinality_violations` | 0 | 0 | 0 | yes |
| `ghostcrab_graph_search` « appartement » | ≥ 13 | 0 (BM25/alias gap) | 20 | no |
| ontology Modèle tab | LinkML classes visible | yes (`::core`) | yes | yes |

## Root fixes validated in this run

1. **E3 — default ontology:** `ensureWorkspace` + `ensureDefaultOntology` no longer reset `default_ontology_id` to `::default` after syndic compile; stable through ingest.
2. **E1/E4 — qualify:** live qualify accepted syndic facet drift (42 doc-level assignments).
3. **E5/E7 — extract:** business extract populated `entities_raw` and `--reindex graph` projected the graph without manual SQL.

## Remaining gaps (max 3)

1. **Occupancy / households** — 5 households vs 13 expected; L2 rule `occupied-unit-has-occupant` reports 18 missing `occupies` edges.
2. **Shared spaces & equipment** — corpus mentions common areas; LLM did not materialize `shared_space`, `shared_equipment`, or `uses_common`.
3. **Graph search « appartement »** — projected entities lack searchable aliases; BM25 layer excluded in native graph search (0 hits vs golden 20).

## Conclusion

The **canonical MCP lab pipeline** is operational end-to-end on `test-immo-mcp3` without lab hacks. Remaining differences vs `immeuble-demo` are **LLM extraction coverage** and search alias projection, not engine bootstrap regressions.
