Skip to content

Rich tables for /status, slimmer /trusted table, WIB dates - #46

Merged
rezhajulio merged 2 commits into
rezhajulio:mainfrom
TayoBus:rich/dm-status
Oct 8, 2026
Merged

rezhajulio merged 2 commits into
rezhajulio:mainfrom
TayoBus:rich/dm-status

Conversation

@TayoBus

@TayoBus TayoBus commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #44, extending the rich-text DM admin pattern:

/status → rich table. The DM-only operational summary now renders as a native rich message: per-group <table bordered striped> (Grup | Penegakan | Captcha | Probation | Pending | Nonaktif, scoped to the caller's admin groups exactly as before) plus a key-value section (Uptime, Database, Refresh admin, Auto-restrict). Any send_rich_message failure falls back to the byte-identical Markdown message (verified by rendering both from the same dataset and diffing). Prereq branches (non-DM, non-admin) untouched.

/trusted → 3 columns. The 4-column table forced horizontal scrolling. The standalone User ID column is dropped; the numeric ID is folded into the User cell (name + @username, ID below in <code>), keeping it visible and copyable. Markdown fallback untouched.

Dates → WIB. The /trusted Date column and /status job timestamps now render in WIB (Asia/Jakarta) instead of UTC, in both rich output and Markdown fallback (shared display strings via new constants.WIB single source of truth).

/check deliberately stays on Markdown. aiogram 3.31 has no edit-to-rich equivalent, so /check's callback-query edit path (group selector → actions, the primary interactive flow) could never go rich — a rich-then-Markdown flip mid-flow would be worse than consistent Markdown. Its output is also a 4-line card, not data-dense.

Verification

  • uv run pytest: 1279 passed; ruff check . clean; mypy src/bot/ tests/ clean (86 files).
  • New/updated tests: 11 status tests (rich default incl. admin-group scoping, empty-groups, fallback), trust tests updated to 3-column + ID assertions, WIB conversion tests (pinned UTC→WIB).
  • One pre-existing flake fixed along the way: test_properties.py::TestFormatPerson::test_with_username_format could fail when Hypothesis generated name='(@' — the property assumed the (@ sentinel only comes from the username suffix. Fixed with assume('(@' not in name); the code was correct.

Notes

  • /status table has 6 columns but all cells are short (IDs, counts, Ya/—); should fit without scrolling, unlike the old /trusted layout.
  • Minor unrelated finding: DatabaseService.add_trusted_user ignores an explicitly passed trusted_at (always stamps now). Left as-is; flagging in case it's ever wanted.

/status (DM-only admin): render the operational summary as a native
rich message — per-group <table bordered striped> (Grup | Penegakan |
Captcha | Probation | Pending | Nonaktif, scoped to the caller's admin
groups) plus a key-value section (Uptime, Database, Refresh admin,
Auto-restrict). Any send_rich_message failure falls back to the
byte-identical Markdown message (verified empirically against the
pre-change output).

/trusted: drop the standalone User ID column — four columns forced
horizontal scrolling. The numeric ID is folded into the User cell as
name (@username)<br><code>id</code>, keeping it visible and copyable.
Markdown fallback untouched.

Dates: the /trusted Date column and the /status job timestamps now
render in WIB (Asia/Jakarta) instead of UTC, in both the rich output
and the Markdown fallback (shared display strings; new constants.WIB
single source of truth).

/check deliberately stays on Markdown: aiogram 3.31 has no
edit-to-rich equivalent, so its callback-query edit path could never
go rich and a rich-then-Markdown flip mid-flow would be worse than
consistent Markdown.
…operty

test_with_username_format asserts '(@' appears only via the username
suffix, but the name strategy allows punctuation, so Hypothesis can
generate name='(@' and fail the property through no fault of the code.
assume('(@' not in name) keeps the property's intent (username suffix
logic) while excluding the degenerate input. Pre-existing flake,
unrelated to the rich-text work.
@rezhajulio
rezhajulio merged commit 1ba5d89 into rezhajulio:main Oct 8, 2026
6 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.

2 participants