Files
co-lite/openspec/changes/polish-e2e-followups/design.md
T

4.2 KiB

Context

These come from the owner's e2e of 2026-12-02 and the owner's answers on the same day. The codebase facts:

  • Admin password rules:
    • They live in service-system.system_property, type ADMIN_PWD_FORMAT, with status Y/N and a value.
    • UserController.adminPasswordRuleFailures checks them, and is called through /user/validatePasswordFromRulesForAdmin.
    • The portal hint is the fixed key AdminPasswordHint.
  • The symbol rule shows a value of 3, but it is switched off. That is why passwords without symbols were accepted, which is correct.
  • Interests (service-counter.interest) have an active flag. Roles (service-system.role) have no status column.
  • Dashboard: the "Won in period" count and the funnel already behave as the lead-dashboard spec says. Only the labels mislead.
  • Listings: DataTable (app/components/ui/data-table.tsx) backs Users, Leads, Events, Interests, Roles, Emails, Audit log, Companies and Login security. Event leads already has its own phone cards.

Goals / Non-Goals

Goals: the spec deltas.

Non-goals:

  • hard delete;
  • restoring deleted records from the UI;
  • per-company password rules;
  • translations (a separate change);
  • changing attendance or guest removal rules.

Decisions

  1. Empty-company hint.
    • When the login fails and the company field was empty, the page shows the invalid-credentials message plus "Staff sign in with their company code."
    • The hint is chosen in the portal from the form state alone, not from the server's answer, so it cannot reveal whether a username exists.
  2. Password hint from rules.
    • mobile-api reads the switched-on rules from the system service:
      • GET /api/admin/password-rules/active, for signed-in admins;
      • GET /api/public/password-rules, for the reset-password page, which is reached by email link with no session. The rule set is not secret; it is what the hint shows anyway.
    • Both return [{param, value}] for status Y rules only.
    • The portal builds the sentence from message keys PwdHint_<param> with {n}.
    • A refused password returns PASSWORD_RULE with the failing param and value in the ProblemDetail, so the form names the rule.
  3. Soft delete.
    • The column is deleted_at datetime NULL.
    • The list endpoints, pickers, capture forms and filters exclude deleted rows.
    • Existing leads keep showing a deleted interest's name, because history must not change. The same applies to the audit log and to role names in past records.
    • The name stays reserved: the unique key is unchanged, and adding a deleted name is refused with "This name belongs to a deleted interest/role".
    • Role delete is refused with 409 ROLE_IN_USE while any user (enabled or not) holds the role.
    • Delete is super admin only, like the other writes, is audited, and needs a confirm dialog.
  4. Dashboard explanations. The KPI tile and the funnel each get a one-line description under the title. This uses the existing tile subtitle style, or a muted line if none exists. No tooltip, because a tooltip is hidden on phones.
  5. Phone cards in DataTable.
    • Below md, DataTable renders a list of cards instead of the table.
    • Each card shows the first column as its title. The other visible columns are label/value rows, with the label from the column header.
    • Action cells (meta actions: true or an existing actions column marker) go in the card footer.
    • Sorting stays reachable through a small "Sort by" select above the cards when columns are sortable.
    • Pagination is shared.
    • Pages with custom phone cards (event leads) keep them.
    • The scroll cue requirement still holds above md.

Risks / Trade-offs

  • Generic cards are plainer than hand-made ones. That is acceptable for admin lists, and a page can still opt into a custom card later.
  • The public rules endpoint lets anyone read the password policy. That is low risk, because the policy is shown on the page anyway. It gets the per-IP limit used by the other public routes.

Migration Plan

  1. Run sql/01-soft-delete.sql, which adds the two nullable columns and is additive.
  2. Deploy system, counter, mobile-api and the portal.

Rollback: sql/99-rollback.sql drops the columns. Redeploy the previous images.