Rifqi Hafizuddin commited on
Commit
8198cc1
·
1 Parent(s): eef6de8

/edit md file

Browse files
Files changed (2) hide show
  1. API_CONTRACT_BE_PYTHON.md +2 -3
  2. DEV_PLAN.md +1 -1
API_CONTRACT_BE_PYTHON.md CHANGED
@@ -41,7 +41,7 @@ The frontend uses this service during the analysis conversation flow:
41
 
42
  - `user_id`: user identifier passed by the frontend.
43
  - `analysis_id`: analysis conversation identifier.
44
- - `message_id`: assistant answer identifier used to correlate chat streaming with traceability.
45
 
46
  ### Server-Sent Events
47
 
@@ -73,7 +73,6 @@ Request body:
73
  {
74
  "user_id": "u_1a2b3c",
75
  "analysis_id": "an_42",
76
- "message_id": "msg_88f1",
77
  "message": "What were total sales by region last quarter?"
78
  }
79
  ```
@@ -84,7 +83,7 @@ Fields:
84
  | --- | --- | --- |
85
  | `user_id` | Yes | User identifier. |
86
  | `analysis_id` | Yes | Analysis conversation identifier. |
87
- | `message_id` | No | Assistant answer id for traceability correlation. If omitted, Python returns one in `done`. |
88
  | `message` | Yes | User message text. |
89
 
90
  Response: `text/event-stream`.
 
41
 
42
  - `user_id`: user identifier passed by the frontend.
43
  - `analysis_id`: analysis conversation identifier.
44
+ - `message_id`: assistant answer identifier used to correlate chat streaming with traceability. **Server-minted, never accepted from the client.** **Updated 2026-07-09:** it is a UUID string (e.g. `77f06761-0fdf-4cc5-84f8-5f81bcbb6f84`), matching the shape of Go's `analyses_messages.id`. The `msg_…` values in the examples below are illustrative placeholders only.
45
 
46
  ### Server-Sent Events
47
 
 
73
  {
74
  "user_id": "u_1a2b3c",
75
  "analysis_id": "an_42",
 
76
  "message": "What were total sales by region last quarter?"
77
  }
78
  ```
 
83
  | --- | --- | --- |
84
  | `user_id` | Yes | User identifier. |
85
  | `analysis_id` | Yes | Analysis conversation identifier. |
86
+ | ~~`message_id`~~ | | **Updated 2026-07-09:** not a request field. Python always mints the id server-side and returns it on `done`; any caller-sent value is ignored (server-authoritative — open-Q #1). |
87
  | `message` | Yes | User message text. |
88
 
89
  Response: `text/event-stream`.
DEV_PLAN.md CHANGED
@@ -34,7 +34,7 @@ the endpoint contract *before* coding the tools. Status legend: ⬜ not started
34
  | **3 — tools + obs** | Audit `report_inputs` — covers planning + tool I/O + source? add cols / new store | Rifqi | ✅ | **KM-691.** Chose a dedicated store: `message_traceability` = 1 JSONB row per message (Python-owned, like `report_inputs`; DDL run manually against dedorch, handed to Harry). Langfuse kept for engineering. |
35
  | **3 — tools + obs** | Build `GET /api/v1/traceability` (one merged response) | Rifqi | ✅ | **KM-691.** `src/api/v1/traceability.py` → store.get → payload/404. Intent-based source rules (greeting/help/refusals = none; retrieve = required); full planning only on slow path. Contract §7 updated. |
36
  | **3 — tools + obs** | Keep stream **text-only**; traceability is a separate parallel call | Rifqi | ✅ | **KM-691.** No trace data in the SSE stream; the FE fetches `/traceability` on `done`. |
37
- | **3 — tools + obs** | Resolve `message_id` correlation (stream ↔ traceability) with Harry | Rifqi ↔ Harry | ✅ | **RESOLVED (pr/6):** Python is the **sole minter** — `message_id` dropped from the `/api/v2/chat/stream` + `/api/v1/tools/help` request bodies; always minted server-side (server-authoritative, FE-security) and returned on `done`. Any caller-sent `message_id` is ignored. Contract open-Q #1 closed. |
38
  | **4 — biz questions** | Get Go folder; confirm `business_questions` in create-analysis (max 5); sync Python | Harry/Mentor → Rifqi | ⬜ | Go currently missing the field ("lagi difixing"). Python already models objective + business_questions. |
39
  | **deferred** | Report formats: PPT (preferred) / PDF / infographic on download | — | ⏸️ | MD is fine for the FE preview stage now. |
40
  | **deferred** | Charts (Plotly→JSON) + images tables | — | ⏸️ | Carried from §4 #26/#27. |
 
34
  | **3 — tools + obs** | Audit `report_inputs` — covers planning + tool I/O + source? add cols / new store | Rifqi | ✅ | **KM-691.** Chose a dedicated store: `message_traceability` = 1 JSONB row per message (Python-owned, like `report_inputs`; DDL run manually against dedorch, handed to Harry). Langfuse kept for engineering. |
35
  | **3 — tools + obs** | Build `GET /api/v1/traceability` (one merged response) | Rifqi | ✅ | **KM-691.** `src/api/v1/traceability.py` → store.get → payload/404. Intent-based source rules (greeting/help/refusals = none; retrieve = required); full planning only on slow path. Contract §7 updated. |
36
  | **3 — tools + obs** | Keep stream **text-only**; traceability is a separate parallel call | Rifqi | ✅ | **KM-691.** No trace data in the SSE stream; the FE fetches `/traceability` on `done`. |
37
+ | **3 — tools + obs** | Resolve `message_id` correlation (stream ↔ traceability) with Harry | Rifqi ↔ Harry | ✅ | **RESOLVED (pr/6):** Python is the **sole minter** — `message_id` dropped from the `/api/v2/chat/stream` + `/api/v1/tools/help` request bodies; always minted server-side (server-authoritative, FE-security) and returned on `done`. Any caller-sent `message_id` is ignored. Contract open-Q #1 closed. **Updated 2026-07-09 (pr/13):** id format changed from `msg_<hex>` to a canonical UUID string (`str(uuid.uuid4())`, both mint sites) to mirror Go's `analyses_messages.id` shape — the value is still independently Python-minted (not the real row id), only format-compatible for a future swap. |
38
  | **4 — biz questions** | Get Go folder; confirm `business_questions` in create-analysis (max 5); sync Python | Harry/Mentor → Rifqi | ⬜ | Go currently missing the field ("lagi difixing"). Python already models objective + business_questions. |
39
  | **deferred** | Report formats: PPT (preferred) / PDF / infographic on download | — | ⏸️ | MD is fine for the FE preview stage now. |
40
  | **deferred** | Charts (Plotly→JSON) + images tables | — | ⏸️ | Carried from §4 #26/#27. |