From a307e4dcb75903a4e7759d44d0a6027e29cc8f87 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 8 Apr 2026 00:00:47 -0500 Subject: [PATCH] =?UTF-8?q?docs:=20sync=20KB=20=E2=80=94=20database-releas?= =?UTF-8?q?e-2026.4.7.md,release-2026.4.7.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- major-domo/database-release-2026.4.7.md | 69 +++++++++++++++++++++++++ major-domo/release-2026.4.7.md | 37 +++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 major-domo/database-release-2026.4.7.md create mode 100644 major-domo/release-2026.4.7.md diff --git a/major-domo/database-release-2026.4.7.md b/major-domo/database-release-2026.4.7.md new file mode 100644 index 0000000..9e31014 --- /dev/null +++ b/major-domo/database-release-2026.4.7.md @@ -0,0 +1,69 @@ +--- +title: "Database API Release — 2026.4.7" +description: "Major cleanup: middleware connection management, security hardening, performance fixes, and Pydantic/Docker upgrades." +type: reference +domain: major-domo +tags: [release-notes, deployment, database, major-domo] +--- + +# Database API Release — 2026.4.7 + +**Date:** 2026-04-07 +**Tag:** TBD (next CalVer tag after `2026.4.5`) +**Image:** `manticorum67/major-domo-database:{tag}` + `:latest` +**Server:** `ssh akamai` (`~/container-data/sba-database`) +**Deploy method:** `git tag -a YYYY.M.BUILD -m "description" && git push origin YYYY.M.BUILD` → CI builds Docker image → pull + restart on akamai + +## Release Summary + +Large batch merge of 22 PRs covering connection management, security hardening, query performance, code cleanup, and infrastructure upgrades. The headline change is middleware-based DB connection management replacing 177+ manual `db.close()` calls across all routers. + +## Changes + +### Architecture +- **Middleware connection management** — replaced all manual `db.close()` calls with HTTP middleware that opens connections before requests and closes after responses (PR #97) +- **Disabled autoconnect + pool timeout** — `PooledPostgresqlDatabase` now uses `autoconnect=False` and `timeout=5` for tighter connection lifecycle control (PR #87) +- **Migration tracking system** — new system for tracking applied database migrations (PR #96) + +### Security +- **Removed hardcoded webhook URL** — Discord webhook URL moved to `DISCORD_WEBHOOK_URL` env var (PR #83). Old token is in git history — rotate it. +- **Removed hardcoded fallback DB password** — no more default password in `db_engine.py` (PR #55) +- **Removed token from log warnings** — Bad Token log messages no longer include the raw token value (PR #85) + +### Performance +- **Batch standings updates** — eliminated N+1 queries in `recalculate_standings` (PR #93) +- **Bulk DELETE in career recalculation** — replaced row-by-row DELETE with single bulk operation (PR #92) +- **Added missing FK indexes** — indexes on FK columns in `stratplay` and `stratgame` tables (PR #95) +- **Fixed total_count in get_totalstats** — count no longer overwritten with page length (PR #102) + +### Bug Fixes +- **Boolean field comparisons** — replaced integer comparisons (`== 1`) with proper `True`/`False` (PR #94) +- **CustomCommandCreator.discord_id** — aligned model field with BIGINT column type (PR #88) +- **Literal validation on sort param** — `GET /api/v3/players` now validates sort values (PR #68) +- **PitchingStat combined_season** — added missing classmethod for combined season stats (PR #67) + +### Code Cleanup +- Removed SQLite fallback code from `db_engine.py` (PR #89) +- Replaced deprecated `.dict()` with `.model_dump()` across all Pydantic models (PR #90) +- Added type annotations to untyped query parameters (PR #86) +- Removed commented-out dead code blocks (PR #48) +- Replaced `print()` debug statements with `logger` calls in `db_engine.py` (PR #53) +- Removed unimplemented `is_trade` parameter from transactions endpoint (PR #57) +- Eliminated N+1 queries in `get_custom_commands` (PR #51) + +### Infrastructure +- **Docker base image upgraded** from Python 3.11 to 3.12 (PR #91) +- **CI switched to tag-triggered builds** (PR #107) + +## Known Issues + +- ~20 unit tests broken by SQLite fallback removal — tests relied on SQLite that no longer exists (issue #108) +- `test_get_nonexistent_play` returns 500 instead of 404 (issue #109) +- `test_batting_sbaplayer_career_totals` returns 422 instead of 200 (issue #110) + +## Deployment Notes + +- **New env var required:** `DISCORD_WEBHOOK_URL` must be set in the container environment. Check `docker-compose.yml` passes it through. +- **Rotate webhook token** — the old hardcoded token is in git history. +- **Migration tracking:** new migration table will be created on first run. +- **Rollback:** `docker compose pull manticorum67/major-domo-database:2026.4.5 && docker compose up -d` diff --git a/major-domo/release-2026.4.7.md b/major-domo/release-2026.4.7.md new file mode 100644 index 0000000..cace042 --- /dev/null +++ b/major-domo/release-2026.4.7.md @@ -0,0 +1,37 @@ +--- +title: "Discord Bot Release — 2026.4.7" +description: "Minor fix: add missing logger to SubmitConfirmationModal." +type: reference +domain: major-domo +tags: [release-notes, deployment, discord, major-domo] +--- + +# Discord Bot Release — 2026.4.7 + +**Date:** 2026-04-07 +**Tag:** TBD (next CalVer tag after `2026.3.13`) +**Image:** `manticorum67/major-domo-discordapp:{tag}` + `:production` +**Server:** `ssh akamai` (`~/container-data/major-domo`) +**Deploy method:** `.scripts/release.sh` → CI builds Docker image → `.scripts/deploy.sh` + +## Release Summary + +Minimal release with a single logging fix. Previous releases (2026.3.12–2026.3.13) included the larger performance and feature work (FA lock enforcement, trade view optimization, parallel lookups). + +## Changes + +### Bug Fixes +- **Missing logger in SubmitConfirmationModal** — added logger initialization that was absent, preventing proper error logging in transaction confirmation flows + +## Not Included (PR #120) + +PR #120 (caching for stable data) remains open with two unfixed issues: +1. `_channel_color_cache` cross-user contamination — cache keyed by channel only, user-specific colors bleed across users +2. `recalculate_standings()` doesn't invalidate standings cache + +These must be addressed before PR #120 can merge. + +## Deployment Notes + +- No new env vars or config changes required +- **Rollback:** `.scripts/deploy.sh` with previous image tag, or `ssh akamai` → `docker compose pull manticorum67/major-domo-discordapp:2026.3.13 && docker compose up -d`