feat(tasks): define investigation report contract and history

This commit is contained in:
2026-10-10 16:02:46 +08:00
parent 4a63fcd7ff
commit 2b6fc5aa52
12 changed files with 1380 additions and 52 deletions
+635 -2
View File
@@ -779,6 +779,16 @@
"title": "Approved Data Scopes",
"type": "array"
},
"selected_report": {
"anyOf": [
{
"$ref": "#/components/schemas/InvestigationReportRevision"
},
{
"type": "null"
}
]
},
"task": {
"$ref": "#/components/schemas/OperationalTaskDetail"
}
@@ -2852,8 +2862,142 @@
"title": "HumanEvidenceCommand",
"type": "object"
},
"InvestigationReportInput": {
"InvestigationDataGap": {
"additionalProperties": false,
"properties": {
"blocking": {
"title": "Blocking",
"type": "boolean"
},
"evidence_refs": {
"items": {
"minLength": 1,
"type": "string"
},
"minItems": 1,
"title": "Evidence Refs",
"type": "array"
},
"gap_id": {
"minLength": 1,
"title": "Gap Id",
"type": "string"
},
"impact": {
"minLength": 1,
"title": "Impact",
"type": "string"
},
"missing_data": {
"minLength": 1,
"title": "Missing Data",
"type": "string"
},
"node_id": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"title": "Node Id"
},
"required_data": {
"minLength": 1,
"title": "Required Data",
"type": "string"
},
"scope": {
"minLength": 1,
"title": "Scope",
"type": "string"
}
},
"required": [
"gap_id",
"missing_data",
"scope",
"impact",
"required_data",
"evidence_refs",
"blocking"
],
"title": "InvestigationDataGap",
"type": "object"
},
"InvestigationDiagram": {
"additionalProperties": false,
"properties": {
"mermaid": {
"maxLength": 20000,
"minLength": 1,
"title": "Mermaid",
"type": "string"
},
"node_refs": {
"items": {
"$ref": "#/components/schemas/InvestigationDiagramNodeRef"
},
"maxItems": 100,
"title": "Node Refs",
"type": "array"
},
"title": {
"minLength": 1,
"title": "Title",
"type": "string"
}
},
"required": [
"title",
"mermaid"
],
"title": "InvestigationDiagram",
"type": "object"
},
"InvestigationDiagramNodeRef": {
"additionalProperties": false,
"properties": {
"action_refs": {
"items": {
"format": "uuid",
"type": "string"
},
"title": "Action Refs",
"type": "array"
},
"evidence_refs": {
"items": {
"minLength": 1,
"type": "string"
},
"title": "Evidence Refs",
"type": "array"
},
"label": {
"minLength": 1,
"title": "Label",
"type": "string"
},
"node_id": {
"pattern": "^[A-Za-z_][A-Za-z0-9_-]{0,79}$",
"title": "Node Id",
"type": "string"
}
},
"required": [
"node_id",
"label"
],
"title": "InvestigationDiagramNodeRef",
"type": "object"
},
"InvestigationReport": {
"additionalProperties": false,
"description": "Read model: absent historical facts remain unknown, never inferred.",
"properties": {
"conclusion_boundary": {
"minLength": 1,
@@ -2865,6 +3009,30 @@
"title": "Current Conclusion",
"type": "string"
},
"data_gaps": {
"anyOf": [
{
"items": {
"$ref": "#/components/schemas/InvestigationDataGap"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Data Gaps"
},
"diagram": {
"anyOf": [
{
"$ref": "#/components/schemas/InvestigationDiagram"
},
{
"type": "null"
}
]
},
"evidence_refs": {
"items": {
"minLength": 1,
@@ -2873,6 +3041,21 @@
"title": "Evidence Refs",
"type": "array"
},
"outcome": {
"anyOf": [
{
"enum": [
"concluded",
"insufficient_data"
],
"type": "string"
},
{
"type": "null"
}
],
"title": "Outcome"
},
"pending_items": {
"items": {
"minLength": 1,
@@ -2889,6 +3072,33 @@
"title": "Recommendations",
"type": "array"
},
"stage": {
"anyOf": [
{
"enum": [
"interim",
"final"
],
"type": "string"
},
{
"type": "null"
}
],
"title": "Stage"
},
"stop_reason": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"title": "Stop Reason"
},
"title": {
"minLength": 1,
"title": "Title",
@@ -2900,9 +3110,159 @@
"current_conclusion",
"conclusion_boundary"
],
"title": "InvestigationReport",
"type": "object"
},
"InvestigationReportInput": {
"additionalProperties": false,
"description": "Write model: every new report explicitly declares its business result.",
"properties": {
"conclusion_boundary": {
"minLength": 1,
"title": "Conclusion Boundary",
"type": "string"
},
"current_conclusion": {
"minLength": 1,
"title": "Current Conclusion",
"type": "string"
},
"data_gaps": {
"items": {
"$ref": "#/components/schemas/InvestigationDataGap"
},
"title": "Data Gaps",
"type": "array"
},
"diagram": {
"anyOf": [
{
"$ref": "#/components/schemas/InvestigationDiagram"
},
{
"type": "null"
}
]
},
"evidence_refs": {
"items": {
"minLength": 1,
"type": "string"
},
"title": "Evidence Refs",
"type": "array"
},
"outcome": {
"enum": [
"concluded",
"insufficient_data"
],
"title": "Outcome",
"type": "string"
},
"pending_items": {
"items": {
"minLength": 1,
"type": "string"
},
"title": "Pending Items",
"type": "array"
},
"recommendations": {
"items": {
"minLength": 1,
"type": "string"
},
"title": "Recommendations",
"type": "array"
},
"stage": {
"enum": [
"interim",
"final"
],
"title": "Stage",
"type": "string"
},
"stop_reason": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"title": "Stop Reason"
},
"title": {
"minLength": 1,
"title": "Title",
"type": "string"
}
},
"required": [
"title",
"current_conclusion",
"conclusion_boundary",
"stage",
"outcome",
"data_gaps"
],
"title": "InvestigationReportInput",
"type": "object"
},
"InvestigationReportPage": {
"additionalProperties": false,
"properties": {
"items": {
"items": {
"$ref": "#/components/schemas/InvestigationReportRevision"
},
"title": "Items",
"type": "array"
},
"next_offset": {
"anyOf": [
{
"minimum": 0.0,
"type": "integer"
},
{
"type": "null"
}
],
"title": "Next Offset"
}
},
"required": [
"items"
],
"title": "InvestigationReportPage",
"type": "object"
},
"InvestigationReportReference": {
"additionalProperties": false,
"properties": {
"execution_generation": {
"minimum": 1.0,
"title": "Execution Generation",
"type": "integer"
},
"revision": {
"minimum": 1.0,
"title": "Revision",
"type": "integer"
}
},
"required": [
"execution_generation",
"revision"
],
"title": "InvestigationReportReference",
"type": "object"
},
"InvestigationReportRevision": {
"additionalProperties": false,
"properties": {
@@ -2929,7 +3289,7 @@
"type": "string"
},
"report": {
"$ref": "#/components/schemas/InvestigationReportInput"
"$ref": "#/components/schemas/InvestigationReport"
},
"revision": {
"minimum": 1.0,
@@ -3792,6 +4152,16 @@
],
"title": "Read By"
},
"report_reference": {
"anyOf": [
{
"$ref": "#/components/schemas/InvestigationReportReference"
},
{
"type": "null"
}
]
},
"required_permission": {
"anyOf": [
{
@@ -25748,6 +26118,23 @@
"type": "string"
}
},
{
"in": "query",
"name": "report_revision",
"required": false,
"schema": {
"anyOf": [
{
"minimum": 1,
"type": "integer"
},
{
"type": "null"
}
],
"title": "Report Revision"
}
},
{
"in": "header",
"name": "X-Project-Id",
@@ -26324,6 +26711,252 @@
]
}
},
"/api/v1/operational-tasks/{task_id}/reports": {
"get": {
"operationId": "get_operational_tasks_task_id_reports",
"parameters": [
{
"in": "path",
"name": "task_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Task Id",
"type": "string"
}
},
{
"in": "query",
"name": "limit",
"required": false,
"schema": {
"default": 20,
"maximum": 100,
"minimum": 1,
"title": "Limit",
"type": "integer"
}
},
{
"in": "query",
"name": "offset",
"required": false,
"schema": {
"default": 0,
"minimum": 0,
"title": "Offset",
"type": "integer"
}
},
{
"in": "header",
"name": "X-Project-Id",
"required": true,
"schema": {
"title": "X-Project-Id",
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InvestigationReportPage"
}
}
},
"description": "Successful Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Authentication required"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Insufficient permission"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Resource not found"
},
"409": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Resource conflict"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Validation error"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Dependency unavailable"
}
},
"security": [
{
"OAuth2PasswordBearer": []
}
],
"summary": "List Investigation Reports",
"tags": [
"Operational Tasks"
]
}
},
"/api/v1/operational-tasks/{task_id}/reports/{revision}": {
"get": {
"operationId": "get_operational_tasks_task_id_reports_revision",
"parameters": [
{
"in": "path",
"name": "task_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Task Id",
"type": "string"
}
},
{
"in": "path",
"name": "revision",
"required": true,
"schema": {
"title": "Revision",
"type": "integer"
}
},
{
"in": "header",
"name": "X-Project-Id",
"required": true,
"schema": {
"title": "X-Project-Id",
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InvestigationReportRevision"
}
}
},
"description": "Successful Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Authentication required"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Insufficient permission"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Resource not found"
},
"409": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Resource conflict"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Validation error"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Dependency unavailable"
}
},
"security": [
{
"OAuth2PasswordBearer": []
}
],
"summary": "Get Investigation Report",
"tags": [
"Operational Tasks"
]
}
},
"/api/v1/operational-tasks/{task_id}/retry": {
"post": {
"operationId": "post_operational_tasks_task_id_retry",