From 2113b5a09d01c3d51e5c511c6edd4ffc2925a79e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Posp=C3=AD=C5=A1il?= Date: Fri, 14 Aug 2026 23:09:59 +0200 Subject: [PATCH] ADDED: Resolution of bug reports will post the commit hash and link to Discord reports channel before closing and archiving the bug report thread --- .../skills/discord-reports-resolve/SKILL.md | 5 ++++ discord-reports/README.md | 3 ++- discord-reports/resolve.sh | 25 ++++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.claude/skills/discord-reports-resolve/SKILL.md b/.claude/skills/discord-reports-resolve/SKILL.md index a4abc5b..8638e66 100644 --- a/.claude/skills/discord-reports-resolve/SKILL.md +++ b/.claude/skills/discord-reports-resolve/SKILL.md @@ -27,6 +27,11 @@ For every folder marked `resolved`, this archives and locks the matching Discord hand — then flips the local `status` to `"closed"` and stamps `closed_at`. The Discord thread is never deleted, only archived: it stays the permanent, searchable record. +If `resolution` names a commit hash that actually exists in this repo (`"fixed in a1b2c3d: ..."`), +a plain message — `Fixed in commit `a1b2c3d` — https://github.com/JIRPOS/PathOfPriceCheck/commit/...` +— is posted to the thread first, before it's archived. A `resolution` with no verifiable hash +(`"wontfix: ..."`, `"duplicate of ..."`) just archives as before — nothing is guessed or posted. + ```sh ./resolve.sh --cleanup ``` diff --git a/discord-reports/README.md b/discord-reports/README.md index 1b157ab..3fd4b2f 100644 --- a/discord-reports/README.md +++ b/discord-reports/README.md @@ -3,7 +3,8 @@ A local-only maintainer tool: pulls bug reports out of the private `#ppc-reports` Discord forum (see [worker/README.md](../worker/README.md) for how a report gets there) into `inbox/`, so they can be triaged without a Discord client open. The only things it ever writes back to Discord are a -reaction, to mark a report as pulled, and — once a report is marked resolved locally — archiving +reaction, to mark a report as pulled, and — once a report is marked resolved locally — a +"fixed in commit ..." message (only when `resolution` names a real commit) followed by archiving that report's own thread. Two Claude Code skills drive it day to day: **discord-reports-ingest** and diff --git a/discord-reports/resolve.sh b/discord-reports/resolve.sh index 02ff8ce..9fdb03c 100755 --- a/discord-reports/resolve.sh +++ b/discord-reports/resolve.sh @@ -3,7 +3,10 @@ # copies. See .claude/skills/discord-reports-resolve/SKILL.md. # # ./resolve.sh archive+lock the Discord thread for every inbox/*/meta.json with -# status "resolved", then flip that status to "closed" +# status "resolved", then flip that status to "closed". If +# "resolution" names a commit hash that exists in this repo, a +# "Fixed in commit ..." message with a GitHub link is posted to +# the thread first. # ./resolve.sh --cleanup also list local folders closed longer than DISCORD_REPORTS_CLEANUP_DAYS # ./resolve.sh --cleanup --yes ...and actually delete them (Discord thread is never touched) set -euo pipefail @@ -29,12 +32,32 @@ done CLEANUP_DAYS=${DISCORD_REPORTS_CLEANUP_DAYS:-90} +GITHUB_REPO="https://github.com/JIRPOS/PathOfPriceCheck" + closed=0 for dir in inbox/*/; do [[ -f "$dir/meta.json" ]] || continue [[ $(jq -r '.status' "$dir/meta.json") == "resolved" ]] || continue thread_id=$(jq -r '.thread_id' "$dir/meta.json") + + # If the resolution names a real commit in this repo, post it to the thread before archiving — + # only a hash git can actually verify counts, never a bare guess out of the resolution text. + resolution=$(jq -r '.resolution // empty' "$dir/meta.json") + commit="" + if [[ -n $resolution ]]; then + for candidate in $(grep -oE '\b[0-9a-f]{7,40}\b' <<<"$resolution"); do + commit=$(git -C .. rev-parse --verify --quiet "${candidate}^{commit}" 2>/dev/null) && break + commit="" + done + fi + if [[ -n $commit ]]; then + note_body=$(jq -n --arg c "Fixed in commit \`${commit:0:7}\` — $GITHUB_REPO/commit/$commit" \ + '{content: $c}') + api POST "/channels/$thread_id/messages" "$note_body" >/dev/null \ + || echo "failed to post fixed-in-commit message to $thread_id ($dir), archiving anyway" >&2 + fi + if ! api PATCH "/channels/$thread_id" '{"archived":true,"locked":true}' >/dev/null; then echo "failed to archive thread $thread_id ($dir), leaving it marked resolved" >&2 continue