fix: preserve falsey values in world-class HTML

This commit is contained in:
yaojingang
2026-06-14 14:26:13 +08:00
parent 5651053b8b
commit fd5a790df9
4 changed files with 9 additions and 2 deletions
@@ -36,7 +36,7 @@ def write_json(path: Path, payload: dict[str, Any]) -> None:
def html_text(value: Any) -> str:
return html.escape(str(value or ""), quote=True)
return html.escape("" if value is None else str(value), quote=True)
def has_glob_pattern(value: str) -> bool:
@@ -24,7 +24,7 @@ def rel_path(path: Path, root: Path) -> str:
def html_text(value: Any) -> str:
return html.escape(str(value or ""), quote=True)
return html.escape("" if value is None else str(value), quote=True)
def by_key(items: list[dict[str, Any]], key_name: str) -> dict[str, dict[str, Any]]:
@@ -232,6 +232,9 @@ def main() -> None:
assert "provider-holdout" in kit_html, kit_html
assert "Artifact Checklist" in kit_html, kit_html
assert "Source Evidence Snapshot" in kit_html, kit_html
assert "<dt>Field</dt><dd><code>model_executed_count</code></dd>" in kit_html, kit_html
assert "<dt>Current</dt><dd><code>0</code></dd>" in kit_html, kit_html
assert "<dt>Expected</dt><dd><code>&gt;0</code></dd>" in kit_html, kit_html
assert "World-Class Evidence Submission Kit" in kit_html, kit_html
assert "Do not include credentials, raw prompts, raw outputs, transcripts, notes, or private user content." in kit_html, kit_html
@@ -149,11 +149,15 @@ def main() -> None:
assert "World-Class Operator Runbook" in html, html[:400]
assert "ledger and claim guard" in html, html
assert "position:sticky" in html, html
assert "<span>Ready</span><strong>0</strong>" in html, html
assert "<span>Invalid</span><strong>0</strong>" in html, html
assert f"<span>Blocked</span><strong>{summary['source_blocked_count']}</strong>" in html, html
assert "<dt>Blocked</dt><dd><code>2</code></dd>" in html, html
assert "Next Source Actions" in html, html
assert "Source Evidence Snapshot" in html, html
assert "model_executed_count" in html, html
assert "model_executed_count: 0 / &gt;0" in html, html
assert "raw_content_allowed: False / false" in html, html
assert "<script" not in html.lower(), html
assert "http://" not in html and "https://" not in html, html