Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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 - Semantic HTML Updates require CSS Maintenance
**Learning:** Changing a structural HTML tag (like swapping `<td>` for `<th scope="row">` in the table body) for accessibility reasons can break the design if the project's CSS specifically scoped its styles to the old tag. The new semantic element will revert to browser defaults, creating a visual regression.
**Action:** When altering HTML tags for accessibility, always update existing CSS rules that specifically styled the old tags to include the new ones (e.g., updating `td { ... }` to `td, tbody th { ... }`) to prevent introducing visual regressions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

### Changed

- Improved generated report table accessibility: the first identifying column
of each data row now renders as `<th scope="row">` for screen-reader grid
navigation, with matching CSS updates (header styles scoped to `thead th`,
normal-weight `tbody th`, and `font-variant-numeric: tabular-nums` for
aligned numeric columns).

- Exposed the Rust MMLE-EM estimator (`mlsirm_core::mmle::fit_mmle_2pl`) through
the PyO3 binding as `fast_mlsirm._core.fit_mmle_2pl`, so
`fit(estimator="mmle")` now runs on the Rust core when the extension is built
Expand Down
19 changes: 14 additions & 5 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"<td>{escape(_format_value(row.get(column, '')))}</td>"
for column in columns
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 i, column in enumerate(columns)
Comment thread
seonghobae marked this conversation as resolved.
Resolved
)
body_rows.append(f"<tr>{cells}</tr>")

Expand Down Expand Up @@ -680,20 +682,27 @@ def _css() -> str:
}

th,
td {
td,
tbody th {
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;
}
Comment thread
seonghobae marked this conversation as resolved.
Resolved

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

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

Expand Down
Loading