Files
Kill_LIFE/test/test_yiacad_web_review_contract.py
Clément SAILLANT 5efb380da5 feat: automate yiacad PR review lane (#18)
* feat: automate yiacad pr review lane

* fix: stabilize yiacad review and spec gates

* fix: scope kicad exports to repo hardware

* fix: ignore kicad block library sources in exports

* feat: Add infra VPS monitoring runbook and healthcheck scripts

- Created INFRA_VPS_RUNBOOK_2026.md detailing operational procedures for monitoring VPS services.
- Added infra_vps_healthcheck.sh script for automated health checks on DNS, TLS, TCP, and HTTP for VPS services.
- Introduced infra_vps_security_audit.sh for non-intrusive security checks on external VPS services.
- Established JSON schema for infra VPS inventory in infra_vps.schema.json.
- Developed integration for runtime status reporting in the Next.js API route.
- Implemented Playwright tests for smoke testing the application and ensuring core functionalities.
- Updated Makefile for development dependencies and testing commands.
- Created various test files for unit and end-to-end testing across different components.

* feat(agentics): update mesh agents, gates, prompts, and workflows
2026-03-29 17:14:16 +02:00

108 lines
3.8 KiB
Python

#!/usr/bin/env python3
from __future__ import annotations
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
GRAPHQL_SCHEMA = REPO_ROOT / "web" / "lib" / "graphql" / "schema.ts"
GRAPHQL_CLIENT = REPO_ROOT / "web" / "lib" / "graphql" / "client.ts"
WEB_TYPES = REPO_ROOT / "web" / "lib" / "types.ts"
WORKER = REPO_ROOT / "web" / "workers" / "eda-worker.mjs"
PROJECT_STORE = REPO_ROOT / "web" / "lib" / "project-store.ts"
class YiacadWebReviewContractTests(unittest.TestCase):
def test_ci_run_shape_is_exposed_consistently(self) -> None:
schema = GRAPHQL_SCHEMA.read_text(encoding="utf-8")
client = GRAPHQL_CLIENT.read_text(encoding="utf-8")
types = WEB_TYPES.read_text(encoding="utf-8")
for expected in (
"engine: String!",
"summary: String!",
"degradedReasons: [String!]!",
"artifactCount: Int!",
"startedAt: String",
"completedAt: String",
):
self.assertIn(expected, schema)
for expected in (
"engine",
"summary",
"degradedReasons",
"artifactCount",
"startedAt",
"completedAt",
):
self.assertIn(expected, client)
self.assertIn(expected, types)
def test_review_contract_exposes_github_checks_and_evidence_packs(self) -> None:
schema = GRAPHQL_SCHEMA.read_text(encoding="utf-8")
client = GRAPHQL_CLIENT.read_text(encoding="utf-8")
types = WEB_TYPES.read_text(encoding="utf-8")
for expected in (
"type GitHubCheck",
"type EvidencePack",
"githubChecks: [GitHubCheck!]!",
"evidencePacks: [EvidencePack!]!",
"checkSummary: String!",
"changeScope: String!",
"riskLevel: String!",
"mergeRecommendation: String!",
"checkIds: [String!]!",
"evidencePackIds: [String!]!",
):
self.assertIn(expected, schema)
for expected in (
"githubChecks",
"evidencePacks",
"checkSummary",
"changeScope",
"riskLevel",
"mergeRecommendation",
"checkIds",
"evidencePackIds",
"detailsUrl",
"artifactUrl",
):
self.assertIn(expected, client)
self.assertIn(expected, types)
self.assertIn("publishPullRequestSummary", schema)
self.assertIn("PUBLISH_PULL_REQUEST_SUMMARY_MUTATION", client)
def test_worker_persists_review_ready_ci_metadata(self) -> None:
content = WORKER.read_text(encoding="utf-8")
self.assertIn("degradedReasons", content)
self.assertIn("artifactCount", content)
self.assertIn("startedAt", content)
self.assertIn("completedAt", content)
self.assertIn("summary:", content)
def test_project_store_resolves_github_checks_and_evidence_packs(self) -> None:
content = PROJECT_STORE.read_text(encoding="utf-8")
self.assertIn("/commits/${headSha}/check-runs", content)
self.assertIn("/actions/runs?", content)
self.assertIn("/actions/runs/${runId}/artifacts", content)
self.assertIn("yiacad-evidence-pack", content)
self.assertIn("Evidence Pack Validation", content)
self.assertIn("/issues/${pullRequestId}/comments", content)
self.assertIn("yiacad-pr-summary", content)
def test_review_shell_offers_pr_summary_publish_action(self) -> None:
review_shell = (REPO_ROOT / "web" / "components" / "pr-review-shell.tsx").read_text(
encoding="utf-8"
)
self.assertIn("Publish YiACAD summary", review_shell)
self.assertIn("publishPullRequestSummary", review_shell)
if __name__ == "__main__":
unittest.main()