Repository navigation
Rich tables for /status, slimmer /trusted table, WIB dates - #46
Merged
Merged
Conversation
/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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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). Anysend_rich_messagefailure 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.WIBsingle 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).test_properties.py::TestFormatPerson::test_with_username_formatcould fail when Hypothesis generatedname='(@'— the property assumed the(@sentinel only comes from the username suffix. Fixed withassume('(@' not in name); the code was correct.Notes
DatabaseService.add_trusted_userignores an explicitly passedtrusted_at(always stamps now). Left as-is; flagging in case it's ever wanted.