Split application orchestration by responsibility

This commit is contained in:
ms2k 2026-07-19 18:22:33 +09:00
commit 37a7a55bfe

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"