mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-21 11:12:28 +01:00
Feedback tasks lose the MANUAL prefix
Some checks are pending
file length / file-length (push) Waiting to run
kuhy_credit drift / drift (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
Some checks are pending
file length / file-length (push) Waiting to run
kuhy_credit drift / drift (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d5ddcb4d99
commit
0d86c41ee7
@ -12,18 +12,18 @@ on GitHub).
|
||||
|
||||
## Task shape
|
||||
|
||||
- Title: `MANUAL WORK REQUIRED: <repo> feedback: <first line of his note>` (note capped
|
||||
at 120 characters). The prefix makes todoImplementer list it as a human part and never
|
||||
run it. No note: `... feedback: <game> <combo> <HH:MM>`. A `report.json` that does
|
||||
not parse still gets a task, tagged `[corrupt report.json]`; the note then
|
||||
comes from the markdown entry.
|
||||
- Title: `<repo> feedback: <first line of his note>` (note capped at 120 characters).
|
||||
No `MANUAL WORK REQUIRED:` prefix: the note asks Claude to fix the game, so
|
||||
todoImplementer may run it. No note: `... feedback: <game> <combo> <HH:MM>`. A
|
||||
`report.json` that does not parse still gets a task, tagged `[corrupt report.json]`;
|
||||
the note then comes from the markdown entry.
|
||||
- Body: a `Due: <next day 10:00>` line, then the bundle's markdown entry (the
|
||||
prompt with absolute paths).
|
||||
- The task is its own note (`add_task` with `new_note`). The server stores that as
|
||||
`<repo> todos: <title>` plus a `## <title>` section, so right after adding, the inbox
|
||||
rewrites it with `update_task` to the exact title and a section-free body (the entry's
|
||||
own `##` headings become `###`). todoImplementer splits notes at `## ` headings, and a
|
||||
title that does not start with `MANUAL WORK REQUIRED: ` would make a runnable part.
|
||||
own `##` headings become `###`). todoImplementer splits notes at `## ` headings, so the
|
||||
body must hold none.
|
||||
The marker records `format: 2` once the rewrite worked; a failed rewrite is retried on
|
||||
the next sweep (never a second task), and markers without it are repaired the same way.
|
||||
- Closing the task cancels the feedback. "Act on feedback" in a Claude session
|
||||
|
||||
@ -39,7 +39,6 @@ MARKER = ".inbox-imported.json"
|
||||
FORMAT = 2
|
||||
SETTLE_SECONDS = 2.0
|
||||
TITLE_CAP = 120
|
||||
MANUAL_PREFIX = "MANUAL WORK REQUIRED: "
|
||||
CORRUPT_TAG = " [corrupt report.json]"
|
||||
CORRUPT_LINE = "Warning: report.json is corrupt; the note below comes from the entry."
|
||||
|
||||
@ -97,7 +96,7 @@ def build_task(repo: str, stamp: str, entry: str, report: Report | None) -> Task
|
||||
clock = parse_stamp(stamp).strftime("%H:%M")
|
||||
fallback = " ".join(x for x in (game, combo, clock) if x)
|
||||
suffix = CORRUPT_TAG if report is None else ""
|
||||
title = f"{MANUAL_PREFIX}{repo} feedback: {_first_line(note, fallback)}{suffix}"
|
||||
title = f"{repo} feedback: {_first_line(note, fallback)}{suffix}"
|
||||
due = due_at(stamp)
|
||||
lines = [f"Due: {due:%Y-%m-%d %H:%M}", ""]
|
||||
if report is None:
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from feedback_inbox._entry import Report
|
||||
@ -30,7 +31,6 @@ if TYPE_CHECKING:
|
||||
|
||||
NOW = 1_000_000.0
|
||||
OWNER = "kuhyx"
|
||||
MANUAL = "MANUAL WORK REQUIRED: "
|
||||
|
||||
|
||||
def _run(paths: Paths, todo: FakeTodo) -> list[Outcome]:
|
||||
@ -57,10 +57,7 @@ def test_complete_bundle_becomes_one_task(paths: Paths) -> None:
|
||||
assert _run(paths, todo) == [Outcome.IMPORTED]
|
||||
((repo, title, body),) = todo.calls
|
||||
assert repo == "kuhyx/cleanup-plate"
|
||||
assert (
|
||||
title
|
||||
== MANUAL + "cleanup-plate feedback: I would like to see the painting IN FULL"
|
||||
)
|
||||
assert title == "cleanup-plate feedback: I would like to see the painting IN FULL"
|
||||
assert body.startswith("Due: 2026-11-12 10:00\n\n### 2026-11-11T13:52:33")
|
||||
assert f"{bundle}/report.json" in body
|
||||
marker = json.loads((bundle / MARKER).read_text(encoding="utf-8"))
|
||||
@ -97,8 +94,8 @@ def test_multiple_games(paths: Paths) -> None:
|
||||
todo = FakeTodo()
|
||||
assert _run(paths, todo) == [Outcome.IMPORTED] * 2
|
||||
assert [(c[0], c[1]) for c in todo.calls] == [
|
||||
("kuhyx/cleanup-plate", "MANUAL WORK REQUIRED: cleanup-plate feedback: a"),
|
||||
("kuhyx/dread-grid", "MANUAL WORK REQUIRED: dread-grid feedback: b"),
|
||||
("kuhyx/cleanup-plate", "cleanup-plate feedback: a"),
|
||||
("kuhyx/dread-grid", "dread-grid feedback: b"),
|
||||
]
|
||||
|
||||
|
||||
@ -107,10 +104,7 @@ def test_corrupt_report_still_a_task(paths: Paths) -> None:
|
||||
todo = FakeTodo()
|
||||
assert _run(paths, todo) == [Outcome.IMPORTED]
|
||||
((_, title, body),) = todo.calls
|
||||
assert (
|
||||
title
|
||||
== "MANUAL WORK REQUIRED: cleanup-plate feedback: keep me [corrupt report.json]"
|
||||
)
|
||||
assert title == "cleanup-plate feedback: keep me [corrupt report.json]"
|
||||
assert "report.json is corrupt" in body
|
||||
assert (bundle / MARKER).exists()
|
||||
|
||||
@ -121,25 +115,22 @@ def test_corrupt_report_without_note(paths: Paths) -> None:
|
||||
assert _run(paths, todo) == [Outcome.IMPORTED]
|
||||
title = todo.calls[0][1]
|
||||
game_part = "museum loop=P2,carry=d,id=c 13:52"
|
||||
assert title == f"{MANUAL}cleanup-plate feedback: {game_part} [corrupt report.json]"
|
||||
assert title == f"cleanup-plate feedback: {game_part} [corrupt report.json]"
|
||||
|
||||
|
||||
def test_no_note_title_names_game_combo_time(paths: Paths) -> None:
|
||||
make_bundle(paths.data_root, note="")
|
||||
todo = FakeTodo()
|
||||
assert _run(paths, todo) == [Outcome.IMPORTED]
|
||||
assert (
|
||||
todo.calls[0][1]
|
||||
== "MANUAL WORK REQUIRED: cleanup-plate feedback: museum loop=P2 13:52"
|
||||
)
|
||||
assert todo.calls[0][1] == "cleanup-plate feedback: museum loop=P2 13:52"
|
||||
|
||||
|
||||
def test_title_uses_first_line_and_caps_length() -> None:
|
||||
report = Report(note="\n " + "x" * 300 + "\nsecond", game="g", combo="c")
|
||||
draft = build_task("repo", STAMP, "## e", report)
|
||||
assert draft.title == "MANUAL WORK REQUIRED: repo feedback: " + "x" * 119 + "…"
|
||||
assert draft.title == "repo feedback: " + "x" * 119 + "…"
|
||||
bare = build_task("repo", STAMP, "## e", Report(note="", game="", combo=""))
|
||||
assert bare.title == "MANUAL WORK REQUIRED: repo feedback: 13:52"
|
||||
assert bare.title == "repo feedback: 13:52"
|
||||
|
||||
|
||||
def test_todo_failure_leaves_no_marker(paths: Paths) -> None:
|
||||
@ -211,7 +202,7 @@ def test_run_settled_waits_then_gives_up(paths: Paths, tmp_path: Path) -> None:
|
||||
assert slept == [1.0, 1.0, 1.0]
|
||||
|
||||
|
||||
def test_every_title_starts_with_the_manual_prefix(paths: Paths) -> None:
|
||||
def test_no_title_carries_the_manual_prefix(paths: Paths) -> None:
|
||||
make_bundle(paths.data_root, stamp="2026-11-11T10-00-00-001", note="a")
|
||||
make_bundle(paths.data_root, stamp="2026-11-11T10-00-01-001", note="")
|
||||
make_bundle(paths.data_root, stamp="2026-11-11T10-00-02-001", report="{")
|
||||
@ -220,4 +211,5 @@ def test_every_title_starts_with_the_manual_prefix(paths: Paths) -> None:
|
||||
assert _run(paths, todo) == [Outcome.IMPORTED] * 4
|
||||
titles = [call[1] for call in todo.calls]
|
||||
assert len(titles) == 4
|
||||
assert all(t.startswith("MANUAL WORK REQUIRED: ") for t in titles)
|
||||
assert not any("MANUAL" in t for t in titles)
|
||||
assert all(re.match(r"[a-z-]+ feedback: ", t) for t in titles)
|
||||
|
||||
@ -24,7 +24,6 @@ if TYPE_CHECKING:
|
||||
|
||||
NOW = 1_000_000.0
|
||||
OWNER = "kuhyx"
|
||||
MANUAL = "MANUAL WORK REQUIRED: "
|
||||
|
||||
|
||||
def _run(paths: Paths, todo: FakeTodo) -> list[Outcome]:
|
||||
@ -43,12 +42,12 @@ def _no_extra_sections(text: str) -> bool:
|
||||
return not any(line.startswith("## ") for line in text.splitlines())
|
||||
|
||||
|
||||
def test_stored_note_is_one_manual_part(paths: Paths) -> None:
|
||||
def test_stored_note_is_one_part_without_manual_prefix(paths: Paths) -> None:
|
||||
bundle = make_bundle(paths.data_root)
|
||||
todo = FakeTodo()
|
||||
assert _run(paths, todo) == [Outcome.IMPORTED]
|
||||
(stored,) = todo.stored.values()
|
||||
assert stored.startswith(MANUAL)
|
||||
assert stored.startswith("cleanup-plate feedback: ")
|
||||
assert _no_extra_sections(stored)
|
||||
assert "### 2026-11-11T13:52:33" in stored
|
||||
assert _marker(bundle)["format"] == FORMAT
|
||||
@ -74,7 +73,7 @@ def test_failed_update_keeps_marker_and_retries_without_a_second_task(
|
||||
assert _run(paths, todo) == [Outcome.IMPORTED]
|
||||
assert len(todo.calls) == 1
|
||||
(stored,) = todo.stored.values()
|
||||
assert stored.startswith(MANUAL)
|
||||
assert stored.startswith("cleanup-plate feedback: ")
|
||||
assert _no_extra_sections(stored)
|
||||
assert _run(paths, todo) == [Outcome.SKIPPED]
|
||||
|
||||
@ -89,7 +88,7 @@ def test_old_marker_is_repaired_from_the_bundle(paths: Paths) -> None:
|
||||
todo = FakeTodo()
|
||||
assert _run(paths, todo) == [Outcome.IMPORTED]
|
||||
assert todo.calls == []
|
||||
assert todo.stored[task_id].startswith(MANUAL)
|
||||
assert todo.stored[task_id].startswith("cleanup-plate feedback: ")
|
||||
assert _no_extra_sections(todo.stored[task_id])
|
||||
assert _marker(bundle)["format"] == FORMAT
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user