test(web): add Vitest CI, ADRs, and PR Definition of Done
FE unit-тесты селекторов/api-client в CI; ADR по durable jobs, OpenAPI codegen и legacy Svelte; PR template WEB-19; процесс KPI cross-app sync. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# ADR-001: Durable job queue via PostgreSQL job_audit
|
||||
|
||||
## Status
|
||||
|
||||
Accepted (2026-07)
|
||||
|
||||
## Context
|
||||
|
||||
`jobs.Registry` is in-process. ARCH-04 notes workers do not share memory across API replicas. Jobs were already audited to `job_audit`, but orphans after restart were not reclaimed.
|
||||
|
||||
## Decision
|
||||
|
||||
Keep in-process execution for latency; add durable reclaim:
|
||||
|
||||
1. Persist lifecycle via existing `SetPersistHooks` → `job_audit`.
|
||||
2. Periodically `ReclaimStaleRunning` + `ClaimQueued` with `FOR UPDATE SKIP LOCKED`.
|
||||
3. `Registry.Adopt` injects claimed rows into the local worker pool.
|
||||
4. Claim grace (`EVOBGP_JOB_CLAIM_GRACE`, default 30s) avoids double-run of fresh local enqueues.
|
||||
|
||||
NATS JetStream remains optional (`EVOBGP_BROKER_URL` logged only).
|
||||
|
||||
## Consequences
|
||||
|
||||
Two `evobgp-api` processes can reclaim orphaned work. Fresh jobs still run on the enqueueing process. Full broker-based fan-out is out of scope for this ADR.
|
||||
@@ -0,0 +1,20 @@
|
||||
# ADR-002: OpenAPI → TypeScript codegen
|
||||
|
||||
## Status
|
||||
|
||||
Accepted (2026-07)
|
||||
|
||||
## Context
|
||||
|
||||
HTTP SoT is `docs/openapi.yaml`. Frontend DTOs in `apps/web/src/types/api.ts` were hand-maintained and drifted.
|
||||
|
||||
## Decision
|
||||
|
||||
1. Generate `apps/web/src/types/api.gen.ts` with `openapi-typescript` (`pnpm --filter @evobgp/web run openapi:gen`).
|
||||
2. Keep `api.ts` as UI-facing aliases; re-export `OpenAPISchemas` for gradual adoption.
|
||||
3. CI (`scripts/check-openapi-gen.sh`) fails when gen is stale vs OpenAPI.
|
||||
4. `packages/shared` deferred until Zod DTOs are needed cross-app.
|
||||
|
||||
## Consequences
|
||||
|
||||
PRs that change OpenAPI must regenerate types. Hand DTOs remain until routes migrate to `api.gen` schemas.
|
||||
@@ -0,0 +1,17 @@
|
||||
# ADR-003: Removal of web-legacy-svelte
|
||||
|
||||
## Status
|
||||
|
||||
Accepted (2026-07)
|
||||
|
||||
## Context
|
||||
|
||||
`web-legacy-svelte/` (~294 files) confused agents/codegraph after the React + ReUI migration to `apps/web/`.
|
||||
|
||||
## Decision
|
||||
|
||||
Delete `web-legacy-svelte/` from `main`. Historical reference remains in git history. Docs and `AGENTS.md` point only to `apps/web/`.
|
||||
|
||||
## Consequences
|
||||
|
||||
No Svelte imports allowed. Restore from git history if a one-off migration reference is needed.
|
||||
Reference in New Issue
Block a user