mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
fix(kanban): preserve dashboard completion summaries
This commit is contained in:
parent
cca8587d35
commit
354502ee48
6 changed files with 236 additions and 4 deletions
|
|
@ -1389,6 +1389,48 @@ def test_cli_complete_with_summary_and_metadata(kanban_home):
|
|||
assert r.metadata == {"files": 3}
|
||||
|
||||
|
||||
def test_cli_edit_backfills_result_on_done_task(kanban_home):
|
||||
conn = kb.connect()
|
||||
try:
|
||||
tid = kb.create_task(conn, title="x", assignee="worker")
|
||||
kb.complete_task(conn, tid)
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
meta = '{"source": "dashboard-recovery"}'
|
||||
out = run_slash(
|
||||
"edit " + tid
|
||||
+ " --result \"DECIDED: done\""
|
||||
+ " --summary \"DECIDED: done\""
|
||||
+ " --metadata '" + meta + "'"
|
||||
)
|
||||
|
||||
assert "Edited" in out
|
||||
conn = kb.connect()
|
||||
try:
|
||||
task = kb.get_task(conn, tid)
|
||||
run = kb.latest_run(conn, tid)
|
||||
events = kb.list_events(conn, tid)
|
||||
finally:
|
||||
conn.close()
|
||||
assert task.result == "DECIDED: done"
|
||||
assert run.summary == "DECIDED: done"
|
||||
assert run.metadata == {"source": "dashboard-recovery"}
|
||||
assert events[-1].kind == "edited"
|
||||
|
||||
|
||||
def test_cli_edit_rejects_non_done_task(kanban_home):
|
||||
conn = kb.connect()
|
||||
try:
|
||||
tid = kb.create_task(conn, title="x", assignee="worker")
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
out = run_slash(f"edit {tid} --result nope")
|
||||
|
||||
assert "not done" in out
|
||||
|
||||
|
||||
def test_cli_complete_bad_metadata_exits_nonzero(kanban_home):
|
||||
conn = kb.connect()
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -561,6 +561,49 @@ def test_bulk_status_ready(client):
|
|||
assert {a["id"], b["id"], c2["id"]}.issubset(ids)
|
||||
|
||||
|
||||
def test_bulk_status_done_forwards_completion_summary(client):
|
||||
a = client.post("/api/plugins/kanban/tasks", json={"title": "a"}).json()["task"]
|
||||
b = client.post("/api/plugins/kanban/tasks", json={"title": "b"}).json()["task"]
|
||||
|
||||
r = client.post(
|
||||
"/api/plugins/kanban/tasks/bulk",
|
||||
json={
|
||||
"ids": [a["id"], b["id"]],
|
||||
"status": "done",
|
||||
"result": "DECIDED: ship it",
|
||||
"summary": "DECIDED: ship it",
|
||||
"metadata": {"source": "dashboard"},
|
||||
},
|
||||
)
|
||||
|
||||
assert r.status_code == 200
|
||||
assert all(r["ok"] for r in r.json()["results"])
|
||||
conn = kb.connect()
|
||||
try:
|
||||
for tid in (a["id"], b["id"]):
|
||||
task = kb.get_task(conn, tid)
|
||||
run = kb.latest_run(conn, tid)
|
||||
assert task.status == "done"
|
||||
assert task.result == "DECIDED: ship it"
|
||||
assert run.summary == "DECIDED: ship it"
|
||||
assert run.metadata == {"source": "dashboard"}
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def test_dashboard_done_actions_prompt_for_completion_summary():
|
||||
repo_root = Path(__file__).resolve().parents[2]
|
||||
bundle = (
|
||||
repo_root / "plugins" / "kanban" / "dashboard" / "dist" / "index.js"
|
||||
).read_text()
|
||||
|
||||
assert "withCompletionSummary" in bundle
|
||||
assert "Completion summary" in bundle
|
||||
assert "result: summary" in bundle
|
||||
assert "body: JSON.stringify(patch)" in bundle
|
||||
assert "body: JSON.stringify(finalPatch)" in bundle
|
||||
|
||||
|
||||
def test_bulk_archive(client):
|
||||
a = client.post("/api/plugins/kanban/tasks", json={"title": "a"}).json()["task"]
|
||||
b = client.post("/api/plugins/kanban/tasks", json={"title": "b"}).json()["task"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue