feat: add repository mesh reconciliation round
This commit is contained in:
@@ -28,6 +28,16 @@ from .governance_exports import governance_exports, write_central_lifecycle_expo
|
||||
from .governance_scenarios import build_scenario_portfolio
|
||||
from .governance_storage import write_governance_semantic_state
|
||||
from .human_rulebook import evaluate_rulebook, rulebook_compact_json, rulebook_csv, rulebook_markdown
|
||||
from .mcp_contract import (
|
||||
build_mcp_contract_report,
|
||||
mcp_contract_csv,
|
||||
mcp_contract_markdown,
|
||||
mcp_provider_compact_json,
|
||||
mcp_provider_payload,
|
||||
official_report_models_markdown,
|
||||
same_source_validation_payload,
|
||||
ui_renderer_policy_markdown,
|
||||
)
|
||||
from .human_readiness_registry import build_readiness_registry
|
||||
from .matrix import build_global_recommendations, build_matrix, build_platform_reports, matrix_table
|
||||
from .models import EcosystemHumanReport, GeneratedFile, PlatformHumanReport, ReportBundle, as_plain_data
|
||||
@@ -47,6 +57,19 @@ from .portfolio_queries import build_operational_questions
|
||||
from .quality import evaluate_ecosystem_quality, quality_to_markdown
|
||||
from .questions import questions_for_ecosystem, questions_markdown
|
||||
from .redaction import redaction_markdown, scan_generated_artifacts
|
||||
from .repository_mesh import run_repository_mesh
|
||||
from .repository_mesh_reconciliation import apply_reconciliation_to_report
|
||||
from .repository_mesh_runtime import (
|
||||
acquire_lock,
|
||||
build_runtime_cycle,
|
||||
cron_scheduler_spec,
|
||||
release_lock,
|
||||
windows_scheduler_spec,
|
||||
write_runtime_artifacts,
|
||||
)
|
||||
from .repository_mesh_semantic import semantic_generated_records, write_repository_mesh_semantic_state
|
||||
from .repository_mesh_readiness import build_mesh_readiness_report, write_readiness_artifacts
|
||||
from .repository_mesh_gitea import build_gitea_mesh_plan, write_gitea_plan_artifacts
|
||||
from .round_assurance import assurance_markdown, assurance_rows, build_assurance_suite
|
||||
from .runtime_budget import build_round_line_budget
|
||||
from .scanner import scan_ecosystem
|
||||
@@ -257,6 +280,74 @@ def generate(
|
||||
governance_questions = build_operational_questions(governance_portfolio)
|
||||
line_budget = build_round_line_budget(ecosystem_root, project_root)
|
||||
rulebook_report = evaluate_rulebook(platform_reports)
|
||||
mcp_contract_report = build_mcp_contract_report(rulebook_report)
|
||||
mesh_report, mesh_records = run_repository_mesh(
|
||||
ecosystem_root=ecosystem_root,
|
||||
project_root=project_root,
|
||||
central_platform_folder=central_platform_folder,
|
||||
fetch=False,
|
||||
plugin_auth_attempt=push_status or "",
|
||||
)
|
||||
mesh_plan, mesh_reconciliation_records = apply_reconciliation_to_report(
|
||||
mesh_report,
|
||||
project_root,
|
||||
central_platform_folder=central_platform_folder,
|
||||
)
|
||||
mesh_lock = acquire_lock(project_root / "dados" / "repository-mesh.lock.json", owner="mais_humana.generate")
|
||||
mesh_cycle = build_runtime_cycle(mesh_report, mesh_plan, lock=mesh_lock, execute=False)
|
||||
mesh_scheduler_specs = (
|
||||
windows_scheduler_spec(
|
||||
python_exe="C:\\Users\\Ami\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe",
|
||||
project_root=project_root,
|
||||
ecosystem_root=ecosystem_root,
|
||||
central_platform_folder=central_platform_folder,
|
||||
),
|
||||
cron_scheduler_spec(
|
||||
python_exe="python",
|
||||
project_root=project_root,
|
||||
ecosystem_root=ecosystem_root,
|
||||
central_platform_folder=central_platform_folder,
|
||||
),
|
||||
)
|
||||
mesh_runtime_records = write_runtime_artifacts(
|
||||
mesh_cycle,
|
||||
mesh_scheduler_specs,
|
||||
project_root,
|
||||
central_platform_folder=central_platform_folder,
|
||||
)
|
||||
mesh_semantic_records = ()
|
||||
if central_platform_folder is not None:
|
||||
mesh_semantic_counts = write_repository_mesh_semantic_state(
|
||||
central_platform_folder / "controle-semantico.sqlite",
|
||||
report=mesh_report,
|
||||
plan=mesh_plan,
|
||||
cycle=mesh_cycle,
|
||||
schedulers=mesh_scheduler_specs,
|
||||
)
|
||||
mesh_semantic_records = semantic_generated_records(central_platform_folder / "controle-semantico.sqlite")
|
||||
else:
|
||||
from .repository_mesh_semantic import table_counts
|
||||
|
||||
mesh_semantic_counts = table_counts(project_root / "controle-semantico.sqlite")
|
||||
mesh_readiness = build_mesh_readiness_report(
|
||||
mesh_report,
|
||||
mesh_plan,
|
||||
mesh_cycle,
|
||||
mesh_scheduler_specs,
|
||||
mesh_semantic_counts,
|
||||
)
|
||||
mesh_readiness_records = write_readiness_artifacts(
|
||||
mesh_readiness,
|
||||
project_root,
|
||||
central_platform_folder=central_platform_folder,
|
||||
)
|
||||
mesh_gitea_plan = build_gitea_mesh_plan(mesh_report)
|
||||
mesh_gitea_records = write_gitea_plan_artifacts(
|
||||
mesh_gitea_plan,
|
||||
project_root,
|
||||
central_platform_folder=central_platform_folder,
|
||||
)
|
||||
release_lock(mesh_lock)
|
||||
lifecycle_package = (
|
||||
build_round_execution_package(
|
||||
central_platform_folder,
|
||||
@@ -273,7 +364,14 @@ def generate(
|
||||
readiness_registry,
|
||||
workflow_portfolio,
|
||||
compiled_orders=governance_orders,
|
||||
mcp_contract_report=mcp_contract_report,
|
||||
)
|
||||
generated.extend(mesh_records)
|
||||
generated.extend(mesh_reconciliation_records)
|
||||
generated.extend(mesh_runtime_records)
|
||||
generated.extend(mesh_semantic_records)
|
||||
generated.extend(mesh_readiness_records)
|
||||
generated.extend(mesh_gitea_records)
|
||||
|
||||
profile_catalog = write_profile_catalog(project_root)
|
||||
generated.append(generated_file(profile_catalog, project_root, "Catalogo de perfis humanos considerado pela matriz.", "catalogo de perfis", "json", relation_to_order))
|
||||
@@ -389,6 +487,26 @@ def generate(
|
||||
rulebook_matrix = project_root / "matrizes" / "rulebook-humano-operacional.csv"
|
||||
rulebook_matrix.write_text(rulebook_csv(rulebook_report), encoding="utf-8")
|
||||
generated.append(generated_file(rulebook_matrix, project_root, "Matriz CSV de cobertura do rulebook.", "matriz rulebook", "csv", relation_to_order))
|
||||
mcp_contract_json = write_json(project_root / "dados" / "mcp-contratos-humanos.json", mcp_contract_report)
|
||||
generated.append(generated_file(mcp_contract_json, project_root, "Relatorio completo de contratos MCP humanos.", "mcp contratos", "json", relation_to_order))
|
||||
mcp_provider_json = write_json(project_root / "dados" / "mcp-provider-mais-humana.json", mcp_provider_payload(mcp_contract_report))
|
||||
generated.append(generated_file(mcp_provider_json, project_root, "Envelope MCP minimo da Mais Humana.", "mcp provider", "json", relation_to_order))
|
||||
mcp_provider_compact = write_json(project_root / "dados" / "mcp-provider-mais-humana-compacto.json", mcp_provider_compact_json(mcp_contract_report))
|
||||
generated.append(generated_file(mcp_provider_compact, project_root, "Contrato MCP compacto da Mais Humana.", "mcp provider compacto", "json", relation_to_order))
|
||||
mcp_same_source = write_json(project_root / "dados" / "mcp-admin-ui-same-source-validation.json", same_source_validation_payload(mcp_contract_report))
|
||||
generated.append(generated_file(mcp_same_source, project_root, "Validacao same-source GPT/UI baseada no contrato MCP.", "mcp same-source", "json", relation_to_order))
|
||||
mcp_contract_md = project_root / "ecossistema" / "MCP-PROVIDER-MAIS-HUMANA.md"
|
||||
mcp_contract_md.write_text(mcp_contract_markdown(mcp_contract_report), encoding="utf-8")
|
||||
generated.append(generated_file(mcp_contract_md, project_root, "Relatorio Markdown do provider MCP Mais Humana.", "mcp provider", "markdown", relation_to_order))
|
||||
report_models_md = project_root / "ecossistema" / "MODELOS-OFICIAIS-RELATORIO-HUMANO.md"
|
||||
report_models_md.write_text(official_report_models_markdown(mcp_contract_report), encoding="utf-8")
|
||||
generated.append(generated_file(report_models_md, project_root, "Catalogo de modelos oficiais de relatorio humano.", "modelos relatorio", "markdown", relation_to_order))
|
||||
ui_policy_md = project_root / "ecossistema" / "UI-RENDERER-SAME-SOURCE-POLICY.md"
|
||||
ui_policy_md.write_text(ui_renderer_policy_markdown(mcp_contract_report), encoding="utf-8")
|
||||
generated.append(generated_file(ui_policy_md, project_root, "Politica UI como renderizador sem fonte paralela.", "politica ui", "markdown", relation_to_order))
|
||||
mcp_contract_csv_path = project_root / "matrizes" / "mcp-contratos-humanos.csv"
|
||||
mcp_contract_csv_path.write_text(mcp_contract_csv(mcp_contract_report), encoding="utf-8")
|
||||
generated.append(generated_file(mcp_contract_csv_path, project_root, "Matriz CSV dos contratos MCP humanos.", "matriz mcp", "csv", relation_to_order))
|
||||
governance_snapshot_path = project_root / "dados" / "snapshot-governanca-atual.json"
|
||||
previous_governance_snapshot = load_governance_snapshot(governance_snapshot_path)
|
||||
current_governance_snapshot = snapshot_from_portfolio(governance_portfolio)
|
||||
@@ -528,6 +646,7 @@ def generate(
|
||||
assurance=assurance,
|
||||
lifecycle=lifecycle_package,
|
||||
budget=line_budget,
|
||||
mcp_contract_report=mcp_contract_report,
|
||||
)
|
||||
final_bundle = ReportBundle(
|
||||
output_root=str(project_root),
|
||||
|
||||
Reference in New Issue
Block a user