{"record":{"id":"7c1c6327cde2fdf0","repo":"ZhuLinsen/daily_stock_analysis","slug":"unsupported-report-snapshot","errorCode":"unsupported_report_snapshot","errorMessage":"source report snapshot cannot produce a valid decision signal: {exc}","messagePattern":"source report snapshot cannot produce a valid decision signal: (.+?)","errorType":"http","errorClass":"DecisionSignalUnsupportedReportSnapshotError","httpStatus":400,"severity":"warning","filePath":"src/services/decision_signal_reassess_service.py","lineNumber":149,"sourceCode":"\n        payload = _build_persist_payload(\n            record,\n            raw_result=raw_result,\n            decision_profile=decision_profile_norm,\n            candidate=preview_candidate,\n            metadata=metadata,\n        )\n        market_phase_summary = _as_mapping(context_snapshot.get(\"market_phase_summary\"))\n        if not market_phase_summary:\n            market_phase_summary = _as_mapping(raw_result.get(\"market_phase_summary\"))\n        try:\n            outcome = self.signal_service.create_history_bound_signal_with_outcome(\n                payload,\n                history_created_at=getattr(record, \"created_at\", None),\n                market_phase_summary=market_phase_summary,\n            )\n        except ValueError as exc:\n            raise DecisionSignalUnsupportedReportSnapshotError(\n                f\"source report snapshot cannot produce a valid decision signal: {exc}\"\n            ) from exc\n        return {\n            \"preview\": None,\n            \"item\": outcome.item,\n            \"created\": outcome.created,\n            \"persist_status\": outcome.disposition,\n            \"warnings\": policy.warnings,\n            \"blocked_reason\": None,\n        }\n\n\ndef _build_persist_payload(\n    record: AnalysisHistory,\n    *,\n    raw_result: Mapping[str, Any],\n    decision_profile: str,\n    candidate: DecisionSignalCandidate,","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/ZhuLinsen/daily_stock_analysis/blob/5159bd72e8373d215492dff122acc9d389e219c9/src/services/decision_signal_reassess_service.py#L131-L167","documentation":"During persist, create_history_bound_signal_with_outcome can raise ValueError when the payload built from the source report is not valid (score/action/phase fields etc.); the reassess service wraps it as DecisionSignalUnsupportedReportSnapshotError (code=unsupported_report_snapshot), signaling the report snapshot's data cannot yield a well-formed decision signal.","triggerScenarios":"POST reassess persist=true on a legacy report whose raw_result lacks required keys (dashboard/action/score) or carries values the downstream validation rejects (None score, unknown action, malformed market_phase_summary).","commonSituations":"Old reports written before schema changes; partial/failed analyses saved with raw_result present but incomplete; reports generated by a different engine version.","solutions":["Inspect the report's raw_result/context_snapshot for the required fields (dashboard, action, sentiment_score, market_phase_summary).","Choose a recent report generated by the current engine; skip legacy snapshots.","If the report class is needed, fix/normalize its raw_result before reassessing."],"exampleFix":"# before\noutcome = service.reassess(source_report_id=legacy_id, decision_profile=\"balanced\", persist=True)\n\n# after\nrecent = next(r for r in db.list_analysis_history(limit=20) if r.raw_result.get(\"dashboard\"))\noutcome = service.reassess(source_report_id=recent.id, decision_profile=\"balanced\", persist=True)","handlingStrategy":"try-catch","validationCode":"raw = _parse_mapping(getattr(record, \"raw_result\", None))\nrequired = (\"dashboard\", \"action\")\nmissing = [k for k in required if k not in raw]\nif missing:\n    return JSONResponse(status_code=422, content={\"error\": \"unsupported_report_snapshot\", \"missing\": missing})\nresult = service.reassess(source_report_id=rid, decision_profile=profile, persist=True)","typeGuard":"def isReassessableSnapshot(raw_result: dict) -> bool:\n    return isinstance(raw_result, dict) and \"dashboard\" in raw_result and raw_result.get(\"action\") is not None","tryCatchPattern":"from src.services.decision_signal_reassess_service import DecisionSignalUnsupportedReportSnapshotError\n\ntry:\n    outcome = service.reassess(source_report_id=rid, decision_profile=profile, persist=True)\nexcept DecisionSignalUnsupportedReportSnapshotError as exc:\n    return JSONResponse(status_code=422, content={\"error\": \"unsupported_report_snapshot\", \"message\": str(exc)})","preventionTips":["Prefer recent reports generated by the current engine version for reassessment.","In batch reassess loops, catch unsupported-snapshot errors and skip (log) instead of aborting.","Keep raw_result schema migrations additive so old snapshots remain parseable."],"tags":["decision-signal","reassess","data-quality","schema-compat"],"backgroundTag":null,"analyzedSha":"5159bd72e8373d215492dff122acc9d389e219c9","analyzedAt":"2026-08-15T01:59:36.292Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}