# Состояние разработки Ordinis (ЦУОД ОДХ)

**Версия:** v2.14.0 (mega-sprint feature wave: 38 MRs за 2 дня, prod v2.8.0 → v2.14.0)
**Дата:** 2026-05-12 (vespertine update — конец дня 2)
**Owner:** zimin.an@nstart.space
**Окружения:**
- **prod** (cluster.264, https://ordinis.k8s.264.nstart.cloud, ✅ LIVE v2.14.0, Альтум traffic stable)
- **staging** (cluster.265, dev environment)
**Предыдущий snapshot:** [2026-05-07-state.md](./2026-05-07-state.md) (v1.0.1, post-cutover hardening)

---

## 0. Что изменилось с v1.0.1 (2026-05-07 → 2026-05-12)

### Mega-sprint feature wave

**День 1 (2026-05-11):** !108–!140 = 33 MRs merged (28 features + 3 chores + 1 closed zombie + 1 v2.11.x deploy pending). Tags v2.0.0 → v2.11.0. Highlights: backend pending endpoints (5/5 + extras), schema workflow API (8 endpoints) + Phase 1a/b/c UI, History tab wiring, TimeTravelModal fully wired, Monaco editor, friendly error UI, webhook stats dashboard.

**День 2 (2026-05-12):** !141–!147 = 7 MRs (5 merged + 2 design-only open). Tags v2.12.0 → v2.14.0. Focus shifted: feature shipping → polish + design proposals.

### День 2 detail (focus этого state.md)

**Polish features shipped:**
- **!141 → v2.12.0** RecordDrawer chip strip scroll-spy (IntersectionObserver active section highlight)
- **!142 → v2.13.0** Searchable MultiSelect через cmdk + DateRangePicker (react-day-picker, lazy chunk 67kb gz)
- **!143 → v2.14.0** Webhook delivery histogram (SVG stacked bar chart, 24h/7d toggle, hover tooltip)

**Design proposals (3 docs, не implementation):**
- **!143 + !144** Redis FK projection design v1 → v2.1 после 2 rounds /plan-eng-review. **NEAR-CLEAR.** Sprint estimate 8.5d → 4-5d после `LineageIndexService` reuse decision. 15-test plan + 3 critical safety mitigations + 3-tier kill switch + explicit SLO targets.
- **!145 + !146** AI schema assist design v1 → v2 после /office-hours. **Approach C-revised (hybrid template + per-field LLM)** chosen over v1 whole-schema LLM. 7B model на consumer GPU. P5 measurement step как prerequisite. 3-4d implementation.
- **!145 + !147** Dictionary marketplace design v1 → v2 после /office-hours + cross-model challenge. **Approach C-revised (bundle hygiene 2-3d hard cap)** chosen over v1 full marketplace (10-14d). Java handoff readiness + sales artifact angle. Anti-creep enforcement language.

**Prod deploy v2.14.0:**
- Pipeline 6700 (manual API trigger on tag)
- Bridge `trigger-deploy-prod` (id=30851) — played
- Downstream pipeline 6708 в ordinis-infra (project 368)
- Manual gate `deploy-prod` (id=30893) — played
- Helm rollout ~70s, no rollback
- Verified: `curl https://ordinis.k8s.264.nstart.cloud/api/v1/version` → `{tag: "v2.14.0", commit: "08c92627"}`

### 0.1. New design proposals (decision artifacts)

Все три ждут measurement / customer event / GPU availability перед implement:

| Design doc | Status | Effort | Prerequisite | Defer rationale |
|---|---|---|---|---|
| `docs-internal/design/redis-fk-projection.md` v2.1 | CLEAR | 4-5d | Dict упрётся в latency SLA | Premature optimization, текущий read path handles RPS |
| `docs-internal/design/ai-schema-assist.md` v2 | CHOSEN (Approach C) | 3-4d | Baseline measurement 2 weeks + GPU verification | Demand evidence пока ZERO — founder-driven feature |
| `docs-internal/design/dictionary-marketplace.md` v2 | CHOSEN (Bundle hygiene C-revised) | 2-3d hard cap | Customer #2 ETA + signing key infra decision | Bundle hygiene proceeds Q3, full marketplace ждёт N=2 customers |

**Design docs moved** из `docs/design/` → `docs-internal/design/` per /docs/ scope discipline (public docs = integrator + operator + reviewer only, no engineering internals).

`/office-hours` formal docs:
- `~/.gstack/projects/claude/zimin-main-design-ai-schema-assist-20260512.md`
- `~/.gstack/projects/claude/zimin-main-design-bundle-hygiene-20260512.md`

---

## 1. Стек / архитектура (без изменений с 2026-05-07)

Backend: Java 21 + Spring Boot 3.4.2 + JPA + Liquibase + PostgreSQL 18 + PostGIS + Kafka + Caffeine + Redis. Микросервисы: ordinis-app (writer), ordinis-read-api, ordinis-projection-writer, config-server. Outbox + Kafka publisher pattern, idempotency keys, audit log, valid_from/valid_to + EXCLUSION CONSTRAINT, data_scope filtering.

Frontend: React 19 + Vite 7 + TanStack Router + TanStack Query + Tailwind v4 + Radix primitives + cmdk + sonner toaster + @phosphor-icons/react + Monaco editor (lazy) + react-day-picker (lazy). Custom UI primitives только. @nstart/ui dropped (Stage 3.9).

Auth: Keycloak OIDC + JWT scope-based RBAC. `realm_access.roles` → DataScope (PUBLIC/INTERNAL/RESTRICTED). audience optional.

Infra: cluster.264 prod / cluster.265 staging. CNPG для PostgreSQL (single-instance, daily backups к S3 через geoportal-minio). Strimzi Kafka KRaft single broker. Vault (k8s auth). Redis для projection (per-dict opt-in feature flag).

---

## 2. Functional coverage matrix (updated)

### 2.1. UI features ✅ live на v2.14.0

| Feature | First shipped | Polish | Status |
|---|---|---|---|
| Schema workflow (draft → review → publish) UI | v2.5.0-v2.8.0 (Phase 1a/b/c) | — | ✅ live |
| TimeTravel modal (changes / records / schema tabs) | v2.10.0-v2.11.0 | — | ✅ live |
| History tab + Compare modal | v2.5.0 | — | ✅ live |
| Monaco editor для schema authoring | v2.8.0 | — | ✅ live |
| /reviews tabs (Записи / Схемы) | v2.8.0 | — | ✅ live |
| Friendly error UI (QueryErrorState, 10 sites) | v2.10.0 | — | ✅ live |
| Webhook stats cards (Pending/Retry/Delivered/DLQ + success rate) | v2.9.0 | — | ✅ live |
| Webhook stats histogram (SVG, 24h/7d) | v2.14.0 | — | ✅ live |
| RecordDrawer toolbar (search полей + только заполненные + scroll-spy chip strip) | v2.5.0-v2.12.0 | active section highlight | ✅ live |
| cmdk searchable MultiSelect (webhook events) | v2.13.0 | — | ✅ live |
| DateRangePicker (audit page) | v2.13.0 | — | ✅ live |
| Dark theme sweep (bg-white → bg-surface) | v2.6.0 | — | ✅ live |
| Mobile responsive (Sheet sidebar) | previously done | — | ✅ live |

### 2.2. Backend APIs ✅ live на v2.14.0

| Endpoint group | First shipped | Status |
|---|---|---|
| Dictionary CRUD + bitemporal records | v0.x | ✅ live |
| Schema workflow API (8 endpoints + audit) | v2.2.0 | ✅ live |
| Full timeline `/changelog` с kind discrimination | v2.3.x | ✅ live |
| Diff endpoint `/changelog/{entryId}/diff` | v2.4.0 | ✅ live |
| PATCH `/drafts/{id}` (edit без recreate) | v2.7.0 | ✅ live |
| Webhook subscriptions CRUD + DLQ + replay | v1.x | ✅ live |
| **Webhook stats `/subscriptions/{id}/stats?bucketBy=hour\|day`** | v2.14.0 | ✅ live (NEW) |

### 2.3. Что НЕ shipped (design only)

| Feature | Doc | Status | Blocker |
|---|---|---|---|
| Redis FK projection cascade invalidation | `docs/design/redis-fk-projection.md` v2.1 | CLEAR after 2 reviews | Dict latency SLA |
| AI schema assist (template + per-field LLM) | `docs/design/ai-schema-assist.md` v2 | Approach C chosen | P5 measurement + GPU |
| Bundle hygiene (manifest + publisher CLI, NO UI) | `docs/design/dictionary-marketplace.md` v2 | Approach C-revised chosen | Customer #2 ETA + signing key infra decision |

---

## 3. Backlog state (post-mega-sprint)

### 3.1. Active assignments (этой недели / следующих 2 weeks)

1. **P0 metric для AI schema baseline** — add `admin.schema_authoring.seconds` в `DictionaryDefinitionService.createDraft()`. Ship в v2.15.0 (~1h work). **Critical:** без этого нельзя decide P50 demand evidence для AI feature.
2. **2-weeks baseline collection** на v2.14.0 prod. После — decision: P50 > 20 min → implement AI schema assist Phase 1 (3-4d), P50 < 10 min → defer AI, ship bundle hygiene (2-3d).
3. **GPU verification** в k8s prod cluster (parallel с baseline collection). Talk to ops, confirm vLLM availability.
4. **Bundle signing key infrastructure decision** с corp ops (GitLab CI variables protected vs Vault vs HSM). Document choice.
5. **Customer #2 ETA confirm** — Альтум integration milestone, гидрометео preliminary discussion status. Informs marketplace urgency (не gates implementation though — bundle hygiene proceeds regardless).

### 3.2. Deferred (low priority)

| # | Item | Effort | Блокер |
|---|---|---|---|
| 1 | Phase 1d Keycloak roles в `useCanReviewSchema/Publish` | ~30 мин | infra не пробросила `realm_access.roles` в JWT |
| 2 | GitHub mirror sync (`git subtree split --prefix=ordinis-admin-ui`) | 1 мин | 2 weeks v2.14.0 stability observation |
| 3 | nsi-hot.md update v2.8.0 → v2.14.0 | 10 мин | low priority maintenance |

### 3.3. Roadmap (governance / data quality / federation, 2-3 quartals)

Без изменений с 2026-05-05-state.md:
- Approval workflow v2 (multi-step approval chain, BPM Camunda integration)
- Lineage / dependency graph
- Geo first-class (bbox/polygon query)
- Cross-dictionary FK cascade rules
- Data quality rules engine (cross-field constraints, ML-anomaly detection)
- Federation MDM-кластеров (master/replica)
- Schema registry (Apicurio/Confluent) для Kafka
- Webhooks для не-Kafka consumer'ов

---

## 4. Open risks (updated)

1. **Customer #2 acquisition velocity** — marketplace + AI assist designs assume timeline. Если customer #2 не появляется в Q3 — design docs sit, no rework needed но opportunity cost real.
2. **P5 measurement may invalidate AI assist hypothesis.** Baseline P50 < 10 min → 30мин «admin pain» субъективна, feature defer'нется. Cost = ~1h metric work, low risk.
3. **GPU availability в prod cluster** uncertain. Если нет — AI schema assist requires either: external API за feature flag (compromise data perimeter для non-classified), procurement new GPU node (delay weeks-months), or skip feature entirely.
4. **Bundle hygiene scope creep risk.** Hard cap 2-3 days с anti-creep enforcement language — but founder discipline ultimate enforcement. PR review rule: reject additions outside «what ships» list.
5. **CHANGELOG.md bundling в frontend** (v2.14.0 «Что нового» feature) — main bundle вырос 394kb → 427kb (+33kb / +13kb gz). CHANGELOG растёт ~500 bytes per release. Через 100 releases это ~50kb extra. Acceptable now, может потребовать lazy-load или backend endpoint в будущем.

---

## 5. Naming / branding state

- Repo: `ordinis` (was `nsi`)
- Product display: «Ordinis» английский / «Ордин» русский (rare)
- Customer #1: ЦУОД ОДХ (anchor)
- Bundle ID convention: `<domain>.<vertical>.<bundle-name>` (e.g. `ru.cuod.dzz-ground-segment`)
- Tag scheme: semver `vMAJOR.MINOR.PATCH`, auto-bumped via semantic-release
- Prod URL: https://ordinis.k8s.264.nstart.cloud
- Swagger: https://ordinis.k8s.264.nstart.cloud/swagger-ui.html
- Docs: https://ordinis.k8s.264.nstart.cloud/docs/ (mkdocs)

---

## 6. Workflow patterns (operational learnings, this session)

1. **GitLab deploy gate sequence:** trigger pipeline → play `trigger-deploy-prod` bridge → play downstream `deploy-prod` job. Three separate explicit confirmations.
2. **`GITLAB_HOST=git.nstart.cloud`** env var нужен для `glab api` calls (default goes к gitlab.com). `glab mr view` works without (uses git remote).
3. **Manual API pipeline trigger** для prod deploy (semantic-release bot pipelines skip CI). `glab api -X POST projects/367/pipeline?ref=v{TAG}`.
4. **Cross-model challenge** in /office-hours Phase 3.5 critical — каждый раз когда engaged surface'нул substantial issues missed by single-model reasoning. Marketplace session was strongest example: my pure-defer recommendation overcorrected, subagent caught 4 misses, final synthesis better than either pure position.

---

## Резюме

- **Prod v2.14.0 live** на cluster.264. 6 minor versions shipped в один день (v2.8.0 → v2.14.0). 38 MRs total за 2 дня.
- **Three design proposals documented** с explicit prerequisites + measurement steps + hard caps. None implementation. Defer recommendations stand.
- **Главный риск** для дальнейшего product development — не technical, а demand signal. AI assist / marketplace требуют customer pull или measurement evidence перед dev investment.
- **Next concrete action:** ship metric `admin.schema_authoring.seconds` в v2.15.0 (~1h work), затем 2 weeks observation.

**Прогноз до next major release decision (v3 vs v2.x):** ~2-4 weeks pending baseline measurement results + customer #2 conversation outcomes.
