Repository navigation
fix(participation): detect deleted topics by posting into them; recreate only on thread-gone - #46
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes a bug in
hackathon-participationthat the production smoke test surfaced.The bug: a user deleted a linked topic (topic 262).
/hackathon joinstill replied "Este hackathon ya tiene tema: …/262" with a dead link. The existence check usedsendChatAction, and Telegram accepts that call even for a deleted thread, so it could never detect the deletion.The fix: the bot now checks an existing linked topic by doing the real action, which is posting the analysis into it (post + re-pin via
postAnalysisAndLinkTopic).thread-gone: this is a 400 whose description matchesmessage thread not found/TOPIC_ID_INVALID/TOPIC_DELETED. The topic is deleted, so the existing path runs: claim, create, link, post/pin, confirm.topic-check-failed. The bot replies with the link and does not recreate, so a live topic is never duplicated.Changes
src/adapters/telegram/send-failure.ts: newclassifyPublishFailure, which emitsthread-goneonly for a 400 with a thread-gone description. A 403 with the same wording staysrejected.classifyTelegramFailureis unchanged, so the alert sender behaves as before.src/adapters/telegram/chat-publisher.ts: onlypost()uses the new classifier.pin,unpinandclearButtonsare unchanged.src/domain/errors.ts: addsPublishFailureClass = AlertSendFailureClass | "thread-gone".src/domain/usecases/participate-in-hackathon.ts: onlythread-gonerecreates.src/domain/usecases/run-hackathon-job.ts:thread-goneis handled likerejected(no retry).ForumTopicManager.probeis removed from the port, the adapter, the fakes and the tests.proposal.md,design.mdand the spec now describe the post-based check and its residual risk. If Telegram's deleted-thread wording differs, the topic is not recreated, which is the safe side, and the smoke test confirms the wording.Review
thread-goneline inrun-hackathon-job.tshas no test.Tests
🤖 Generated with Claude Code