Skip to content

Fix expired pause count in status - #5

Merged
AliZakaee merged 1 commit into
mainfrom
automation/maintenance-20260809-evening-active-pause-count
Aug 9, 2026
Merged

AliZakaee merged 1 commit into
mainfrom
automation/maintenance-20260809-evening-active-pause-count

Conversation

@AliZakaee

Copy link
Copy Markdown
Owner

Summary

  • Exclude expired timed pauses from the aggregate pause list used by /status.
  • Add a regression test covering an expired rate-limit pause alongside an indefinite manual pause.
  • Preserve the existing lazy deletion path: status reads filter expired rows without mutating persistence.

Why this is meaningful

Timed owner-takeover and rate-limit pauses remain stored until that customer chat is checked again. The status path counted every stored row, so an already resumed chat could still appear in the owner's paused-chat total. Filtering through the same expiry helper used by enforcement makes operational status match actual reply behavior while preserving indefinite pauses and conservative handling of malformed timestamps.

Validation

  • Baseline: .venv/bin/python -m pytest — 278 passed.
  • Reproduction before fix: .venv/bin/python -m pytest tests/unit/test_database_dal.py::test_list_active_pauses_excludes_expired_deadlines -q — failed as expected ([5, 6] included the expired chat instead of [6]).
  • Targeted after fix: .venv/bin/python -m pytest tests/unit/test_database_dal.py::test_list_active_pauses_excludes_expired_deadlines tests/unit/services/test_business_service.py -q — 14 passed.
  • Full suite after fix: .venv/bin/python -m pytest — 279 passed.
  • CI-equivalent coverage: .venv/bin/python -m pytest --cov=. --cov-report=term-missing --cov-report=xml --cov-report=html --junitxml=junit.xml — 279 passed, 60% total coverage.
  • Syntax: .venv/bin/python -m compileall -q . — passed.
  • Diff hygiene: git diff --check origin/main...HEAD — passed.

Risk and rollback

Risk is low: the production caller only uses the list length, no schema or write path changes, indefinite and unexpired pauses remain included, and malformed deadlines remain conservatively active through utils.is_expired. Roll back by reverting commit 578f8418f97af97bc8eccfd1409ae37098b924ef.

Prepared with automated assistance by EQ for AliZakaee.

@AliZakaee
AliZakaee merged commit ed1c0a9 into main Aug 9, 2026
7 checks passed
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