Skip to content

test(webui): rework tests that pin source text and daisyUI-era classes #1139

Done

Description

@jatmn

🤖 Kit (jatmn's assistant agent)

Part of the test-code audit requested on 2026-12-02 (audited main at de66727). This ticket is the rework list: tests that are not worthless but pin implementation details, or are coupled to UI code that #1127 and its children are about to change. Each item should be rewritten to assert behaviour, or deleted if the behaviour is already covered elsewhere. Do these together with, or after, the matching #1127 child so they are touched once.

A. Rust tests that grep production source text (pin implementation, not behaviour)

  • crates/bot/src/member_rejoin/tests.rs: maybe_emit_defers_rejoin_enrichment_to_log_admission, rejected_departure_keeps_rejoin_delivery_guard, guild_member_addition_retries_rejoin_without_double_posting. Each does include_str!("../handlers.rs") / member_rejoin.rs, finds a function name, and checks string order inside a fixed 700 or 900 byte window. Any rename or reformat breaks them; they say nothing about runtime ordering. Replace with a behavioural test through the handler, or delete.
  • crates/bot/src/member_directory.rs: each_ban_path_uses_the_shared_marker_helper (line ~1344). Reads four source files and asserts they contain member_directory::begin_ban_attempt. A lint or a type-level API would be sturdier.
  • crates/runtime/src/cgroup.rs: reader_source_reads_host_memory_only_for_the_v1_limit (line ~2049). Asserts the source does not contain /proc/meminfo or /proc/stat.
  • crates/api/src/web/enrollment_tests.rs (line ~6841): the owner-route registry check scans mod.rs and recovery.rs for .route( strings. Reasonable intent (every owner route is covered), but string-splitting source is brittle. Review, not necessarily delete.

B. Frontend tests coupled to the pre-redesign styling (daisyUI-era classes)

17 tests in scripts/frontend-state-test.mjs select by daisyUI-era class names (.stat, .stat-title, .stat-value, .badge, .card, .btn, .hero). They will break when #1131 (buttons), #1133 (cards), #1134 and the stat/badge cleanup land, even though the behaviour under test is unrelated to styling. Move them to data-testid/role/label selectors, or drop the class assertion:

  • ~1095 dashboard shows the configured and measured stats in one compact grid
  • ~1126 dashboard distinguishes an unset bot nickname from unavailable settings
  • ~1142 dashboard count explainer is an accessible, keyboard-reachable tooltip
  • ~1172 count tooltip stays open while the pointer moves from the trigger onto its text
  • ~1269 analytics opens with a one-line header, range selector and info tip
  • ~2031 / ~2710 / ~2778 / ~2828 Members import tests (.badge, .card)
  • ~4988 desktop sidebar keeps its footer controls in view while a tall page scrolls
  • ~9941 Badwords shows what is handled automatically
  • ~10044 list pages show status, add form, list, then tester or preview
  • ~10293 / ~10324 known spam add tests (.card)
  • ~12758 the Web UI draws SVG icons, never emoji or glyph icons
  • ~13580 a due owner refresh cannot repopulate the cache while sign-out is pending
  • ~14096 Platform analytics shows every metric together with changes, names, icons

C. CSS-parsing tests tied to the files #1127 is merging or deleting

scripts/frontend-contrast-test.mjs (22 tests) reads frontend/style.css and frontend/controls.css and parses rules for .btn, .input, .select, .textarea, .checkbox, .menu button, .stat-value, plus an "analytics/database usage styles stay inside their delimited section" check. Contrast and focus-ring checks are real regressions guards and should stay, but they need to be repointed at the merged theme tokens (#1136) rather than at legacy selectors. Tests to review specifically:

  • "the page uses the scale tokens instead of the old touch-sized values" (line 176, asserts the old scale is absent)
  • "analytics styles stay inside their delimited section" (line 439) and "database usage styles stay inside their delimited section" (line 502): pin file layout, not rendering
  • "compact controls keep a visible focus ring..." (line 186): keep, but selector list is daisyUI-era

D. Tests of a compatibility path with no remaining peer

  • scripts/frontend-state-test.mjs "Platform analytics uses the combined response on a legacy API" (line ~14297) and the legacy branch it drives at frontend/app.js:1763. The Web UI and API ship in the same release; the fallback to a legacy API without include_members is only reachable against an older API build. Approved (3 Dec 2026): current only; no mixed-version window. Remove both the branch and the test.

Activity

  1. jatmn commented on Dec 3, 2026

    @jatmn
    OwnerAuthor

    🤖 Kit (jatmn's assistant agent)

    jatmn decided (3 Dec 2026): everything should be current, not legacy. Remove the Platform analytics legacy API fallback and its test; no mixed-version support window is needed.

  2. jatmn commented on Dec 4, 2026

    @jatmn
    OwnerAuthor

    fix-issue-queue claim 2026-12-04T06:30:21Z 05c9588cffe21ea4

  3. self-assigned this
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions