# QAR — Fidelity, Quality, CI and Release

## Цель

Сделать точность, производительность и расширяемость проверяемыми свойствами, а не обещаниями.

## QAR-1. Fidelity lab

- Каталог сценариев original client 3.3.5a: setup, input, server state, expected output.
- Paired screenshots/video/log/packet/state evidence с provenance.
- Поведение классифицируется: `Unknown`, `Observed`, `Matched`, `Intentional deviation`, `Blocked`.
- Independent references могут подсказать hypothesis, но не повышают статус без evidence.
- Blizzlike bugs/exploits обрабатываются policy decision: protocol compatibility отдельно от harmful behavior.

## QAR-2. Test layers

- Native unit tests: parsers, crypto, compression, coordinates, math, caches.
- GDScript/domain unit tests: reducers, validators, commands, view models.
- Contract tests: packets, DB adapters, Lua API, content schemas, renderer facade.
- Scene tests: lifecycle, input, UI, renderer attachment, EditorPlugin reload.
- Integration: disposable core/DB, import/build/deploy, login/world/gameplay.
- E2E: leveling loop, dungeon, PvP/service flows и authoring vertical slices.
- Visual/performance and exploratory design tests complement automation.

## QAR-3. Godot testing stack

- Оценить GdUnit4 как candidate для Godot 4.6 GDScript/scene/CI tests.
- Native GDExtension tests используют подходящий C++ test runner отдельно от engine-internal doctest unless Godot itself is rebuilt.
- Headless commands возвращают non-zero и machine-readable JUnit/JSON reports.
- Scene tests не зависят от proprietary assets: synthetic fixtures or locally resolved optional corpus.
- Flaky retries не превращают failure в success; instability измеряется и исправляется.

## QAR-4. Golden and property testing

- Golden binary structures and exact-byte packet vectors.
- Parser round-trip where format permits; malformed/truncated/fuzz corpus.
- Coordinate transform property tests and known world points.
- Deterministic content manifests, SQL diff and migration before/after fixtures.
- Lua oracle corpus, navmesh reference counts/queries, material descriptor mappings.

## QAR-5. Performance budgets

- Startup/data check/login/world entry.
- Streaming cold/warm traversal and teleport.
- CPU/GPU frame p50/p95/p99/max hitch, draw calls, memory и descriptors.
- Network decode/apply queues and reconciliation error.
- UI `OnUpdate`, event fan-out, Lua allocations/GC.
- Editor import/bake/validation latency and cancellation responsiveness.
- Server deployment/playtest turnaround.
- Budgets hardware/profile-specific and trend tracked.

## QAR-6. Observability

- Structured logging categories and stable diagnostic codes.
- Correlation IDs session/job/entity/content change set.
- Runtime metrics: queues, entities, cache hit, resource counts, RIDs, packet rate.
- Editor metrics: jobs, diagnostics, artifact hashes, DB operations.
- Debug overlays and Godot profiler/visual profiler capture workflow.
- Payload, credentials, chat/personal content redacted by default.

## QAR-7. CI pipeline

Pull request gates:

1. formatting/static analysis/document links/target marker validation;
2. native build and unit tests;
3. headless Godot load and GDScript tests;
4. affected parser/protocol/content/adapter contracts;
5. deterministic artifact check;
6. renderer smoke if visual code changed;
7. license/dependency audit.

Nightly/weekly:

- disposable TrinityCore/AzerothCore integration;
- full packet/Lua/parser replay corpus;
- visual checkpoints on available GPU runners;
- long traversal, reconnect, cache migration and soak;
- previous schema/Godot/core compatibility matrix.

## QAR-8. Security and robustness

- Bounds checked binary parsing and fuzzing.
- Lua sandbox/taint/protected actions.
- DB least privilege, read-only default, production protection.
- Untrusted addon/content/plugin permission model.
- Dependency license/advisory/source pin audit.
- Atomic files, backup, recovery and rollback.
- No proprietary assets, secrets or production dumps in repository/artifacts.

## QAR-9. Documentation and decisions

- Architecture/API/schema changes update docs and ADR в том же work package.
- Каждый самостоятельный module имеет specification по `docs/DOCUMENTATION_STANDARD.md`: purpose, boundaries, public API, inputs/outputs, data flow, ownership, errors, tests и source map.
- Data-flow diagram обязательна всегда; state/sequence/dependency diagrams обязательны по сложности/lifecycle rules стандарта.
- Inline docs являются источником точной сигнатуры, module spec — источником концепции и фактического статуса.
- Tooling candidates tracked in `docs/TOOLING_CATALOG.md` with status and pinned version.
- Feature coverage links implementation, tests, fidelity evidence and known gaps.
- Generated API docs for documented GDScript/GDExtension public surface включаются в quality gate, когда pipeline подготовлен.

## QAR-9A. Code clarity and KISS

- Naming и simplicity проверяются по `docs/CODING_STANDARD.md`.
- Длинное точное имя предпочтительнее неочевидного сокращения; length не является целью сама по себе.
- Complexity metrics используются как сигнал для review, а не автоматическая причина переписывания domain-heavy code.
- Premature generic frameworks, service locators, duplicate registries и unmeasured native optimizations блокируют integration.
- Неизбежно сложный parser/protocol/streaming/UI security code обязан быть изолирован, иметь reference fixtures и диаграмму.
- Contributor workflow describes smallest reproducible diagnostic commands.

## QAR-10. Packaging and release

- Client ships without Blizzard data and guides user to select legally owned install.
- Import/cache first-run is resumable and reports disk/time requirements.
- Platform packages include matching GDExtension libraries and dependency notices.
- Content package and server module releases version independently with compatibility manifest.
- Save/settings/content schema migrations tested from supported previous versions.
- Release channels: developer, preview, stable; fidelity gaps visible in notes.

## Exit gate

Release candidate passes required core/platform/profile matrix; no critical unowned diagnostic; performance regression within approved bounds; artifacts reproducible and license-clean; known fidelity deviations documented.
