Skip to content

feat(participation): topic creation infrastructure, claim and migration 0004 (hackathon-participation 1a/3) - #43

Merged
TOMOKI977 merged 6 commits into
mainfrom
feat/participation-infra
Sep 29, 2026
Merged

TOMOKI977 merged 6 commits into
mainfrom
feat/participation-infra

Conversation

@TOMOKI977

Copy link
Copy Markdown
Contributor

Summary

PR 1a of 3 for change 4, hackathon-participation. When an admin confirms, the bot creates a 🏆 <name> forum topic, then posts and pins the analysis there.

This PR adds only the infrastructure, with tests. Nothing uses it yet, so bot behavior is unchanged.

  • Planning docs: the exploration, proposal, specs, design and tasks for the change, under openspec/changes/hackathon-participation/.
  • migrations/0004_hackathon_participation.sql: adds two columns and nothing else. topic_claim_until holds the anti-duplicate claim and general_message_id holds the General analysis message id.
  • src/adapters/d1/hackathon-analysis-repo.ts:
    • The claim is a single conditional UPDATE: a compare-and-set with a 60 s TTL.
    • The claim can be released, and the general message id can be read and written.
    • Everything is scoped by team_id with bound parameters.
    • The existing upserts never write the new columns.
  • ForumTopicManager port and src/adapters/telegram/forum-topic-manager.ts:
    • create classifies the outcome as missing rights, not a forum, rejected, or uncertain.
    • probe uses sendChatAction with the thread id. It reports deleted only for a known thread-gone error; anything ambiguous counts as live, so a duplicate topic is never created.
    • Every call has a 10 s timeout.
  • ChatPublisher:
    • post takes an optional { participateSlug }, which adds the "✅ Participamos" button (hp:<slug>, at most 64 bytes).
    • New clearButtons.
    • The button label comes from the Spanish copy catalog.
  • Fakes for the new ports.

Review

A bounded review ran at high risk with all 4 lenses. There are no severe findings. Risk and resilience found nothing. Four advisory warnings will be fixed first thing in PR 1b:

ID Issue
R2-001 A ports.ts comment ended up detached from ChatPublisher.post
R2-002 design.md and a comment say the claim expires at < now, but the code uses <= now
R3-001 No test preserves a non-null generalMessageId across a refresh
R3-002 The fake repo's save replaces the whole row, unlike the D1 upserts

Tests

  • Strict TDD.
  • The full suite passes (916 tests) and typecheck is clean.
  • The remote D1 migration runs through the CI deploy, as in earlier changes.

🤖 Generated with Claude Code

@TOMOKI977 TOMOKI977 added the size:exception PR over the 400-line review budget, accepted explicitly label Sep 29, 2026
@TOMOKI977
TOMOKI977 merged commit bfec91d 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

size:exception PR over the 400-line review budget, accepted explicitly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant