From 816d39ffd6f4fe8cf07c0acf2d21244daeb25f99 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Sun, 25 Oct 2026 21:46:03 +0100 Subject: [PATCH] chore: check-http-adapter-deps guard, README layout --- .gitea/workflows/ci.yml | 2 +- .github/workflows/ci.yml | 2 +- Makefile | 30 +++++++++++++++--------------- README.md | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index a8a1c209..7cb9e078 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -47,4 +47,4 @@ jobs: # Layering guards. These live in the Makefile and were previously local-only, # so a PR could go green in CI while violating them. - 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0a39ecd..00020619 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: # Layering guards. These live in the Makefile and were previously local-only, # so a PR could go green in CI while violating them. - 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: name: Build & Push Docker Image diff --git a/Makefile b/Makefile index ba3f5966..7de7a00d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .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" check-appcontext: @@ -12,35 +12,35 @@ check-appcontext: @echo "✅ No AppContext in application crate" 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 \ - echo "❌ hand-built deps struct found in presentation:"; \ - grep -rnE "[A-Za-z0-9_]*Deps(\s*\{|::from\()" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests; \ + @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 http-axum:"; \ + grep -rnE "[A-Za-z0-9_]*Deps(\s*\{|::from\()" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests --exclude=tests.rs; \ exit 1; \ fi - @echo "✅ No hand-built deps structs in presentation" + @echo "✅ No hand-built deps structs in http-axum" check-handler-repos: - @if grep -rn "app_ctx\.repos" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests | grep -q .; then \ - echo "❌ app_ctx.repos referenced in presentation:"; \ - grep -rn "app_ctx\.repos" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests; \ + @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 http-axum:"; \ + grep -rn "app_ctx\.repos" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests --exclude=tests.rs; \ exit 1; \ 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 \ | sed -n 's/^\([A-Za-z0-9_-]\{1,\}\)[[:space:]]*=.*/\1/p'); \ bad=""; \ 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; \ done; \ if [ -n "$$bad" ]; then \ - echo "❌ presentation depends on adapter crate(s):$$bad"; \ - echo " presentation may name renderers, not reachers — see ADR-0008."; \ + echo "❌ http-axum depends on adapter crate(s):$$bad"; \ + echo " http-axum may name renderers, not reachers — see ADR-0008."; \ exit 1; \ fi; \ echo "✅ http-axum depends on no other adapter crate" @@ -129,4 +129,4 @@ dev-spa: spa-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 diff --git a/README.md b/README.md index bc3bf316..8de059c6 100644 --- a/README.md +++ b/README.md @@ -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 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 -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 worker — thin worker binary (bootstrap::build_worker, run until ctrl-c) 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) sqlite — SQLite repositories, search (FTS5), social graph, durable event queue, connection factory + migrations metadata — TMDB / OMDb HTTP client