Skip to content

fix(quiz): persist on-demand poll records#76

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-inspection-b1c6
Draft

fix(quiz): persist on-demand poll records#76
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-inspection-b1c6

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented May 2, 2026

πŸ“ Description

What:

  • Persist /genquiz on-demand quiz poll metadata after Telegram successfully returns a poll id.
  • Store on-demand quiz records under a poll-specific sort key to avoid overwriting the daily quiz row.
  • Add regression coverage for the on-demand quiz success path.

Why:

  • Without a saved quiz record, bot poll_answer handling cannot resolve the poll id and silently ignores answers, causing score/streak data loss for on-demand quizzes.

Verification:

  • python3 -m pytest tests/test_quiz_service.py tests/test_webhook_poll_answer.py tests/test_quiz_streak.py
  • python3 -m pytest

πŸš€ Type of Change

  • πŸ› Bug Fix (Fix an issue)
  • ✨ New Feature (Add a new feature)
  • πŸ—οΈ Infrastructure (CDK/AWS resource changes)
  • ♻️ Refactoring (Code refactoring, no logic changes)
  • πŸ“š Documentation (Documentation update)

πŸ—οΈ Infrastructure Changes (Crucial)

  • Resources Created: None
  • Resources Modified: None
  • Resources Deleted: None
  • Cost Impact: None

βœ… Checklist

  • I have performed a self-review of my code.
  • I have run pre-commit run --all-files locally and fixed all issues.
  • I have added/updated Unit Tests (pytest).
  • My changes do not generate new warnings.
  • (If Infra change) I have run cdk diff locally to verify changes.

πŸ”— Related Issues

Open in WebΒ View AutomationΒ 

cursoragent and others added 2 commits May 2, 2026 05:05
Co-authored-by: Bayashat <baiashat2002@gmail.com>
Co-authored-by: Bayashat <baiashat2002@gmail.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

πŸ“Š Infrastructure Changes Preview (Zerde Telegram Bot)

This PR will modify the following AWS resources:

ℹ️ No infrastructure changes detected

This PR only contains code changes (Lambda functions, etc.)

πŸ“‹ Full CDK Diff Output
b'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'
b'!!                                                                                                                   !!\n'
b'!!  Node 20 has reached end-of-life on 2026-04-30 and will no longer be supported in new releases after 2026-10-30.  !!\n'
b'!!  Please upgrade to a supported node version as soon as possible.                                                  !!\n'
b'!!                                                                                                                   !!\n'
b'!!  This software is currently running on node v20.20.0.                                                             !!\n'
b'!!  As of the current release of this software, supported node releases are:                                         !!\n'
b'!!  - ^24.0.0 (Planned end-of-life: 2028-04-30)                                                                      !!\n'
b'!!  - ^22.0.0 (Planned end-of-life: 2027-04-30)                                                                      !!\n'
b'!!  - ^20.0.0 (Planned end-of-life: 2026-04-30) [DEPRECATED]                                                         !!\n'
b'!!                                                                                                                   !!\n'
b'!!  This warning can be silenced by setting the JSII_SILENCE_WARNING_DEPRECATED_NODE_VERSION environment variable.   !!\n'
b'!!                                                                                                                   !!\n'
b'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.82kB done
#1 DONE 0.0s

#2 [internal] load metadata for public.ecr.aws/sam/build-python3.13:latest
#2 DONE 0.1s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [1/2] FROM public.ecr.aws/sam/build-python3.13:latest@sha256:be015b4dbfce398c76feb589c307073a48aed25b6accee4db41a481b78a490d2
#4 DONE 0.0s

#5 [2/2] RUN     python -m venv /usr/app/venv &&     mkdir /tmp/pip-cache &&     chmod -R 777 /tmp/pip-cache &&     pip install --upgrade pip &&     mkdir /tmp/poetry-cache &&     chmod -R 777 /tmp/poetry-cache &&     mkdir /tmp/uv-cache &&     chmod -R 777 /tmp/uv-cache &&     pip install pipenv==2022.4.8 poetry==1.5.1 uv==0.6.9 &&     rm -rf /tmp/pip-cache/* /tmp/poetry-cache/* /tmp/uv-cache/*
#5 CACHED

#6 exporting to image
#6 exporting layers done
#6 writing image sha256:d3f999b8f83fd6c4f1224858b6d25f85de9c8fc135773dfba4158f7dec1dd0e4 done
#6 naming to docker.io/library/cdk-acc063e5c633aa0cdd99b8c074ed11ce1a8a330da90f18f9f4f3f8758e57b403 done
#6 DONE 0.0s
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.82kB done
#1 DONE 0.0s

#2 [internal] load metadata for public.ecr.aws/sam/build-python3.13:latest
#2 DONE 0.1s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [1/2] FROM public.ecr.aws/sam/build-python3.13:latest@sha256:be015b4dbfce398c76feb589c307073a48aed25b6accee4db41a481b78a490d2
#4 DONE 0.0s

#5 [2/2] RUN     python -m venv /usr/app/venv &&     mkdir /tmp/pip-cache &&     chmod -R 777 /tmp/pip-cache &&     pip install --upgrade pip &&     mkdir /tmp/poetry-cache &&     chmod -R 777 /tmp/poetry-cache &&     mkdir /tmp/uv-cache &&     chmod -R 777 /tmp/uv-cache &&     pip install pipenv==2022.4.8 poetry==1.5.1 uv==0.6.9 &&     rm -rf /tmp/pip-cache/* /tmp/poetry-cache/* /tmp/uv-cache/*
#5 CACHED

#6 exporting to image
#6 exporting layers done
#6 writing image sha256:d3f999b8f83fd6c4f1224858b6d25f85de9c8fc135773dfba4158f7dec1dd0e4 done
#6 naming to docker.io/library/cdk-acc063e5c633aa0cdd99b8c074ed11ce1a8a330da90f18f9f4f3f8758e57b403 done
#6 DONE 0.0s
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.82kB done
#1 DONE 0.0s

#2 [internal] load metadata for public.ecr.aws/sam/build-python3.13:latest
#2 DONE 0.1s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [1/2] FROM public.ecr.aws/sam/build-python3.13:latest@sha256:be015b4dbfce398c76feb589c307073a48aed25b6accee4db41a481b78a490d2
#4 DONE 0.0s

#5 [2/2] RUN     python -m venv /usr/app/venv &&     mkdir /tmp/pip-cache &&     chmod -R 777 /tmp/pip-cache &&     pip install --upgrade pip &&     mkdir /tmp/poetry-cache &&     chmod -R 777 /tmp/poetry-cache &&     mkdir /tmp/uv-cache &&     chmod -R 777 /tmp/uv-cache &&     pip install pipenv==2022.4.8 poetry==1.5.1 uv==0.6.9 &&     rm -rf /tmp/pip-cache/* /tmp/poetry-cache/* /tmp/uv-cache/*
#5 CACHED

#6 exporting to image
#6 exporting layers done
#6 writing image sha256:d3f999b8f83fd6c4f1224858b6d25f85de9c8fc135773dfba4158f7dec1dd0e4 done
#6 naming to docker.io/library/cdk-acc063e5c633aa0cdd99b8c074ed11ce1a8a330da90f18f9f4f3f8758e57b403 done
#6 DONE 0.0s
start: Building zerde-serverless-telegram-bot-dev Template
success: Built zerde-serverless-telegram-bot-dev Template
start: Publishing zerde-serverless-telegram-bot-dev Template (current_account-current_region-8bc635fe)
success: Published zerde-serverless-telegram-bot-dev Template (current_account-current_region-8bc635fe)
Hold on while we create a read-only change set to get a diff with accurate replacement information (use --method=template to use a less accurate but faster template-only diff)

Stack ZerdeServerlessTelegramBotStack-dev (zerde-serverless-telegram-bot-dev)
Resources
[~] AWS::Lambda::Function ZerdeServerlessBot/ZerdeServerlessBotLambda ZerdeServerlessBotZerdeServerlessBotLambdaA4D02A14
 β”œβ”€ [~] Code
 β”‚   └─ [~] .S3Key:
 β”‚       β”œβ”€ [-] df87ab2e1e02879d3be2c59b3598082f9e21c7b1efa245cdbe230096d7d9e4fb.zip
 β”‚       └─ [+] f064578e11f3bc7623c92c55a25331c43258a6c657cc463f3f66f72201e8c091.zip
 └─ [~] Environment
     └─ [~] .Variables:
         └─ [~] .CHAT_LANG_MAP:
             β”œβ”€ [-] {"-1001450935528": "kk", "-1001244628965": "kk", "-1003930600007": "zh", "-1002211083217": "zh", "-1002914248981": "ru"}
             └─ [+] {"-1001244628965": "kk", "-1001450935528": "kk", "-1002211083217": "zh", "-1003930600007": "zh", "-1002914248981": "ru"}
[~] AWS::Lambda::Function ZerdeServerlessQuiz/ZerdeServerlessQuizLambda ZerdeServerlessQuizZerdeServerlessQuizLambda4D9EA339
 └─ [~] Code
     └─ [~] .S3Key:
         β”œβ”€ [-] d9d7c1ef28c4be304708c4a3e7fae5d324d5b70daf1c3eb4d2355715272c9f83.zip
         └─ [+] db55dc4b650c95dec49f83dff6c981ebe6537315ec0318f6273da54c667277a8.zip



✨  Number of stacks with differences: 1

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