From d3841b7f66b722b3325e4cc7b4af3efce5c696da Mon Sep 17 00:00:00 2001 From: dhonitheja Date: Sun, 22 Nov 2026 16:58:30 -0600 Subject: [PATCH] Dashboard: tables fit a phone screen and are keyboard-reachable Browser QA at 375px found every table had a 520px minimum width, which scrolled the Failed/Unverified counts and the findings Count column out of view. Only the five-column "Latest problems" table keeps a minimum width; action names wrap after each dot; headers and verdict badges stay on one line. Each table's scroll area is now a focusable, labelled region with a visible focus outline, headers carry scope="col", and tables are labelled by their headings. A test pins all of this and fails on the previous markup. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 14 ++++++++++++++ CLAUDE.md | 2 +- README.md | 4 ++-- agent_readback/dashboard.py | 34 ++++++++++++++++++++++++++-------- tests/test_evidence_and_cli.py | 27 +++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5de10f..bf119b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to `agent-readback`. Dates are UTC. +## Unreleased + +### Fixed + +- `readback dashboard` on a phone: every table had a 520px minimum width, so + at 375px the Failed and Unverified counts and the findings Count column were + scrolled out of view. Only the five-column "Latest problems" table keeps a + minimum width now; the others fit, action names wrap after each dot, and + headers and verdict badges no longer break mid-word. +- Dashboard accessibility: each table's scroll area is focusable + (`tabindex="0"`), is a labelled region named by its heading, and has a + visible focus outline, so keyboard users can scroll it in any browser. + Column headers carry `scope="col"` and each table is labelled by its heading. + ## 0.3.1 — 2026-11-22 ### Fixed diff --git a/CLAUDE.md b/CLAUDE.md index 5d9d110..5319569 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -42,5 +42,5 @@ python -m pip install -e ".[security]" && python -m bandit -r agent_readback exa - All HTTP goes through an injected `httpx.Client`; tests swap in `httpx.MockTransport`. Keep new verifiers and providers injectable the same way. - New verifier: implement `snapshot`/`check` per `core.Verifier`, name actions `..`, export from `verifiers/__init__.py`, update the README verifier table. - The verifier must use credentials the agent doesn't hold; a shared write path makes the check meaningless. -- The README's "What is tested and what is not" and "Security model" tables are kept honest. Update them (and the test count, currently 199, of which 1 skips on Windows without symlink privileges) when coverage or guarantees change. +- The README's "What is tested and what is not" and "Security model" tables are kept honest. Update them (and the test count, currently 200, of which 1 skips on Windows without symlink privileges) when coverage or guarantees change. - Security changes need a test that demonstrates the attack failing (see `test_keyed_log_detects_a_chain_forged_without_the_key`), not just the happy path. diff --git a/README.md b/README.md index 2343de3..fd3f4c9 100644 --- a/README.md +++ b/README.md @@ -344,8 +344,8 @@ external security or compliance review has been done. ## What is tested and what is not -Version 0.3.1. The suite has 199 offline tests; with the optional test dependencies -installed, 198 pass on Windows and the symlink test is skipped there without symlink privileges; elsewhere it runs too. A separate public HAPI FHIR R4 sandbox run verified 10 scripted +Version 0.3.1. The suite has 200 offline tests; with the optional test dependencies +installed, 199 pass on Windows and the symlink test is skipped there without symlink privileges; elsewhere it runs too. A separate public HAPI FHIR R4 sandbox run verified 10 scripted operations (6 bookings, 1 reschedule, 3 cancellations); this is a compatibility smoke test, not production validation. A Stripe test-mode run produced the expected verdict for all four refund scenarios, using a separate diff --git a/agent_readback/dashboard.py b/agent_readback/dashboard.py index 5153398..c08a9b9 100644 --- a/agent_readback/dashboard.py +++ b/agent_readback/dashboard.py @@ -15,9 +15,11 @@ .sub{color:var(--mut);margin:0 0 22px}.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px} .tile{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:14px 16px}.tile b{display:block;font-size:28px;line-height:1.1;font-variant-numeric:tabular-nums} .tile span{color:var(--mut);font-size:13px}.ok b{color:var(--ok)}.bad b{color:var(--bad)}.warn b{color:var(--warn)} -.wrap{overflow-x:auto;border:1px solid var(--line);border-radius:10px;background:var(--card)}table{border-collapse:collapse;width:100%;min-width:520px} -th,td{text-align:left;padding:9px 14px;border-bottom:1px solid var(--line);font-variant-numeric:tabular-nums;vertical-align:top}th{font-size:12px;color:var(--mut);font-weight:600} -tr:last-child td{border-bottom:0}code{font:13px ui-monospace,Menlo,Consolas,monospace}.pill{display:inline-block;border-radius:99px;padding:1px 9px;font-size:12px;border:1px solid currentColor} +.wrap{overflow-x:auto;border:1px solid var(--line);border-radius:10px;background:var(--card)}.wrap:focus-visible{outline:2px solid var(--fg);outline-offset:2px} +table{border-collapse:collapse;width:100%}table.wide{min-width:560px} +th,td{text-align:left;padding:9px 14px;border-bottom:1px solid var(--line);font-variant-numeric:tabular-nums;vertical-align:top;overflow-wrap:anywhere}th{font-size:12px;color:var(--mut);font-weight:600;white-space:nowrap;overflow-wrap:normal} +tr:last-child td{border-bottom:0}code{font:13px ui-monospace,Menlo,Consolas,monospace} +@media (max-width:480px){th,td{padding:8px 8px}}.pill{display:inline-block;border-radius:99px;padding:1px 9px;font-size:12px;border:1px solid currentColor;white-space:nowrap;overflow-wrap:normal} .chain{margin-top:22px;font-size:13px;color:var(--mut)} """ @@ -26,6 +28,22 @@ def _tile(css: str, value: str, label: str) -> str: return f'
{escape(value)}{escape(label)}
' +def _breakable(action: str) -> str: + """Escape an action name and let it wrap after each dot, not mid-word, on narrow screens.""" + return escape(action).replace(".", ".") + + +def _table(key: str, heading: str, columns: tuple[str, ...], rows: str, wide: bool = False) -> str: + # The scroll box is focusable and named by its heading, so keyboard users can scroll it in any browser. + # Only the wide table keeps a minimum width; the narrow ones fit a phone screen without scrolling. + head = "".join(f'{escape(c)}' for c in columns) + return ( + f'

{escape(heading)}

' + f'
' + f'{head}{rows}
' + ) + + def render_html( records: list[dict[str, Any]], chain_intact: bool, title: str = "Readback report", unkeyed: bool = False, ) -> str: @@ -39,7 +57,7 @@ def render_html( ] ) action_rows = "".join( - f"{escape(action)}{counts.get('verified', 0)}" + f"{_breakable(action)}{counts.get('verified', 0)}" f"{counts.get('failed', 0)}{counts.get('unverified', 0)}" for action, counts in summary["by_action"].items() ) @@ -51,7 +69,7 @@ def render_html( problem_rows = "".join( "{when}{action}{status}{why}{ctx}".format( when=escape(body["checked_at"][:19].replace("T", " ")), - action=escape(body["claim"]["action"]), + action=_breakable(body["claim"]["action"]), tone="bad" if body["status"] == "failed" else "warn", status=escape(body["status"]), why=escape(", ".join(f["kind"].replace("_", " ") + (f" ({f['field']})" if f.get("field") else "") for f in body["findings"])), @@ -67,9 +85,9 @@ def render_html( {escape(title)}

{escape(title)}

What the agent claimed, checked against the system of record.

{tiles}
-

By action

{action_rows}
ActionVerifiedFailedUnverified
-

Why claims failed

{finding_rows}
FindingCount
-

Latest problems

{problem_rows}
Checked (UTC)ActionVerdictFindingsContext
+{_table("actions", "By action", ("Action", "Verified", "Failed", "Unverified"), action_rows)} +{_table("findings", "Why claims failed", ("Finding", "Count"), finding_rows)} +{_table("problems", "Latest problems", ("Checked (UTC)", "Action", "Verdict", "Findings", "Context"), problem_rows, wide=True)}

Evidence chain: {escape(chain)}. {len(records)} records.

""" diff --git a/tests/test_evidence_and_cli.py b/tests/test_evidence_and_cli.py index 95e59a9..453d256 100644 --- a/tests/test_evidence_and_cli.py +++ b/tests/test_evidence_and_cli.py @@ -165,6 +165,33 @@ def test_dashboard_page_is_redacted_and_escapes_hostile_context(tmp_path): assert "