fix(report): bind v2 chart cap to CHART_IDS.length
Five-theme personal_full assembled nine charts after health vargas landed, but the document schema still capped at six. Bind the count to the enum, align JSON/Python contracts, and log final-parse paths without values. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -316,3 +316,22 @@ def test_validator_accepts_synthetic_producer_output() -> None:
|
||||
}
|
||||
document["provenance"]["evidenceHash"] = compute_evidence_hash(document)
|
||||
assert validate_report_document(document).valid
|
||||
|
||||
|
||||
def test_v2_accepts_full_chart_ids_set() -> None:
|
||||
from scripts.personal_report_contract import CHART_IDS
|
||||
|
||||
document = load_report_document(str(ROOT / "tests" / "fixtures" / "personal_report_document.v2.json"))
|
||||
template = document["charts"][0]
|
||||
present = {chart["id"] for chart in document["charts"]}
|
||||
for chart_id in CHART_IDS:
|
||||
if chart_id in present:
|
||||
continue
|
||||
extra = json.loads(json.dumps(template))
|
||||
extra["id"] = chart_id
|
||||
extra["title"] = f"{chart_id} 分盘"
|
||||
document["charts"].append(extra)
|
||||
assert len(document["charts"]) == len(CHART_IDS)
|
||||
document["provenance"]["evidenceHash"] = compute_evidence_hash(document)
|
||||
result = validate_report_document(document)
|
||||
assert result.valid, result.errors
|
||||
|
||||
Reference in New Issue
Block a user