Skip to content

fix(participation): trophy as the topic icon and paced post/pin in fresh topics - #47

Merged
TOMOKI977 merged 3 commits into
mainfrom
fix/participation-topic-icon
Sep 29, 2026
Merged

TOMOKI977 merged 3 commits into
mainfrom
fix/participation-topic-icon

Conversation

@TOMOKI977

Copy link
Copy Markdown
Contributor

Summary

This PR fixes two problems in hackathon-participation that showed up in the production smoke test.

1. The trophy should be the topic icon, not part of its name

Topics were created with the name "🏆 BNB Hack: …" and the default icon.

  • Adapter (src/adapters/telegram/forum-topic-manager.ts):
    • It resolves 🏆 through getForumTopicIconStickers() and matches the emoji field with U+FE0F stripped on both sides.
    • It creates the topic with icon_custom_emoji_id and a plain name.
    • It caches the icon list per isolate and clears the cache if the lookup fails.
    • If the list has no 🏆, or the lookup fails, it creates the topic with no icon and falls back to the name "🏆 ". The icon lookup can never make topic creation fail.
  • Domain (src/domain/hackathon/topic.ts): topicNameFor(name, slug, iconApplied) returns either the plain name or the prefixed fallback, both within the 128-character cap. The General confirmation uses the plain name.

2. The pin in a freshly created topic was not applied

In production, pinChatMessage for the first post in a topic the bot had just created returned OK, but no pin and no "pinned a message" service message appeared. Pinning in a topic that already existed worked.

  • participateInHackathon now paces the fresh-topic path only, through an injected sleep: create → link → wait 1500 ms (TOPIC_POST_DELAY_MS) → post → wait 1000 ms (PIN_DELAY_MS) → pin.
  • The pin wait is passed to postAnalysisAndLinkTopic as pinDelayMs.
  • The existing-topic check and the run-hackathon-job callers never wait.
  • composition.ts wires the real setTimeout sleep. The callback is answered before the waits.

Review

A bounded review at medium risk ran the reliability lens over all 19 changed paths and found no severe findings.

Deferred warning R3-001: three e2e tests go through the real setTimeout sleep, adding about 2.5 s each against Vitest's default 5 s timeout. They could get flaky on a slow CI.

Tests

  • Strict TDD.
  • The full suite passes (1044 tests), and typecheck is clean.

🤖 Generated with Claude Code

@TOMOKI977
TOMOKI977 merged commit 4a14ad7 into main Sep 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant