test: Add 126 tests for Phase 5 plugins + fix 2 source bugs
Check Cross-Plugin Imports / check (push) Has been cancelled

Tests (5 files, 126 tests, all passing):
- test_agent_memory.py: 22 tests (store, retrieve, delete, routes, tenant isolation)
- test_graph_rag.py: 22 tests (create, traverse BFS, bidirectional, max_hops, cycles, routes)
- test_marketplace.py: 26 tests (fetch, download, verify, install, categories, routes)
- test_agent_subtasks.py: 25 tests (create, wait, cancel, aggregate, list, model)
- test_external_agent_api.py: 31 tests (run, status, stream, auth, rate limit)

Bugfixes:
- graph_rag/models.py: metadata -> meta (SQLAlchemy reserved attribute)
- marketplace/routes.py: fix default parameter validation
This commit is contained in:
Agent Zero
2026-08-04 16:02:36 +02:00
parent 25a97356d8
commit 7d976276ae
10 changed files with 3945 additions and 144 deletions
+2 -2
View File
@@ -47,6 +47,6 @@ class EntityRelationship(Base, TenantMixin, OwnedMixin):
relationship_type: Mapped[str] = mapped_column(
String(50), nullable=False, comment="Type of relationship (e.g. 'works_for', 'has_email', 'related_to')"
)
metadata: Mapped[dict[str, Any] | None] = mapped_column(
JSONB, nullable=True, default=dict, comment="Arbitrary metadata about the relationship"
meta: Mapped[dict[str, Any] | None] = mapped_column(
"metadata", JSONB, nullable=True, default=dict, comment="Arbitrary metadata about the relationship"
)
+4 -4
View File
@@ -40,7 +40,7 @@ class GraphRAGSearchProvider(BaseSearchProvider):
coalesce(r.relationship_type, '') || ' ' ||
coalesce(r.source_type, '') || ' ' ||
coalesce(r.target_type, '') || ' ' ||
coalesce(r.metadata::text, '')
coalesce(r.meta::text, '')
),
to_tsquery('pg_catalog.german', :q)
) AS rank
@@ -51,7 +51,7 @@ class GraphRAGSearchProvider(BaseSearchProvider):
coalesce(r.relationship_type, '') || ' ' ||
coalesce(r.source_type, '') || ' ' ||
coalesce(r.target_type, '') || ' ' ||
coalesce(r.metadata::text, '')
coalesce(r.meta::text, '')
) @@ to_tsquery('pg_catalog.german', :q)
AND r.id = ANY(:visible_ids)
ORDER BY rank DESC
@@ -75,7 +75,7 @@ class GraphRAGSearchProvider(BaseSearchProvider):
coalesce(r.relationship_type, '') || ' ' ||
coalesce(r.source_type, '') || ' ' ||
coalesce(r.target_type, '') || ' ' ||
coalesce(r.metadata::text, '')
coalesce(r.meta::text, '')
),
to_tsquery('pg_catalog.german', :q)
) AS rank
@@ -86,7 +86,7 @@ class GraphRAGSearchProvider(BaseSearchProvider):
coalesce(r.relationship_type, '') || ' ' ||
coalesce(r.source_type, '') || ' ' ||
coalesce(r.target_type, '') || ' ' ||
coalesce(r.metadata::text, '')
coalesce(r.meta::text, '')
) @@ to_tsquery('pg_catalog.german', :q)
ORDER BY rank DESC
LIMIT :lim
+1 -1
View File
@@ -108,7 +108,7 @@ async def list_relationships(
"target_type": r.target_type,
"target_id": str(r.target_id),
"relationship_type": r.relationship_type,
"metadata": r.metadata,
"metadata": r.meta,
"owner_id": str(r.owner_id) if r.owner_id else None,
"created_at": r.created_at.isoformat() if r.created_at else None,
}
+4 -4
View File
@@ -61,7 +61,7 @@ async def create_relationship(
target_type=target_type,
target_id=target_id,
relationship_type=relationship_type,
metadata=metadata or {},
meta=metadata or {},
owner_id=owner_id,
)
db.add(rel)
@@ -75,7 +75,7 @@ async def create_relationship(
"target_type": rel.target_type,
"target_id": str(rel.target_id),
"relationship_type": rel.relationship_type,
"metadata": rel.metadata,
"metadata": rel.meta,
"owner_id": str(rel.owner_id) if rel.owner_id else None,
"created_at": rel.created_at.isoformat() if rel.created_at else None,
}
@@ -150,7 +150,7 @@ async def traverse_graph(
"target_type": rel.target_type,
"target_id": str(rel.target_id),
"relationship_type": rel.relationship_type,
"metadata": rel.metadata,
"metadata": rel.meta,
})
if target_key not in visited:
@@ -186,7 +186,7 @@ async def traverse_graph(
"target_type": rel.target_type,
"target_id": str(rel.target_id),
"relationship_type": rel.relationship_type,
"metadata": rel.metadata,
"metadata": rel.meta,
})
if source_key not in visited:
+2 -2
View File
@@ -96,7 +96,7 @@ async def get_marketplace_listing(
@router.post("/install/{name}", response_model=MarketplaceInstallResponse)
async def install_from_marketplace(
name: str,
body: MarketplaceInstallRequest = MarketplaceInstallRequest(name=""),
body: MarketplaceInstallRequest = MarketplaceInstallRequest.model_construct(name=""),
db: AsyncSession = Depends(get_db),
current_user: dict = Depends(require_admin),
):
@@ -138,7 +138,7 @@ async def install_from_marketplace(
@router.post("/verify/{name}", response_model=MarketplaceVerifyResponse)
async def verify_plugin_signature(
name: str,
body: MarketplaceInstallRequest = MarketplaceInstallRequest(name=""),
body: MarketplaceInstallRequest = MarketplaceInstallRequest.model_construct(name=""),
db: AsyncSession = Depends(get_db),
current_user: dict = Depends(require_permission("marketplace:read")),
):