46a0a9c00c
dict-relationships-v2 epic, Phase 1 read-side. Backend готов; admin UI
(card "Used by" + record references) — отдельным commit'ом.
Что добавлено:
- `DependentsQuery` (interface) + `DependentsQueryJdbc` (impl) — native
SQL для record-level dependents lookup (paginated). Interface extracted
чтобы Mockito мог mock'нуть на JDK 25 (concrete-class inline-mock incompat).
- `LineageIndexService` — два режима:
* `findSchemaDependents(name, scopes)` — schema-level reverse FK list
(in-memory traversal definitions, microseconds). Skip self-reference,
scope-hidden sources, malformed x-references (logged warn).
* `findRecordDependents(dict, businessKey, scopes, page, size)` —
record-level paginated, perSource summary + total. Phase 2 переносит
на materialized view; пока живём с прямым JSONB query (acceptable
для <5k SLO).
- `LineageController` — два endpoint'а:
* `GET /api/v1/dictionaries/{name}/dependents`
* `GET /api/v1/records/{dict}/{businessKey}/dependents?page&size`
Errors: 404 dictionary_not_found / record_not_active, 400 invalid_pagination.
Scope hiding делает target invisible (empty list / 404 — без leak existence).
Tests:
- LineageIndexServiceTest (16 unit tests):
* Schema-level: not_found, scope hidden, single ref + count, onClose
propagation (BLOCK default + CASCADE explicit), sorting, source scope
hidden, self-reference skip, malformed skip, target without properties.
* Record-level: invalid pagination (page<0, size<1, size>200),
dict_not_found, record_not_active, no schema refs → empty page,
1 source с dependents → items+perSource+total, pagination через
page=0/1/2 size=2 (3 страницы из 5 records).
- ReferenceCloseRegressionTest (4 mandatory regression tests):
* v1.2.1 schema без x-references-on-close — validate() возвращает
те же error codes (никаких новых on_close/cascade в codes).
* Schema parser default'ит onClose=BLOCK для v1.2.1 schemas.
* Legacy single-arg parseRef(spec) без property schema сохраняет contract.
* Schema без x-references вообще — full no-op (30+ legacy справочников).
mvn -pl ordinis-rest-api -am test: 89/89 PASS (5.686s).
mvn verify -pl '!ordinis-app': все модули SUCCESS (9.031s).
Backward-compat: bundle v1.2.1 → identical поведение к v1.0.7. Cascade engine
не поднимается на closed-side (Phase 3 territory).