chore Track Clean Architecture boundary work

Capture the view-model item, mark it in progress, and log iteration 1: the Dependency Rule is enforced by a guard test, and the app-feedback page now crosses the boundary with a DTO. Note the remaining pages to migrate.

Commit
4751de618ace9f42a0ac9e6ab70bd5599853f3d2
Author
Marius Peter <dev@marius-peter.com>
Author date
Committer
Marius Peter <dev@marius-peter.com>
Committer date
RAIL.org
index 0a99f274..b0870e40 100644..100644
@@ -7,6 +7,45 @@
7 7 #+TAGS: [ Impact : minor major ]
8 8 #+TAGS: [ Misc : doctrine ]
9 9
10 Added: * IN-PROGRESS Pass view models across the web boundary, not entities :refactor:web:major:
11 Added: SCHEDULED: [2026-09-09 Wed 14:46]
12 Added: :PROPERTIES:
13 Added: :ID: FB3A953A-201F-42C6-84EE-A7BE54F7BF4B
14 Added: :END:
15 Added: :LOGBOOK:
16 Added: - [2026-09-09 Wed 14:52] Iteration 1. Verified the Dependency Rule holds
17 Added: at the library level and locked it with an executable guard
18 Added: (test_architecture.ml, commit 2810dec): core names no outer
19 Added: module/framework; app names no adapter/framework; persistence and web
20 Added: depend inward; web does not depend on hito.persistence. Started the
21 Added: view-boundary fix: added lib/web/view_model.ml and migrated the
22 Added: app-feedback page end to end (commit fbf006f) — pages.ml no longer
23 Added: names Repository.app_feedback and no timestamp entity reaches the
24 Added: presenter; the controller maps records to the DTO. 243 tests green.
25 Added:
26 Added: Remaining pages still take entities/records across the boundary (pages.mli): choose_routine/home/routine/workout (Prescription.Routine.t, Prescription.Workout.t, Recovery.readiness, Evidence.Workout.t, Repository.routine_id), logbook (Evidence.Feedback.t list, Repository.record list), workout_in_progress/home/etc (Trainee.t everywhere for username). Next: migrate logbook (feedback + record list) and the workout view, then the routine/home pages, then decide whether Trainee.t -> a small {username} DTO is worth the churn. Pattern: DTO in view_model.ml, map in handlers.ml, presenter names only the DTO. Build dir _build-agent; direnv exec . dune ...
27 Added: :END:
28 Added: Goal: structure lib/ to adhere to Clean Architecture
29 Added: (https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html).
30 Added:
31 Added: The four-layer split is already in place and the Dependency Rule holds
32 Added: at the library level: core (entities), app (use cases + Repository and
33 Added: Password_hash ports), persistence (adapters), web (framework/UI). core
34 Added: has no deps; app depends on core+lwt only; persistence and web depend
35 Added: inward; web does not depend on persistence (the adapter is injected by
36 Added: bin/main).
37 Added:
38 Added: Remaining violation (the accepted deviation noted in ARCHITECTURE.org):
39 Added: entities and repository records cross the boundary outward into the
40 Added: presenter. pages.mli takes Evidence.Workout.t, Prescription.Routine.t,
41 Added: Prescription.Workout.t, Recovery.readiness, Evidence.Feedback.t, and
42 Added: Repository.record / Repository.app_feedback directly. The article says
43 Added: data crossing a boundary must be simple structures, never entities or DB
44 Added: rows.
45 Added:
46 Added: Introduce view models (DTOs) at the web boundary and have handlers map
47 Added: entities/records into them before calling pages, so the presenter names
48 Added: no core entity or repository record.
10 49 * DONE Split hito.app into use-case and adapter libs :refactor:app:major:
11 50 CLOSED: [2026-09-09 Wed 12:14] SCHEDULED: [2026-09-09 Wed 11:33]
12 51 :PROPERTIES: