chore: check-http-adapter-deps guard, README layout

This commit is contained in:
2026-10-25 21:46:03 +01:00
parent 614aec8df9
commit 816d39ffd6
4 changed files with 18 additions and 18 deletions

View File

@@ -47,4 +47,4 @@ jobs:
# Layering guards. These live in the Makefile and were previously local-only, # Layering guards. These live in the Makefile and were previously local-only,
# so a PR could go green in CI while violating them. # so a PR could go green in CI while violating them.
- name: guards - name: guards
run: make check-appcontext check-handler-deps check-handler-repos check-presentation-adapters check-federation-off-social check-binaries-are-thin check-sqlite-is-ap-free run: make check-appcontext check-handler-deps check-handler-repos check-http-adapter-deps check-federation-off-social check-binaries-are-thin check-sqlite-is-ap-free

View File

@@ -47,7 +47,7 @@ jobs:
# Layering guards. These live in the Makefile and were previously local-only, # Layering guards. These live in the Makefile and were previously local-only,
# so a PR could go green in CI while violating them. # so a PR could go green in CI while violating them.
- name: guards - name: guards
run: make check-appcontext check-handler-deps check-handler-repos check-presentation-adapters check-federation-off-social check-binaries-are-thin check-sqlite-is-ap-free run: make check-appcontext check-handler-deps check-handler-repos check-http-adapter-deps check-federation-off-social check-binaries-are-thin check-sqlite-is-ap-free
docker: docker:
name: Build & Push Docker Image name: Build & Push Docker Image

View File

@@ -1,6 +1,6 @@
.DEFAULT_GOAL := check .DEFAULT_GOAL := check
check: fmt-check clippy test test-federation-off check-appcontext check-handler-deps check-handler-repos check-presentation-adapters check-federation-off-social check-binaries-are-thin check-sqlite-is-ap-free check: fmt-check clippy test test-federation-off check-appcontext check-handler-deps check-handler-repos check-http-adapter-deps check-federation-off-social check-binaries-are-thin check-sqlite-is-ap-free
@echo "✅ All checks passed" @echo "✅ All checks passed"
check-appcontext: check-appcontext:
@@ -12,35 +12,35 @@ check-appcontext:
@echo "✅ No AppContext in application crate" @echo "✅ No AppContext in application crate"
check-handler-deps: check-handler-deps:
@if grep -rnE "[A-Za-z0-9_]*Deps(\s*\{|::from\()" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests | grep -q .; then \ @if grep -rnE "[A-Za-z0-9_]*Deps(\s*\{|::from\()" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests --exclude=tests.rs | grep -q .; then \
echo "❌ hand-built deps struct found in presentation:"; \ echo "❌ hand-built deps struct found in http-axum:"; \
grep -rnE "[A-Za-z0-9_]*Deps(\s*\{|::from\()" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests; \ grep -rnE "[A-Za-z0-9_]*Deps(\s*\{|::from\()" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests --exclude=tests.rs; \
exit 1; \ exit 1; \
fi fi
@echo "✅ No hand-built deps structs in presentation" @echo "✅ No hand-built deps structs in http-axum"
check-handler-repos: check-handler-repos:
@if grep -rn "app_ctx\.repos" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests | grep -q .; then \ @if grep -rn "app_ctx\.repos" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests --exclude=tests.rs | grep -q .; then \
echo "❌ app_ctx.repos referenced in presentation:"; \ echo "❌ app_ctx.repos referenced in http-axum:"; \
grep -rn "app_ctx\.repos" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests; \ grep -rn "app_ctx\.repos" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests --exclude=tests.rs; \
exit 1; \ exit 1; \
fi fi
@echo "✅ No app_ctx.repos references in presentation" @echo "✅ No app_ctx.repos references in http-axum"
PRESENTATION_ALLOWED_ADAPTERS := HTTP_ADAPTER_ALLOWED_ADAPTERS :=
check-presentation-adapters: check-http-adapter-deps:
@deps=$$(awk '/^\[dependencies\]/{f=1;next} /^\[/{f=0} f' crates/adapters/http-axum/Cargo.toml \ @deps=$$(awk '/^\[dependencies\]/{f=1;next} /^\[/{f=0} f' crates/adapters/http-axum/Cargo.toml \
| sed -n 's/^\([A-Za-z0-9_-]\{1,\}\)[[:space:]]*=.*/\1/p'); \ | sed -n 's/^\([A-Za-z0-9_-]\{1,\}\)[[:space:]]*=.*/\1/p'); \
bad=""; \ bad=""; \
for a in $$(ls crates/adapters); do \ for a in $$(ls crates/adapters); do \
case " $(PRESENTATION_ALLOWED_ADAPTERS) " in *" $$a "*) continue;; esac; \ case " $(HTTP_ADAPTER_ALLOWED_ADAPTERS) " in *" $$a "*) continue;; esac; \
if echo "$$deps" | grep -qx "$$a"; then bad="$$bad $$a"; fi; \ if echo "$$deps" | grep -qx "$$a"; then bad="$$bad $$a"; fi; \
done; \ done; \
if [ -n "$$bad" ]; then \ if [ -n "$$bad" ]; then \
echo "❌ presentation depends on adapter crate(s):$$bad"; \ echo "❌ http-axum depends on adapter crate(s):$$bad"; \
echo " presentation may name renderers, not reachers — see ADR-0008."; \ echo " http-axum may name renderers, not reachers — see ADR-0008."; \
exit 1; \ exit 1; \
fi; \ fi; \
echo "✅ http-axum depends on no other adapter crate" echo "✅ http-axum depends on no other adapter crate"
@@ -129,4 +129,4 @@ dev-spa:
spa-dev: spa-dev:
@npm --prefix spa run dev @npm --prefix spa run dev
.PHONY: check fmt fmt-check clippy test test-federation-off fix dev dev-stop dev-worker dev-spa spa-dev check-appcontext check-handler-deps check-handler-repos check-presentation-adapters check-federation-off-social check-binaries-are-thin check-sqlite-is-ap-free .PHONY: check fmt fmt-check clippy test test-federation-off fix dev dev-stop dev-worker dev-spa spa-dev check-appcontext check-handler-deps check-handler-repos check-http-adapter-deps check-federation-off-social check-binaries-are-thin check-sqlite-is-ap-free

View File

@@ -95,10 +95,10 @@ config — typed configuration (defaults, config.toml, legacy env n
bootstrap — composition root: the only crate that names adapters; builds the server router and the worker service bootstrap — composition root: the only crate that names adapters; builds the server router and the worker service
domain — pure types and CQRS port traits (MovieCommand/MovieQuery, WatchEventCommand/WatchEventQuery, GoalCommand/GoalQuery, DiaryQuery, PersonCommand/PersonQuery, SearchCommand/SearchPort, SocialCommand/SocialQuery, ImageFetcher, RssFeedRenderer), no external deps except serde domain — pure types and CQRS port traits (MovieCommand/MovieQuery, WatchEventCommand/WatchEventQuery, GoalCommand/GoalQuery, DiaryQuery, PersonCommand/PersonQuery, SearchCommand/SearchPort, SocialCommand/SocialQuery, ImageFetcher, RssFeedRenderer), no external deps except serde
application — use cases (commands + queries), business logic orchestration; handlers delegate here for all domain logic; modules: auth, diary, goals, import, integrations, movies, person, search, social, users, watchlist, wrapup application — use cases (commands + queries), business logic orchestration; handlers delegate here for all domain logic; modules: auth, diary, goals, import, integrations, movies, person, search, social, users, watchlist, wrapup
adapters/http-axum — Axum HTTP router, OpenAPI spec assembly, Swagger UI + Scalar serving; library crate, no binary of its own
server — thin HTTP binary (dotenv, config, bootstrap::build_server, axum::serve); features (federation, nats) forward to bootstrap server — thin HTTP binary (dotenv, config, bootstrap::build_server, axum::serve); features (federation, nats) forward to bootstrap
worker — thin worker binary (bootstrap::build_worker, run until ctrl-c) worker — thin worker binary (bootstrap::build_worker, run until ctrl-c)
adapters/ adapters/
http-axum — Axum HTTP adapter: JSON API, classic HTML UI (askama templates), OpenAPI spec, Swagger UI + Scalar, federation-gated routes; library crate, no binary of its own
auth — JWT issuance and validation (Argon2 passwords) auth — JWT issuance and validation (Argon2 passwords)
sqlite — SQLite repositories, search (FTS5), social graph, durable event queue, connection factory + migrations sqlite — SQLite repositories, search (FTS5), social graph, durable event queue, connection factory + migrations
metadata — TMDB / OMDb HTTP client metadata — TMDB / OMDb HTTP client