The @client(merge=[context, ...]) decorator lets a mutation patch its
return value directly into the cached context bundle by matching the
mutation's Output type against each context-function's Output type
to identify the slot, then splicing server-side. Kernel runs
splice_slot on the response to apply locally — no refetch, no
invalidate-cascade.
Lands H14, H15, H16, M19, M20 from ISSUES.md.
Backends (Django + FastAPI):
_resolve_merges() in both executors walks @client(merge=...) targets,
resolves the per-context slot via types_match_for_merge, and emits
{context, slot, value, params?} entries on the response. Param
auto-scoping mirrors _resolve_invalidation's tier-1 logic.
Frontend kernel (mizan-base):
Response handler reads the merge[] array and applies splice_slot
for each entry — locates the cached context bundle by name+params,
overwrites the named slot with the new value, notifies subscribers.
Core (mizan-python):
@client decorator extended with merge= parameter. Schema export
threads merge metadata onto the OpenAPI x-mizan-functions entries.
Examples / fixtures:
fastapi-react-site harness exercises merge + Playwright spec covers
the end-to-end happy path (mutation → instant UI update without
network refetch). AFI fixture's rename_user function is the
canonical merge target.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
733 B
TOML
28 lines
733 B
TOML
[project]
|
|
name = "mizan-afi-tests"
|
|
version = "0.0.0"
|
|
description = "AFI conformance tests — verifies mizan-django and mizan-fastapi emit equivalent schemas for the same registered functions."
|
|
requires-python = ">=3.10"
|
|
dependencies = [
|
|
"mizan-core",
|
|
"mizan",
|
|
"mizan-fastapi",
|
|
"pytest>=8.0",
|
|
]
|
|
|
|
[tool.uv.sources]
|
|
mizan-core = { path = "../../cores/mizan-python", editable = true }
|
|
mizan = { path = "../../backends/mizan-django", editable = true }
|
|
mizan-fastapi = { path = "../../backends/mizan-fastapi", editable = true }
|
|
|
|
[tool.pytest.ini_options]
|
|
pythonpath = ["."]
|
|
testpaths = ["."]
|
|
python_classes = ["*Tests", "*Test", "Test*"]
|
|
python_functions = ["test_*"]
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"uvicorn>=0.47.0",
|
|
]
|