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
4 changes: 4 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@
## 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.

## 2024-07-14 - Table Accessibility and Tabular Numbers
**Learning:** Data-heavy HTML tables (like fit diagnostics) present numbers that are hard to compare visually if they are not vertically aligned. Additionally, screen readers need row headers (`<th scope="row">`) to accurately announce data context when moving horizontally across a row. Modifying cell types requires cascading those changes to CSS selectors (`thead th, tbody th, td`) to avoid breaking base styles.
**Action:** Always use `<th scope="row">` for the first identifying column in HTML tables and apply `font-variant-numeric: tabular-nums;` across all table cells to guarantee readable alignment and standard accessibility. Explicitly update shared table cell CSS selectors when introducing new tag types to prevent visual regressions.
Comment on lines +23 to +25
14 changes: 11 additions & 3 deletions python/fast_mlsirm/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,10 @@ def _table(rows: list[dict[str, Any]], *, label: str, limit: int = 12) -> str:
body_rows = []
for row in rows[:limit]:
cells = "".join(
f'<th scope="row">{escape(_format_value(row.get(column, "")))}</th>'
if i == 0 else
f"<td>{escape(_format_value(row.get(column, '')))}</td>"
for column in columns
for i, column in enumerate(columns)
)
body_rows.append(f"<tr>{cells}</tr>")

Expand Down Expand Up @@ -679,20 +681,26 @@ def _css() -> str:
border: 0;
}

th,
thead th,
tbody th,
td {
padding: 10px 12px;
text-align: left;
border-bottom: 1px solid var(--line);
white-space: nowrap;
font-variant-numeric: tabular-nums;
}

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

tbody th {
font-weight: normal;
}

tr:last-child td {
border-bottom: 0;
}
Comment on lines 704 to 706
Expand Down
Loading