decomposer: fix validation failure for Migrate the kab_ingestion domain models, ports, GitHub SCM connector, and SharePoint CMS connector into the repository's app/ package.; Wire the migrated ingestion components into the agent application entry point, card, settings, triggers, governance, publication, and validation layers.; Populate every remaining placeholder file with working application, package, test, dependency, and Kubernetes content.; Verify the migrated agent and completed repository end to end.
Some checks failed
quality-gates / verify (push) Failing after 7s

This commit is contained in:
2026-09-01 14:40:29 +00:00
parent 0437539ea2
commit b080080e26
29 changed files with 355 additions and 134 deletions

View File

@@ -1 +1 @@
"""Tests for the content ingestion agent."""
"""Test package for the content ingestion agent."""

View File

@@ -1 +1,8 @@
# Env var setup that must run before app.config is imported.
import pytest
from app.kab_ingestion.domain.models import SourceDocument
@pytest.fixture
def document() -> SourceDocument:
return SourceDocument("doc-1", "Guide", "Useful content", "github", metadata={"governance_approved": True})

View File

@@ -1,17 +1,27 @@
from app.connectors.github import GitHubConnector
from app.domain.models import IngestionRequest, SourceRef, Document
from app.kab_ingestion.domain.models import IngestionRequest, SourceDocument
from app.agent import IngestionService
from app.settings import Settings
from app.validation import validate_request, validate_document
from app.governance import authorize
from app.validation import validate_document
def test_github_fetch_and_validation():
connector = GitHubConnector(transport=lambda *args: "hello")
request = IngestionRequest(SourceRef("org/repo", "README.md"))
docs = connector.fetch(request)
assert docs[0].content == "hello"
assert validate_request(request) == []
assert validate_document(docs[0]) == []
def test_governance_rejects_unknown_repo():
doc = Document(SourceRef("other/repo", "a.md"), "x")
assert authorize(doc, Settings(allowed_repositories=("org/repo",)))[0] is False
class FakeSCM:
def __init__(self, document):
self.document = document
def fetch(self, request):
return [self.document]
def test_document_validation(document):
assert validate_document(document).valid
def test_service_validates_without_publishing(document):
service = IngestionService(Settings(publish_enabled=False, require_governance_approval=True), FakeSCM(document))
result = service.ingest(IngestionRequest("github", "owner/repo/contents/guide.md"))
assert result[0].status == "validated"
def test_empty_document_is_rejected():
document = SourceDocument("", "", "", "github")
assert not validate_document(document).valid

9
tests/test_wiring.py Normal file
View File

@@ -0,0 +1,9 @@
from app.agent import create_agent_app
from app.card import AGENT_CARD
def test_application_wiring():
application = create_agent_app()
assert application["card"] == AGENT_CARD
assert {"/health", "/card", "/ingest"} <= set(application["routes"])
assert "github" in application["triggers"]