refactor: bootstrap crate, thin server/worker binaries
This commit is contained in:
36
Makefile
36
Makefile
@@ -1,6 +1,6 @@
|
||||
.DEFAULT_GOAL := check
|
||||
|
||||
check: fmt-check clippy test check-appcontext check-handler-deps check-handler-repos check-presentation-adapters check-federation-off-social check-sqlite-is-ap-free
|
||||
check: fmt-check clippy test check-appcontext check-handler-deps check-handler-repos check-presentation-adapters check-federation-off-social check-binaries-are-thin check-sqlite-is-ap-free
|
||||
@echo "✅ All checks passed"
|
||||
|
||||
check-appcontext:
|
||||
@@ -47,16 +47,36 @@ check-presentation-adapters:
|
||||
|
||||
|
||||
check-federation-off-social:
|
||||
@if grep -n "NoopSocialCommand\|NoopSocialQuery" crates/server/src/main.rs | grep -q .; then \
|
||||
echo "❌ server wires social noops — federation-off would report an empty follow graph:"; \
|
||||
grep -n "NoopSocialCommand\|NoopSocialQuery" crates/server/src/main.rs; \
|
||||
@if grep -n "NoopSocialCommand\|NoopSocialQuery" crates/bootstrap/src/federation.rs | grep -q .; then \
|
||||
echo "❌ bootstrap wires social noops — federation-off would report an empty follow graph:"; \
|
||||
grep -n "NoopSocialCommand\|NoopSocialQuery" crates/bootstrap/src/federation.rs; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if ! awk '/cfg\(not\(feature = "federation"\)\)/ && !started {started=1} started && /cfg\(feature = "federation"\)/ {exit} started {print}' crates/server/src/main.rs | grep -q "LocalSocialService"; then \
|
||||
echo "❌ LocalSocialService not wired in the federation-off region of crates/server/src/main.rs — federation-off has no social behavior wired at all, not even noops"; \
|
||||
@if ! awk '/cfg\(not\(feature = "federation"\)\)/ && !started {started=1} started && /cfg\(feature = "federation"\)/ {exit} started {print}' crates/bootstrap/src/federation.rs | grep -q "LocalSocialService"; then \
|
||||
echo "❌ LocalSocialService not wired in the federation-off region of crates/bootstrap/src/federation.rs — federation-off has no social behavior wired at all, not even noops"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "✅ server wires real social behavior in every configuration"
|
||||
@echo "✅ bootstrap wires real social behavior in every configuration"
|
||||
|
||||
|
||||
BINARIES_ALLOWED_DEPS := bootstrap config tokio axum anyhow dotenvy tracing
|
||||
|
||||
check-binaries-are-thin:
|
||||
@bad=""; \
|
||||
for c in server worker; do \
|
||||
deps=$$(awk '/^\[dependencies\]/{f=1;next} /^\[/{f=0} f' crates/$$c/Cargo.toml \
|
||||
| sed -n 's/^\([A-Za-z0-9_-]\{1,\}\)[[:space:]]*=.*/\1/p'); \
|
||||
for d in $$deps; do \
|
||||
case " $(BINARIES_ALLOWED_DEPS) " in *" $$d "*) continue;; esac; \
|
||||
bad="$$bad $$c:$$d"; \
|
||||
done; \
|
||||
done; \
|
||||
if [ -n "$$bad" ]; then \
|
||||
echo "❌ binary [dependencies] outside {$(BINARIES_ALLOWED_DEPS)}:$$bad"; \
|
||||
echo " wiring belongs in crates/bootstrap — see ADR-0013."; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo "✅ server and worker depend only on {$(BINARIES_ALLOWED_DEPS)}"
|
||||
|
||||
|
||||
check-sqlite-is-ap-free:
|
||||
@@ -106,4 +126,4 @@ dev-spa:
|
||||
spa-dev:
|
||||
@npm --prefix spa run dev
|
||||
|
||||
.PHONY: check fmt fmt-check clippy test 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-sqlite-is-ap-free
|
||||
.PHONY: check fmt fmt-check clippy test 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
|
||||
|
||||
Reference in New Issue
Block a user