From 53578d888b9d5ac475fbfc41a2d21660002b3383 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 12 Jun 2026 11:22:16 +0700 Subject: [PATCH] fix(deploy): include coin module in ModulesCSV overrides coin was registered in the catalog and template default but absent from the ModulesCSV override in both deploy.yml and samconfig.toml, so the deployed Lambda never loaded it and all coin_* commands went unregistered. Add a registration checklist to docs/deploy-aws.md to prevent recurrence. --- .github/workflows/deploy.yml | 2 +- docs/deploy-aws.md | 26 ++++++++++++++++++++++++++ samconfig.toml | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index aadd809..0bc39ce 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -60,7 +60,7 @@ jobs: # Telegram user IDs are public (visible to anyone the bot DMs), so # they live in this committed workflow rather than a secret. # Keep this module list in sync with samconfig.toml's ModulesCSV. - OVERRIDES="CronSharedSecret=$CRON_SECRET BotOwnerID=1064111334 AdminUserIDs=1064111334 ModulesCSV=util,misc,wordle,loldle,lolschedule,twentyq,trading,stats,gold" + OVERRIDES="CronSharedSecret=$CRON_SECRET BotOwnerID=1064111334 AdminUserIDs=1064111334 ModulesCSV=util,misc,wordle,loldle,lolschedule,twentyq,trading,stats,gold,coin" if [ -n "$ALERT_EMAIL" ]; then OVERRIDES="$OVERRIDES AlertEmail=$ALERT_EMAIL" fi diff --git a/docs/deploy-aws.md b/docs/deploy-aws.md index 7de7b3d..f234137 100644 --- a/docs/deploy-aws.md +++ b/docs/deploy-aws.md @@ -76,6 +76,32 @@ curl "https://api.telegram.org/bot$TOKEN/getWebhookInfo" | jq . ``` Expect: `url` matches Function URL, `pending_update_count` ≈ 0, `last_error_date` empty. +## Adding a module or command (registration checklist) + +A module only runs in production if its name is in **both** `ModulesCSV` sources — the +`template.yaml` default is ignored once an override is passed, so editing one place is +not enough. A command only appears in the Telegram menu if it is in +`aws/telegram-commands.json`. Missing either is silent: no error, the command just +never dispatches (this is how `coin_*` shipped dark until `coin` was added to the CSVs). + +When **adding a new module**, register it in all of: + +1. `cmd/server/main.go` — add the factory to the catalog (`"name": pkg.New`). +2. `.github/workflows/deploy.yml` — append the name to `ModulesCSV=…` (CI override). +3. `samconfig.toml` — append the name to `ModulesCSV=…` (manual-deploy override; keep in sync with the workflow). +4. `template.yaml` — append to the `ModulesCSV` `Default` (documents the full set). +5. `aws/telegram-commands.json` — add each new command + description for the Telegram menu. + +When **adding a command to an existing, already-enabled module**, only step 5 applies. + +**On push to `main`:** CI redeploys and re-runs `setMyCommands` from +`aws/telegram-commands.json` automatically. The Telegram client caches the command +menu, so a changed menu may not show until the chat is reopened — confirm with +`make telegram-commands-info` (calls `getMyCommands`) rather than trusting the app UI. +Only when a push introduces **new public commands** (`VisibilityPublic`) does the menu +need attention — re-confirm registration for those pushes; routine pushes (refactors, +fixes, non-public commands) need no menu action. + ## Trading income events API `/trade_income_events` uses a FireAnt REST API, configured at Lambda runtime: diff --git a/samconfig.toml b/samconfig.toml index 4cb583d..771ded8 100644 --- a/samconfig.toml +++ b/samconfig.toml @@ -13,7 +13,7 @@ resolve_s3 = true s3_prefix = "miti99bot" # Secrets MUST live in SSM Parameter Store (see aws/README.md). Never put # them here — this file is committed. -parameter_overrides = "StackEnv=\"prod\" ModulesCSV=\"util,misc,wordle,loldle,lolschedule,twentyq,trading,stats,gold\" BotOwnerID=\"1064111334\" AdminUserIDs=\"1064111334\" LambdaAdapterLayerArn=\"arn:aws:lambda:ap-southeast-1:753240598075:layer:LambdaAdapterLayerArm64:25\" AlertEmail=\"minhtienit99@gmail.com\"" +parameter_overrides = "StackEnv=\"prod\" ModulesCSV=\"util,misc,wordle,loldle,lolschedule,twentyq,trading,stats,gold,coin\" BotOwnerID=\"1064111334\" AdminUserIDs=\"1064111334\" LambdaAdapterLayerArn=\"arn:aws:lambda:ap-southeast-1:753240598075:layer:LambdaAdapterLayerArm64:25\" AlertEmail=\"minhtienit99@gmail.com\"" image_repositories = [] [default.validate.parameters]