# CHANGELOG WP1

## WP1-001B – Application Boundary

Status: implemented and locally tested

### Added

- `ReconciliationCommand` as transport-neutral application input.
- `CandidateDiscoveryGateway` as the application-side candidate-discovery port.
- `DiscoveredCandidate` as normalized gateway output (`score` range `0..1`).
- `ReconciliationApplicationService` to create and coordinate the WP1 domain objects.
- `ReconciliationOutcome` to return the domain result together with presentation-relevant discovery data.
- `LegacyCandidateDiscoveryAdapter` to encapsulate the existing `ReconciliationOrchestrator`, `TenantContext`, legacy `ReconciliationQuery`, and vocabulary configuration.
- `ApplicationBoundaryTest.php` as a dependency-free CLI test.

### Architectural effect

The intended dependency direction is now representable as:

```text
Transport / Controller
    -> ReconciliationApplicationService
        -> CandidateDiscoveryGateway
            <- LegacyCandidateDiscoveryAdapter
                -> existing ReconciliationOrchestrator
```

The Application layer has no dependency on OpenRefine, HTTP, the legacy query model, providers, or xTree. The existing public endpoint and controller are deliberately unchanged in this package.

### Mapping decisions

- The legacy integer score `0..100` is normalized to the domain/application range `0..1` inside the legacy adapter.
- The legacy `match` flag remains available through `ReconciliationOutcome.discoveredCandidates`; it is not interpreted as a domain `MatchDecision`.
- The selected `subVocabularyId`, when present, becomes `ReconciliationResult.targetVocabularyUri`; otherwise the preferred entity type is used provisionally.
- WP1 still creates exactly one `InterpretationGraph` with one root node.
- No repositories, SQL, transactions, context interpretation, or public OpenRefine mapping were added.

### Test

From the project root:

```bash
php tests/Domain/Reconciliation/DomainFoundationTest.php
php tests/Application/Reconciliation/ApplicationBoundaryTest.php
```

Expected output:

```text
WP1-001A Domain Foundation: OK
WP1-001B Application Boundary: OK
```

### Next package

`WP1-001C` should wire the existing OpenRefine transport to the new Application Boundary while preserving the current public JSON contract. Before that wiring, the concrete runtime construction of the tenant-specific legacy adapter must be placed after authentication.
