Publish curated Unraid-AppOps-Gateway source from 6d175c3333218e2b580a310496fed6c407f28114

This commit is contained in:
Public Source Publisher committed 2026-10-09 12:15:31 +00:00
1 parent 58f5e3c8c2
commit 41fd48f0bc
7 files changed
+339 -16

No files matched your search

@@ -1369,3 +1369,44 @@ def test_controller_preflight_changed_identity_expires_approval_without_unknown_
promotion = session.get(WorkMeshPromotion, promotion_id)
assert approval is not None and approval.status == "expired"
assert promotion is not None and promotion.status == "preflight_changed"
@pytest.mark.parametrize(("name", "argument", "discriminator"), [
("enrollment.preflight", "plan", None),
("target.enroll", "plan", None),
("deployment.preflight", "plan", None),
("deployment.apply", "plan", None),
("deployment.rollback", "plan", None),
("deployment.preflight", "plan", "itworx.forge-bootstrap-preflight/v1"),
("forge.bootstrap.apply", "profile", None),
])
def test_mcp_typed_schema_rejection_never_echoes_opaque_input(
integration_client, monkeypatch, name, argument, discriminator,
):
from backend.app import mcp_server
canary = "syntheticOpaqueInput_9Z7XQ"
payload = {"api_key": canary, canary: {"nested": canary}, "application_id": canary}
if discriminator:
payload["api_version"] = discriminator
arguments = {argument: payload}
if name != "enrollment.preflight":
arguments["idempotencyKey"] = "schema-redaction-fixture"
def forbidden_service(*_args, **_kwargs):
pytest.fail("invalid schema must not reach deployment/enrollment services")
monkeypatch.setattr(mcp_server, "EnrollmentPlane", forbidden_service)
monkeypatch.setattr(mcp_server, "DeploymentControlPlane", forbidden_service)
async def exercise():
async with Client(mcp_server.appops_mcp) as client:
result = await client.call_tool(name, arguments)
assert result.is_error is False
assert result.structured_content == {
"status": "invalid", "executed": False, "reason": "invalid_typed_plan",
}
assert canary not in json.dumps(result.model_dump(mode="json"))
asyncio.run(exercise())
assert mcp_server._MCP_EXECUTION_LOCK.locked() is False