feat: Dad of the Month#60
Draft
kbuechl wants to merge 3 commits into
Draft
Conversation
- Fix deadlock in model creation: WaitGroup.Done() was only called on "success" status; removed WaitGroup in favor of sequential creation - Fix data race: Temperature and Guidance now use atomic.Uint32 with Float32frombits/Float32bits accessors instead of plain float32 fields - Fix missing database name in pgxpool connection URL - Fix nil panic in WATO CanActivate: missing return false after channel fetch error in all four WATO commands - Fix nil pointer dereference: ChallengerBet/ChallengedBet are pointers, comparison now correctly dereferences them - Fix off-by-one in Dezgo model selection (rand.Intn(len-1) to len) - Fix return err vs return cErr typo in configure error path - Fix chat history slice panic when msgs is empty - Compile URL regex once at package level instead of per-message - Replace tiktoken panic with sync.Once lazy init and warn-on-failure - Delete unused messageHistory.go and vector.go (dead langchain/chroma code)
Monthly automated rotation of a "dad of the month" role with fairness tracking, baby-override support, and a channel announcement. Behavior: - Auto-picks on the 1st of each month at 10am EST; catches up on restart if the bot was down and no dad is set for the current month - Fairness: excludes last month's pick, then randomly selects among the candidates with the fewest non-override appearances in the last 12 months - Override (baby) months are free — they don't count against fairness - Commands: !adddad @user (grant dad role), !setdad @user (admin override for current + next month), !pickdad (admin force pick), !whosdad (anyone) - Announcements go to DAD_ANNOUNCEMENT_CHANNEL_ID; dad role via DAD_ROLE_ID Design: - Repository interface isolates persistence; pgxRepository holds the raw SQL (pgx, never mocked). Commands/scheduler depend on the interface so logic is tested against an in-memory fake. - New dad_of_month table with unique (GuildId, Year, Month) constraint Tests (TDD, RED then GREEN): pure logic fully covered — selectDad, nextPickTime, shouldCatchUp, command CanActivate routing, admin gating, whosdad handler, and setDadOverride (incl. Dec->Jan rollover and error paths). SQL and Discord-session glue are intentionally left to manual/ integration verification.
Previously the pick *timing* used America/New_York but the calendar month written to the DB and shown in announcements came from the raw server-local time.Now(). On a UTC server these disagree in the late- evening-EST window near a month boundary (e.g. Jun 30 8:30pm EST is Jul 1 UTC), which could file a pick under the wrong month. Add estNow() and source every calendar-month derivation from it so the feature behaves identically regardless of server timezone (the IANA zone also handles EST/EDT automatically). Also document the Dad of the Month commands in !help (admin-only ones marked) and fix a stray backtick in the image-tuning help text.
Collaborator
Author
|
Still want to test this end-to-end before merging — haven't run it against a live Discord server / DB yet. |
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.
Dad of the Month
Automated, fair-rotating "Dad of the Month" plus a batch of pre-existing bug fixes that were uncommitted on
main.Features
America/New_York); catches up on restart if a pick was missed.!whosdad(anyone),!adddad @user,!setdad @user(admin),!pickdad(admin).DAD_ANNOUNCEMENT_CHANNEL_ID; pool keyed offDAD_ROLE_ID. Dormant if either is unset.Design
Repositoryinterface isolates persistence;pgxRepositoryholds raw pgx SQL (never mocked). Newdad_of_monthtable, unique(GuildId, Year, Month). All month math viaestNow().Also included (bug-fix commit)
Ollama model-creation deadlock; LLM temperature/guidance data race -> atomic; missing DB name in pgx URL; nil panics in WATO
CanActivate; Dezgo off-by-one; tiktoken panic ->sync.Once; removed deadmessageHistory.go/vector.go.Tests
TDD; pure logic fully covered. Raw SQL + Discord glue left for manual/integration verification.
go build/vet/test/gofmtclean.Setup before running
dad_of_monthfrominit.sql. 2. SetDAD_ANNOUNCEMENT_CHANNEL_IDandDAD_ROLE_ID.🤖 Generated with Claude Code