Enhance test infrastructure and configuration for JWKS and Docker setup
ci/woodpecker/push/build-arm Pipeline was successful

- Updated Azaion.Missions.csproj to exclude test sources from service compilation, preventing build failures due to test project dependencies.
- Modified docker-compose.test.yml to preload the pg_stat_statements extension for testing and adjusted JWT refresh intervals for better test execution timing.
- Enhanced Dockerfile to install wget for health checks and ensure proper initialization of the container.
- Introduced a test-only endpoint for JWKS refresh to facilitate end-to-end testing without relying on the default refresh intervals.
- Updated DTOs in ApiDtos.cs to reflect camelCase naming conventions for consistency with service responses.
- Improved test cases to handle JWKS rotation and refresh scenarios effectively, ensuring robust validation of JWT handling.

This commit lays the groundwork for more reliable and efficient testing of the Azaion.Missions project.
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-16 10:20:38 +03:00
parent 001e80fe96
commit 3398ec49a0
29 changed files with 785 additions and 111 deletions
@@ -0,0 +1,61 @@
# Refactoring Roadmap — `02-baseline-cleanup`
**Date**: 2026-05-16
**Mode**: automatic (quick-assessment, phases 02 only)
**Hardening tracks selected**: E (None) — explicit user choice
## Weak Points Assessment
| Location | Description | Impact | Proposed Solution |
|----------|-------------|--------|-------------------|
| `Entities/` (empty dir at repo root) | Placeholder from pre-rename layout that was never used. Suggests an alternate entity tree that doesn't exist | Documentation drift; misleading to new readers | Remove the directory |
| `DTOs/Requests/` (empty dir at repo root) | Placeholder from pre-rename layout that was never used. Suggests a "Requests" sub-grouping that doesn't exist; actual request DTOs live directly under `DTOs/*.cs` | Documentation drift; misleading to new readers | Remove the directory |
## Gap Analysis
| Acceptance criterion | Current state | Gap | Closed by this run? |
|----------------------|---------------|-----|---------------------|
| All AC and NFR coverage as of `implementation_report_tests.md` (56/56 ACs traced; 48/0/30 test outcome) | Met | None | N/A — already met before this run |
| Architecture Vision § "layer-organized at repo root, ownership by file-path glob" | Mostly met; two placeholder directories carry no owner | Two empty directories don't fit any glob in `module-layout.md` | Yes |
| Architecture-compliance baseline § F1, F2 (High Architecture) | Resolved 2026-05-14 by doc retag | None | N/A — already resolved |
| Architecture-compliance baseline § F3 (Low Maintainability — dead `using`) | Resolved by rename | None | N/A — already resolved |
| Architecture-compliance baseline § F4 (Low Maintainability — empty dirs) | Partial: `Infrastructure/` is now used; `Entities/` and `DTOs/Requests/` remain empty | 2 of 3 dirs still empty | Yes — by C01 |
## Phased Plan
### Phase 1 — Quick Wins (this run, single ticket)
| ID | Item | Constraint Fit | Status |
|----|------|----------------|--------|
| C01 | Remove `Entities/` and `DTOs/Requests/` from the repo | Strengthens Architecture Vision; no AC/restriction touched (verified by full reference scan) | **Selected** |
### Phase 2 — Major Improvements
None for this run. The baseline is small (37 files / 1,306 LOC), all tests green, no coupling/cycles/duplication detected.
### Phase 3 — Enhancements
None for this run. Items recorded as out-of-scope in `list-of-changes.md` ("Out of Scope (Recorded for Visibility)") are tracked for the Phase B feature cycle, not for this refactor pass:
- Add `docker-cli` to e2e-consumer image (would activate the 30 environment-skipped tests).
- Reconcile AC-1.4 carry-forward (NFT-RES-08).
- Reconcile AC-4.6 carry-forward (NFT-RES-02).
## Selected Hardening Tracks
**E — None.** User explicitly chose option E in the Phase 1 + 2b combined gate.
## Applicability Gate
| Item | Constraint fit | Mismatches | Required evidence | Status |
|------|----------------|------------|-------------------|--------|
| C01 | Strengthens Architecture Vision; pure `git rm -r`; zero `.cs` content | None | Reference scan complete (zero matches outside `_docs/`); test suite green pre-change | **Selected** |
All items are `Selected`. No `Rejected`, no `Experimental only`, no `Needs user decision`. The applicability gate passes.
## Tracker Plan
- **Epic**: AZ-XXX — `02-baseline-cleanup` (refactor run for residual baseline F4 cleanup)
- **Task** (1): AZ-XXX — `refactor_remove_empty_scaffolding_dirs` (Task, 1 SP, no dependencies)
Tracker IDs assigned during Phase 2c/2d execution.
@@ -0,0 +1,52 @@
# Research Findings — `02-baseline-cleanup`
**Date**: 2026-05-16
**Mode**: automatic (quick-assessment)
**Scope**: residual baseline-scan F4 partial — two empty scaffolding directories at the repo root
## Project Constraint Matrix
Extracted from `_docs/00_problem/problem.md`, `_docs/02_document/architecture.md` (incl. `## Architecture Vision`), `_docs/02_document/module-layout.md`, and the .NET 10 / Sdk.Web build constraints.
| Constraint | Source | Impact on this run |
|------------|--------|--------------------|
| Source layout is layer-organized at repo root (no `src/`); component ownership is by file-path glob per `module-layout.md` | `architecture.md` § Architecture Vision | Removing two empty directories aligns layout with this principle (no component owns them) |
| `Sdk.Web` recursive `**/*.cs` glob picks up everything not under `bin/`, `obj/`, or `tests/` (the latter excluded by `Compile Remove="tests/**"` in csproj) | `Azaion.Missions.csproj` | Empty directories contribute zero `.cs` files; removal is a pure no-op for the compile graph |
| Test suite must pass after any structural change | `_docs/02_document/tests/environment.md`, autodev existing-code Step 7 gate | Verified pre-change baseline (48 pass / 0 fail / 30 env-skip on 2026-05-15 14:03); will re-run post-change |
| Functional contracts (HTTP, DB schema, JWT) are preserved | `_docs/02_document/architecture.md` § 7, FT-P-* and NFT-SEC-* tests | No contract is touched; pure on-disk cleanup |
## Current State Analysis
The codebase has already converged on its target layout following the May 14 missions/vehicles rename:
- Entities live under `Database/Entities/*.cs` (6 files: Vehicle, Mission, Waypoint, MapObject, Annotation, Detection, Media).
- Request DTOs live directly under `DTOs/*.cs` (Create/Update/Get… per resource).
- Cross-cutting infrastructure lives under `Infrastructure/` (now populated with `ConfigurationResolver.cs` and `CorsConfigurationValidator.cs`).
- Auth, middleware, controllers, services follow established `Auth/`, `Middleware/`, `Controllers/`, `Services/` directories.
**Strengths**: small (37 files / 1,306 LOC / avg 35 LOC per file), no cycles, no cross-component public-API bypass, all tests green, baseline scan was PASS_WITH_WARNINGS.
**Weaknesses (this run's scope only)**: two empty placeholder directories (`Entities/`, `DTOs/Requests/`) survived the rename and now masquerade as alternate trees that don't exist. Misleading for new readers.
## Alternative Approaches Considered
No library / framework / SDK / service replacement is being proposed.
**Per-mode API capability verification (`context7` / MVE) is therefore N/A** — the SKILL.md and Phase 2a both gate that requirement on "replaces (or adds) a library/SDK/framework/service". Pure directory removal does not.
| Option | Pros | Cons | Verdict |
|--------|------|------|---------|
| Remove the directories outright (`git rm -r`) | Simplest; aligns with Architecture Vision; zero risk (no `.cs` content) | None for the actual files | **Selected** |
| Repurpose the directories with `.gitkeep` + a `README.md` explaining intent | Preserves the placeholder for future use | Speculative — no documented intent to use either path; the existing layout works | Rejected — speculative scaffolding violates "don't keep dead code" |
| Move existing `Database/Entities/*` up to `Entities/` and reorganize | Could collapse two trees into one | Touches every entity file, every `using` directive, every test reference; risks the green test suite for cosmetic gain; contradicts the Architecture Vision principle that persistence owns its own subtree | Rejected — out of scope for a quick-assessment cleanup; would weaken constraint fit |
## Constraint-Fit Table
| Recommendation | Pinned mode/config | Constraints checked | API capability evidence (MVE) | Evidence | Mismatches/disqualifiers | Status |
|----------------|--------------------|---------------------|-------------------------------|----------|--------------------------|--------|
| C01 — Delete `Entities/` and `DTOs/Requests/` | N/A (no library; pure `git rm -r`) | Architecture Vision § layer-organized at repo root; csproj Sdk.Web glob; full test suite gate | N/A — no library; no MVE required per SKILL.md gate | `architecture_compliance_baseline.md` F4; `logical_flow_analysis.md` (zero references); `report.csv` 48/0/30 baseline | None | **Selected** |
## References
- `_docs/02_document/architecture_compliance_baseline.md` — F4 source.
- `_docs/04_refactoring/02-baseline-cleanup/discovery/logical_flow_analysis.md` — flow-by-flow impact verification.
- `_docs/02_document/architecture.md` § Architecture Vision — confirmed structural intent.
- `_docs/03_implementation/implementation_report_tests.md` — baseline test outcomes (48 pass / 0 fail / 30 skip).