make: feature-flag dep guards (federation-off, nats, no actix/aws-lc), wired in check+CI

This commit is contained in:
2026-10-26 04:31:24 +01:00
parent 5f2d60cb06
commit 525fb23849
3 changed files with 38 additions and 4 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-http-adapter-deps check-federation-off-social check-sqlite-is-ap-free check-binaries-are-thin check-dockerfile-manifests run: make check-appcontext check-handler-deps check-handler-repos check-http-adapter-deps check-federation-off-social check-sqlite-is-ap-free check-binaries-are-thin check-dockerfile-manifests check-federation-off-deps check-nats-isolated check-no-second-web-stack

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-http-adapter-deps check-federation-off-social check-sqlite-is-ap-free check-binaries-are-thin check-dockerfile-manifests run: make check-appcontext check-handler-deps check-handler-repos check-http-adapter-deps check-federation-off-social check-sqlite-is-ap-free check-binaries-are-thin check-dockerfile-manifests check-federation-off-deps check-nats-isolated check-no-second-web-stack
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-http-adapter-deps check-federation-off-social check-sqlite-is-ap-free check-binaries-are-thin check-dockerfile-manifests 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-sqlite-is-ap-free check-binaries-are-thin check-dockerfile-manifests check-federation-off-deps check-nats-isolated check-no-second-web-stack
@echo "✅ All checks passed" @echo "✅ All checks passed"
check-appcontext: check-appcontext:
@@ -103,6 +103,40 @@ check-dockerfile-manifests:
fi; \ fi; \
echo "✅ Dockerfile copies a manifest for every workspace member" echo "✅ Dockerfile copies a manifest for every workspace member"
CARGO_TREE_NAMES := cargo tree -p server -p worker -e normal --prefix none
check-federation-off-deps:
@hits=$$($(CARGO_TREE_NAMES) --no-default-features | grep -E '^(k-ap|activitypub_federation|activitypub|sqlite-federation) ' | sort -u); \
if [ -n "$$hits" ]; then \
echo "❌ federation-only crates in the --no-default-features server/worker tree:"; \
echo "$$hits"; \
exit 1; \
fi; \
echo "✅ federation-off tree has no k-ap, activitypub_federation, activitypub, or sqlite-federation"
check-nats-isolated:
@if $(CARGO_TREE_NAMES) | grep -qE '^(async-nats|nats) '; then \
echo "❌ nats crates in the default server/worker tree:"; \
$(CARGO_TREE_NAMES) | grep -E '^(async-nats|nats) ' | sort -u; \
exit 1; \
fi; \
if ! $(CARGO_TREE_NAMES) --features nats | grep -qE '^async-nats '; then \
echo "❌ async-nats missing from the --features nats server/worker tree — feature is not wired"; \
exit 1; \
fi; \
echo "✅ async-nats only appears with --features nats"
check-no-second-web-stack:
@for f in "" "--features nats"; do \
hits=$$($(CARGO_TREE_NAMES) $$f | grep -E '^(actix|aws-lc)' | sort -u); \
if [ -n "$$hits" ]; then \
echo "❌ actix/aws-lc crates in the server/worker tree ($${f:-default}):"; \
echo "$$hits"; \
exit 1; \
fi; \
done; \
echo "✅ no actix-* or aws-lc-* in the default or nats server/worker tree"
fmt: fmt:
cargo fmt cargo fmt
@@ -145,4 +179,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-http-adapter-deps check-federation-off-social check-sqlite-is-ap-free check-binaries-are-thin check-dockerfile-manifests .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-sqlite-is-ap-free check-binaries-are-thin check-dockerfile-manifests check-federation-off-deps check-nats-isolated check-no-second-web-stack