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
Some checks failed
quality-gates / verify (push) Failing after 7s
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user