Files
Oleksandr Bezdieniezhnykh 510df68bcf [AZ-447] autodev Steps 1-4 baseline: docs, tests, refactor specs
Captures the full output of autodev existing-code Phase A through
Step 4 (Code Testability Revision) for the Azaion UI workspace:

- Step 1 Document: _docs/02_document/ (FINAL_report, architecture,
  glossary, components/, modules/, diagrams/, system-flows,
  module-layout) plus _docs/00_problem/ + _docs/01_solution/ +
  _docs/legacy/ + _docs/how_to_test + README.
- Step 2 Architecture Baseline: architecture_compliance_baseline.md.
- Step 3 Test Spec: _docs/02_document/tests/ (environment,
  test-data, blackbox/performance/resilience/security/
  resource-limit tests, traceability-matrix), enum_spec_snapshot,
  expected_results/results_report.md (98 rows), plus the
  run-tests.sh + run-performance-tests.sh runners.
- Step 4 Code Testability Revision: 01-testability-refactoring/
  run dir (list-of-changes C01-C07, deferred_to_refactor,
  analysis/research_findings + refactoring_roadmap) and the 7
  child task specs AZ-448..AZ-454 under _docs/02_tasks/todo/
  plus _dependencies_table.md.
- _docs/_autodev_state.md pins the cursor at Step 4 / refactor
  Phase 4 entry so /autodev resumes cleanly.

Epic AZ-447 (UI testability gates) tracks the 7 child tasks that
will land in subsequent commits.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 00:38:49 +03:00

2.4 KiB

09 — Settings

1. High-Level Overview

Purpose: User-scoped + system settings: language, theme, system params, directory paths, aircraft default (duplicated with Admin).

Architectural Pattern: Single-page feature, ~181 lines pre-consolidation.

Upstream dependencies: 00_foundation, 01_api-transport, 03_shared-ui.

Downstream consumers: 10_app-shell (routed at /settings).

2. Internal Interfaces

Export Notes
SettingsPage() Top-level route component. Sub-sections: Personal (language, theme), System (params), Directories, Aircraft default.

3. External API Specification

Method Path Purpose
GET / PUT /api/annotations/settings/user Per-user UI preferences
GET / PUT /api/admin/settings/system System params (saveSystem)
GET / PUT /api/admin/settings/directories Storage paths (saveDirs)
GET / PUT /api/admin/settings/aircraft-default Aircraft default (duplicated with Admin)

5. Implementation Details

State Management: Page-local React state per form section.

Findings (B4, copied from state.json):

  1. saveSystem / saveDirs lack try/finally — PUT failure leaves saving:true permanently and the spinner never stops. Step 4.
  2. Numeric inputs use parseInt(v) || 0 — clearing a field silently writes 0. Step 4.
  3. No optimistic concurrency (no version field, no ETag) — Step 6 problem-extraction.
  4. handleToggleDefault duplicated with AdminPage — same global config behind two different pages. Surface intent in Step 6.
  5. Possibly should be guarded by a permission like SETTINGS — spec doesn't have such a code; server-enforces via 403. Less clear-cut than the /admin gap. Surface in Step 6.

Key Dependencies: react-i18next (language switch).

7. Caveats & Edge Cases

  • Stuck-saving spinner on PUT failure (#1).
  • Silent zero on cleared numeric input (#2) — corrupts settings.
  • Aircraft default duplicated with Admin — eventually one page should win.

8. Dependency Graph

Must be implemented after: 00_foundation, 01_api-transport, 03_shared-ui.

Can be implemented in parallel with: every other feature page.

Blocks: 10_app-shell.

Module Inventory

Path Module Doc
src/features/settings/SettingsPage.tsx _docs/02_document/modules/src__features__settings__SettingsPage.md