Split application orchestration by responsibility

This commit is contained in:
ms2k 2026-07-19 18:22:33 +09:00
commit 37a7a55bfe
2 changed files with 1545 additions and 1265 deletions

37
tests/application-boundaries.sh Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
for module in \
src/Nuthatch/Http/Server.hs \
src/Nuthatch/Http/Auth.hs \
src/Nuthatch/Browse.hs \
src/Nuthatch/Transfer.hs \
src/Nuthatch/Mutation/Service.hs \
src/Nuthatch/Mutation/Recovery.hs \
src/Nuthatch/Mutation/Effects.hs; do
test -f "$module"
done
test "$(wc -l <src/Nuthatch/App.hs)" -le 40
if grep -Eq 'Servant|Nuthatch\.Http' \
src/Nuthatch/Mutation/Service.hs \
src/Nuthatch/Mutation/Recovery.hs \
src/Nuthatch/Mutation/Effects.hs; then
printf '%s\n' "Mutation protocol services depend on HTTP" >&2
exit 1
fi
grep -F 'Nuthatch.Mutation.Service' src/Nuthatch/Transfer.hs >/dev/null
grep -F 'Nuthatch.Mutation.Service' src/Nuthatch/Http/Server.hs >/dev/null
grep -F 'Nuthatch.Mutation.Service' src/Nuthatch/Mutation/Recovery.hs >/dev/null
if grep -Eq 'recoverOnce|recoverOne|finalizeRecovered|observeObjectWithRetry' \
src/Nuthatch/App.hs src/Nuthatch/Http/*.hs; then
printf '%s\n' "Recovery implementation leaked into HTTP composition" >&2
exit 1
fi
printf '%s\n' "Application responsibility boundaries passed"

View file

@ -18,7 +18,7 @@ for heading in \
done
for ownership in \
'| HTTP | `src/Nuthatch/Api.hs`, `src/Nuthatch/App.hs` | `make check-product` |' \
'| HTTP | `src/Nuthatch/Api.hs`, `src/Nuthatch/App.hs`, `src/Nuthatch/Http/Server.hs`, `src/Nuthatch/Http/Auth.hs`, `src/Nuthatch/Http/Error.hs`, `src/Nuthatch/Browse.hs`, `src/Nuthatch/Transfer.hs` | `make check-product` |' \
'| SQL | `sql/`, `src/Nuthatch/Db.hs`, `src/Nuthatch/Protocol.hs` | `make check-storage-foundation` |' \
'| Identity encoding | `src/Nuthatch/Paths.hs` | `make test` |' \
'| Content identity | `src/Nuthatch/Streaming.hs`, `src/Nuthatch/S3.hs` | `make check-streaming` |' \
@ -31,12 +31,17 @@ done
for path in \
src/Nuthatch/Api.hs \
src/Nuthatch/App.hs \
src/Nuthatch/Browse.hs \
src/Nuthatch/Config.hs \
src/Nuthatch/Db.hs \
src/Nuthatch/Http/Auth.hs \
src/Nuthatch/Http/Error.hs \
src/Nuthatch/Http/Server.hs \
src/Nuthatch/Paths.hs \
src/Nuthatch/Protocol.hs \
src/Nuthatch/S3.hs \
src/Nuthatch/Streaming.hs \
src/Nuthatch/Transfer.hs \
sql/001_initial_schema.sql \
deploy/kubernetes/nuthatch.yaml.in \
tests/kind/lib.sh \