Ensure v1.7 outputs >=2 Mermaid diagrams

This commit is contained in:
danny 2025-12-27 17:35:33 +00:00
parent d9bff781c5
commit 8e7d8f603d

View file

@ -3124,6 +3124,56 @@ def _generate_dave_v1_7_mirror(*, source_text: str, source_path: str, action_pac
out.append(_render_action_pack(sections[1:]))
out.append("")
# v1.7 requires >=2 Mermaid diagrams; some short sources may not naturally produce enough.
# Add supplemental *inferred* diagrams only when needed, without adding new factual claims.
if locale.lower().startswith("fr"):
mermaid_section_title = "## Annexes (diagrammes inférés)"
mermaid_note = "_Diagrammes inférés : synthèse InfraFabric Red Team (sans nouvelles affirmations factuelles)._"
evidence_label = "Boucle de dérive de preuve (inférée)"
exception_label = "Stase dexception (inférée)"
else:
mermaid_section_title = "## Annex (inferred diagrams)"
mermaid_note = "_Inferred diagrams: InfraFabric Red Team synthesis (no new factual claims)._"
evidence_label = "Evidence drift loop (inferred)"
exception_label = "Exception stasis (inferred)"
current_md = "\n".join(out)
mermaid_count = len(re.findall(r"```mermaid\\b", current_md))
if mermaid_count < 2:
out.extend([mermaid_section_title, "", mermaid_note, ""])
if mermaid_count < 1:
out.extend(
[
f"### {evidence_label}",
"",
"```mermaid",
"flowchart TD",
" A[Control intent] --> B[Manual evidence requested]",
" B --> C[Artifact produced]",
" C --> D[Dashboard goes green]",
" D --> E[Exceptions accumulate]",
" E --> F[Definition of \"compliance\" shifts]",
" F --> B",
"```",
"",
]
)
out.extend(
[
f"### {exception_label}",
"",
"```mermaid",
"stateDiagram-v2",
" [*] --> Requested",
" Requested --> PendingReview: \"needs alignment\"",
" PendingReview --> PendingReview: renewal",
" PendingReview --> Approved: silence",
" Approved --> Approved: \"temporary\" extension",
"```",
"",
]
)
out.extend(
[
"---",