Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
## 2024-07-13 - CLI Debugging Stack Traces
**Learning:** Adding a `FAST_MLSIRM_DEBUG` bypass to user-friendly `try/except` blocks is crucial for DX. Otherwise, unexpected runtime errors during development will be swallowed into generic stderr messages, hiding the stack trace needed to actually fix the bug.
**Action:** When adding `try-except` blocks to Python CLI subcommands to improve Developer Experience (DX) by preventing raw tracebacks for users, include a debug bypass (e.g., `if os.environ.get("FAST_MLSIRM_DEBUG"): raise`) in *all* catch blocks (including `RuntimeError` and `Exception`) to ensure tracebacks aren't swallowed during local development and debugging.
## 2026-07-18 - Improve Table Accessibility and Alignment
**Learning:** When generating HTML data tables, using `<th scope="row">` for the first identifying column improves screen reader accessibility. Additionally, applying `font-variant-numeric: tabular-nums;` to table cells ensures numbers align properly in columns.
**Action:** Use `<th scope="row">` for row headers and `font-variant-numeric: tabular-nums` for numeric data cells in tabular data representations.
25 changes: 19 additions & 6 deletions python/fast_mlsirm/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,13 @@ def _table(rows: list[dict[str, Any]], *, label: str, limit: int = 12) -> str:
columns = _columns(rows)
body_rows = []
for row in rows[:limit]:
cells = "".join(
f"<td>{escape(_format_value(row.get(column, '')))}</td>"
for column in columns
)
cells = ""
for i, column in enumerate(columns):
val = escape(_format_value(row.get(column, "")))
if i == 0:
cells += f'<th scope="row">{val}</th>'
else:
cells += f"<td>{val}</td>"
body_rows.append(f"<tr>{cells}</tr>")

note = ""
Expand Down Expand Up @@ -687,13 +690,23 @@ def _css() -> str:
white-space: nowrap;
}

th {
td,
tbody th {
font-variant-numeric: tabular-nums;
}

thead th {
background: #f1f4ef;
color: #2f3437;
font-size: 0.8rem;
}

tr:last-child td {
tbody th {
font-weight: normal;
}

tr:last-child td,
tr:last-child th {
border-bottom: 0;
}

Expand Down
Loading