mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
fix(api): serialize pr_reviewer_notes/doc_notes/notes_structured in the task response
task_to_response (the builder behind the task list + detail endpoints the panel reads) set dev_notes/qa_notes/quick_context but dropped pr_reviewer_notes, doc_notes, and notes_structured, and TaskResponse didn't declare notes_structured at all — so the PR-reviewer notes, documenter notes, and the structured PR-review verdict were always blank in the panel regardless of what agents persisted. The structured-content write-path + obligation gates were fine; the data just wasn't serialized. Now returns every note section + the structured source of truth. Regression test asserts all three round-trip.
This commit is contained in:
@@ -300,7 +300,10 @@ def _stub_task(*, with_project: bool = False) -> SimpleNamespace:
|
||||
dev_notes=None,
|
||||
qa_notes=None,
|
||||
auditor_notes=None,
|
||||
pr_reviewer_notes=None,
|
||||
doc_notes=None,
|
||||
quick_context=None,
|
||||
notes_structured=None,
|
||||
self_verified=False,
|
||||
qa_verified=None,
|
||||
branch_name=None,
|
||||
@@ -327,6 +330,23 @@ def test_task_to_response_includes_slug_when_project_loaded() -> None:
|
||||
assert resp.project_slug == "proj-1"
|
||||
|
||||
|
||||
def test_task_to_response_serializes_all_note_sections() -> None:
|
||||
"""Regression: pr_reviewer_notes / doc_notes / notes_structured MUST be in the
|
||||
response. The builder previously omitted them, so the panel showed them blank
|
||||
even when the DB had them (the recurring "notes invisible" bug)."""
|
||||
stub = _stub_task()
|
||||
stub.pr_reviewer_notes = "## Findings\n- looks good"
|
||||
stub.doc_notes = "Updated the README"
|
||||
stub.notes_structured = {"pr_review": {"verdict": "passed"}}
|
||||
fake_inspector = MagicMock()
|
||||
fake_inspector.unloaded = {"project"}
|
||||
with patch("roboco.api.schemas.tasks.sa_inspect", return_value=fake_inspector):
|
||||
resp = task_to_response(stub) # type: ignore[arg-type]
|
||||
assert resp.pr_reviewer_notes == "## Findings\n- looks good"
|
||||
assert resp.doc_notes == "Updated the README"
|
||||
assert resp.notes_structured == {"pr_review": {"verdict": "passed"}}
|
||||
|
||||
|
||||
def test_task_list_to_response_returns_list() -> None:
|
||||
stubs = [_stub_task(), _stub_task()]
|
||||
fake_inspector = MagicMock()
|
||||
|
||||
Reference in New Issue
Block a user