Files
mizan/Makefile
Ryth Azhur 58d2cb2848 AFI parity: generate the matrix from conformance probes, not prose
The per-adapter parity table was hand-maintained prose. An adapter that
never wired a capability (FastAPI SSR, Axum WebSocket) got its gap
relabelled "Django-only" or "out of scope — use native equivalents," and
nothing went red. The de-scope was crystallized in five mutually-ratifying
sites: the README §Stack-extensions table, the AFI fixture docstring
("channels/forms/shapes aren't AFI-common"), the core registry's
extension-hook framing, the mizan-fastapi __init__ docstring, and a
"CSRF is Django-only" comment in two adapters' session endpoints.

Replace prose-parity with conformance-generated parity:

- tests/afi/manifest.py declares the AFI-common surface as data — one list
  of capabilities, one of adapters. Applicability ("—") is derived from
  transport, never typed.
- tests/afi/probes.py independently inspects each backend's source for the
  artifact a capability requires (comment-stripped, backend-scoped). Green
  means wired; a cell can't be set by editing a word.
- tests/afi/test_capability_parity.py asserts every (capability × applicable
  adapter) pair is wired. 35 unwired gaps are now loud red TFDD tests, each
  naming an owed binding. No xfail/skip.
- tests/afi/parity_table.py generates the README table from the probes;
  `make parity-check` fails CI on any hand-edit, like the codegen byte-parity.

Purge the five de-scope sites. The IR byte-parity gate is unchanged and green.
`make test-afi` is now intentionally red on the 35 gaps — that board is the
owed parity work, itemized; a gap turns green by being wired, never described.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 12:58:03 -04:00

79 lines
3.5 KiB
Makefile

.PHONY: install test test-core test-django test-fastapi test-react test-afi parity-table parity-check test-integration docker-up docker-down clean
CORE = cores/mizan-python
DJANGO = backends/mizan-django
FASTAPI = backends/mizan-fastapi
REACT = frontends/mizan-react
AFI = tests/afi
# ─── Setup ───────────────────────────────────────────────────────────────────
install:
cd $(CORE) && uv pip install -e .
cd $(DJANGO) && uv pip install -e ".[dev,channels]"
cd $(FASTAPI) && uv pip install -e ".[dev]"
cd $(REACT) && npm install
# ─── Unit Tests ──────────────────────────────────────────────────────────────
test: test-core test-django test-fastapi test-react test-afi
test-core:
cd $(CORE) && uv run --extra dev pytest
test-django:
cd $(DJANGO) && uv run pytest
test-fastapi:
cd $(FASTAPI) && uv run pytest
test-react:
cd $(REACT) && npm test
# AFI conformance — two gates, substrate-level, not e2e:
# test_codegen_parity.py — Django/FastAPI/Rust emit byte-identical KDL IR.
# test_capability_parity.py — every (capability, applicable adapter) pair is
# probed for its wiring. RED on every unwired gap
# by design: that board is the owed work, itemized.
test-afi:
cd $(AFI) && uv run pytest
# Regenerate the README parity table from the live conformance probes. The table
# is generated output — never hand-edited.
parity-table:
cd $(AFI) && uv run python parity_table.py --write
# CI gate: the committed README parity table matches what the probes report.
# Fails on any hand-edit, the same forcing function as the codegen byte-parity.
parity-check:
cd $(AFI) && uv run python parity_table.py --check
# ─── Integration Tests ──────────────────────────────────────────────────────
test-integration: docker-up
@echo "Waiting for backend..."
@timeout 30 sh -c 'until curl -sf http://localhost:8000/api/mizan/session/ > /dev/null 2>&1; do sleep 1; done'
cd $(REACT) && npm run test:integration
@$(MAKE) docker-down
# ─── Docker ──────────────────────────────────────────────────────────────────
docker-up:
docker compose -f examples/django-react-site/docker-compose.test.yml up -d --build
@echo "Backend starting at http://localhost:8000"
docker-down:
docker compose -f examples/django-react-site/docker-compose.test.yml down
# ─── All ─────────────────────────────────────────────────────────────────────
test-all: test test-integration
# ─── Cleanup ─────────────────────────────────────────────────────────────────
clean:
docker compose -f examples/django-react-site/docker-compose.test.yml down -v --remove-orphans 2>/dev/null || true
rm -rf $(DJANGO)/src/mizan.egg-info $(DJANGO)/dist $(DJANGO)/build
rm -rf $(REACT)/dist $(REACT)/node_modules
rm -f examples/django-react-site/backend/db.sqlite3