Skip to content

[REFACTOR] Report uniformity: re-vendor CSS/tokens, slot the last inline-sized figures, fix signed-DMS coordinates - #77

Merged
eleanorfrajka merged 4 commits into
mainfrom
rep/04-uniform-fixes-2
Aug 16, 2026
Merged

[REFACTOR] Report uniformity: re-vendor CSS/tokens, slot the last inline-sized figures, fix signed-DMS coordinates#77
eleanorfrajka merged 4 commits into
mainfrom
rep/04-uniform-fixes-2

Conversation

@eleanorfrajka

Copy link
Copy Markdown
Collaborator

Summary

Continues the report-subsystem uniformity work (follows #75 and #76). Three things land here: the shared report chrome (stylesheet + design tokens) is re-vendored byte-identical to the sister ctdcast repo and the last two inline-sized figures move onto the slot system; the emit_css accent API is inverted so the vendored files name no package; and a signed-DMS coordinate-parsing bug that was corrupting mooring positions is fixed.

Shared chrome re-vendored + remaining figures slotted

The vendored reports/_css.py and config/report_tokens.py are now byte-identical to ctdcast's copies. This brings the canonical table style (driven by --package-accent), the radius tokens, the .caption/.explainer/.warn prose classes, print_css(), and the quarter slot (W_QUARTER = 2.25).

Downstream follow-ups so the pages match the re-vendored files:

  • 39 class="note" renamed to class="caption" across five page templates.

  • Per-page table CSS removed from array, grid, instrument, mooring, and stack templates — the table style is canonical in emit_css now. The dense print-oriented recovery table keeps its specialized style.

  • The knockdown displacement figure (slot="full") and the instrument speed boxplot (slot="quarter") move from inline style="max-width:…" onto the slot system, so a figure can no longer render at one width while the page displays it at another. The .fig:not([class*="slot-"]) rule keeps a slotted figure from being forced to full width.

Package-neutral emit_css

The per-package accent no longer lives in the vendored files. PACKAGE_ACCENT is removed from report_tokens.py, and emit_css(package: str) (which looked a colour up in that dict) becomes emit_css(package_accent: str) (it takes the colour value directly). Each package now applies its own accent in a local reports/_report_css.py, so the vendored _css.py carries no package-specific edit and re-vendoring it is a byte-identical copy. oceanarray's accent is var(--ocean) (= #1a3a5c), so rendered pages are pixel-identical; the only golden change is the single --package-accent line switching from the hex literal to var(--ocean).

Fix: signed-DMS coordinate parsing (was corrupting mooring positions)

_dms_to_deg mis-parsed a signed "DD MM.mmm" value: the minus on the degrees field did not propagate to the minutes, so "-27 48.000" parsed as -27 + 48/60 = -26.2 instead of -(27 + 48/60) = -27.8 — a ~1.6° error. This flows through parse_latlon into the grid report's latitude-dependent science panels, so it is a data-provenance bug, not just a display glitch. The dune2 fixture's latitude is unsigned, which is why it went unnoticed; its longitude was already wrong. The fix signs the whole magnitude, and _dms_to_deg — previously untested — now has coverage for signed DMS, hemisphere-suffixed, and plain-float inputs.

Separately, the recovery table hardcoded N/ W suffixes and did not parse DMS at all, emitting the malformed "-27 48.000 W". It now routes through parse_latlon_with_source plus a new format_latlon() helper that derives the hemisphere from the sign, so a value can never carry both a minus sign and a hemisphere letter. Recovery-table coordinates now render as e.g. "65.7319° N" / "27.8000° W".

Tests

All pass (773). The golden HTML net (masks figure pixels, compares structure/CSS/text) is re-baselined twice on this branch — once for the table/caption/slot changes, once for the one-line --package-accent switch — both reviewed. New unit tests cover _dms_to_deg, format_latlon, and the quarter slot geometry (with a ±1px tolerance for the 2.25 × 150 = 337.5 half-pixel).

Breaking changes

  • emit_css signature and semantics. emit_css(package: str)emit_css(package_accent: str). It no longer looks a name up in a table; it takes the accent colour value. Migration: call emit_css("<css-colour>") (e.g. emit_css("var(--ocean)")) instead of emit_css("oceanarray"). In-repo callers are updated; this matters to anyone vendoring reports/_css.py.

  • report_tokens.PACKAGE_ACCENT removed. The per-package accent dict no longer exists in the vendored tokens. Migration: choose the accent in the package's local reports/_report_css.py and pass it to emit_css.

  • Signed-DMS parse result changed (bug fix). Any mooring config expressing a coordinate as signed "DD MM.mmm" (e.g. "-27 48.000") now resolves to a different, correct decimal-degree value. Outputs derived from those coordinates (recovery table, grid latitude-dependent panels) change accordingly. No action needed beyond re-running affected reports.

  • Recovery-table coordinate display format changed. From the raw config string with a hardcoded suffix ("65 43.913 N") to hemisphere-from-sign decimal degrees ("65.7319° N").

eleanorfrajka and others added 4 commits August 16, 2026 07:17
ctdcast inverted the emit_css API so the vendored files name no package: the
PACKAGE_ACCENT dict is gone from report_tokens.py, and emit_css(package: str)
became emit_css(package_accent: str) — it takes the accent colour value rather
than looking one up. Re-vendor both files byte-identical to ctdcast.

Move oceanarray's accent choice into a new local reports/_report_css.py (the
package-specific wiring the vendored _css.py deliberately omits), and point
_env.py at its SHARED_CSS. The accent is var(--ocean) (= #1a3a5c), so the
rendered pages are pixel-identical; the golden re-baseline is the single
--package-accent line changing from the hex literal to var(--ocean).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@eleanorfrajka
eleanorfrajka merged commit 888cad2 into main Aug 16, 2026
5 checks passed
@eleanorfrajka
eleanorfrajka deleted the rep/04-uniform-fixes-2 branch August 16, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant