mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-24 21:56:18 +01:00
Match the todo server's note title in dedup
The real server lists a new note as "<repo name> todos: <title>", so the exact-title check never found the open task and a repeat failure would have filed a duplicate. Seen while filing the one real verification task. The fake server now titles notes the same way. Todo: 85af719b Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9311405bc8
commit
b29b708fb8
@ -142,10 +142,17 @@ def _parse(ctype: str, body: str) -> dict[str, Any]:
|
|||||||
|
|
||||||
|
|
||||||
def _open_task(listing: str, title: str) -> str | None:
|
def _open_task(listing: str, title: str) -> str | None:
|
||||||
"""The id of an open task in *listing* titled exactly *title*."""
|
"""The id of an open task in *listing* titled *title*.
|
||||||
|
|
||||||
|
The server lists a new note as ``<repo name> todos: <title>``, so the
|
||||||
|
title matches exactly or as that suffix.
|
||||||
|
"""
|
||||||
for row in listing.splitlines():
|
for row in listing.splitlines():
|
||||||
parts = row.split("\t")
|
parts = row.split("\t")
|
||||||
if len(parts) >= _COLUMNS and re.sub(r"^#+\s*", "", parts[4].strip()) == title:
|
if len(parts) < _COLUMNS:
|
||||||
|
continue
|
||||||
|
listed = re.sub(r"^#+\s*", "", parts[4].strip())
|
||||||
|
if listed == title or listed.endswith(f": {title}"):
|
||||||
return parts[0]
|
return parts[0]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@ -42,8 +42,18 @@ class FakeTodo(ThreadingHTTPServer):
|
|||||||
"""Answer one tool call the way the real server words it."""
|
"""Answer one tool call the way the real server words it."""
|
||||||
self.calls.append(name)
|
self.calls.append(name)
|
||||||
if name == "list_tasks":
|
if name == "list_tasks":
|
||||||
|
# The real server titles a new note "<repo name> todos: <title>".
|
||||||
rows = [
|
rows = [
|
||||||
f"{t['id'][:8]}\ttodo\t{t['priority']}\t{t['repo']}\t{t['title']}\tclaude"
|
"\t".join(
|
||||||
|
(
|
||||||
|
t["id"][:8],
|
||||||
|
"todo",
|
||||||
|
t["priority"],
|
||||||
|
t["repo"],
|
||||||
|
_listed(t),
|
||||||
|
"claude",
|
||||||
|
)
|
||||||
|
)
|
||||||
for t in self.tasks
|
for t in self.tasks
|
||||||
if t["repo"] == args.get("repo")
|
if t["repo"] == args.get("repo")
|
||||||
]
|
]
|
||||||
@ -55,6 +65,11 @@ class FakeTodo(ThreadingHTTPServer):
|
|||||||
return f"added {task['id']}\n{task['id'][:8]}\ttodo\tmedium\t{task['repo']}"
|
return f"added {task['id']}\n{task['id'][:8]}\ttodo\tmedium\t{task['repo']}"
|
||||||
|
|
||||||
|
|
||||||
|
def _listed(task: dict[str, Any]) -> str:
|
||||||
|
"""The title list_tasks shows for *task*, as the real server words it."""
|
||||||
|
return f"{task['repo'].split('/')[-1]} todos: {task['title']}"
|
||||||
|
|
||||||
|
|
||||||
class _Handler(BaseHTTPRequestHandler):
|
class _Handler(BaseHTTPRequestHandler):
|
||||||
server: FakeTodo
|
server: FakeTodo
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user