[REFACTOR] Report uniformity: re-vendor CSS/tokens, slot the last inline-sized figures, fix signed-DMS coordinates - #77
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ctdcastrepo and the last two inline-sized figures move onto the slot system; theemit_cssaccent 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.pyandconfig/report_tokens.pyare now byte-identical to ctdcast's copies. This brings the canonical table style (driven by--package-accent), the radius tokens, the.caption/.explainer/.warnprose classes,print_css(), and thequarterslot (W_QUARTER = 2.25).Downstream follow-ups so the pages match the re-vendored files:
39
class="note"renamed toclass="caption"across five page templates.Per-page table CSS removed from
array,grid,instrument,mooring, andstacktemplates — the table style is canonical inemit_cssnow. 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 inlinestyle="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_cssThe per-package accent no longer lives in the vendored files.
PACKAGE_ACCENTis removed fromreport_tokens.py, andemit_css(package: str)(which looked a colour up in that dict) becomesemit_css(package_accent: str)(it takes the colour value directly). Each package now applies its own accent in a localreports/_report_css.py, so the vendored_css.pycarries no package-specific edit and re-vendoring it is a byte-identical copy. oceanarray's accent isvar(--ocean)(=#1a3a5c), so rendered pages are pixel-identical; the only golden change is the single--package-accentline switching from the hex literal tovar(--ocean).Fix: signed-DMS coordinate parsing (was corrupting mooring positions)
_dms_to_degmis-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.2instead of-(27 + 48/60) = -27.8— a ~1.6° error. This flows throughparse_latloninto 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/Wsuffixes and did not parse DMS at all, emitting the malformed"-27 48.000 W". It now routes throughparse_latlon_with_sourceplus a newformat_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-accentswitch — both reviewed. New unit tests cover_dms_to_deg,format_latlon, and thequarterslot geometry (with a ±1px tolerance for the2.25 × 150 = 337.5half-pixel).Breaking changes
emit_csssignature 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: callemit_css("<css-colour>")(e.g.emit_css("var(--ocean)")) instead ofemit_css("oceanarray"). In-repo callers are updated; this matters to anyone vendoringreports/_css.py.report_tokens.PACKAGE_ACCENTremoved. The per-package accent dict no longer exists in the vendored tokens. Migration: choose the accent in the package's localreports/_report_css.pyand pass it toemit_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").