Skip to content

[REFACTOR] Adopt the vendored report-design layer and render inventory tables from the vendored builders - #106

Merged
eleanorfrajka merged 11 commits into
mainfrom
rep/vendored-sync-2
Oct 18, 2026
Merged

eleanorfrajka merged 11 commits into
mainfrom
rep/vendored-sync-2

Conversation

@eleanorfrajka

@eleanorfrajka eleanorfrajka commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

oceanarray adopts the shared reports/_vendored/ report-design layer, vendored byte-identical from ctdcast 15fa38b (the family source of truth), and renders the netCDF inventory tables (coordinates, variables, scalars, global attributes) from the vendored nc_tables builders and _nc_tables.html macros. The six scattered vendored files and the local inventory-table code are retired.

What's changed

  • reports/_vendored/ replaces the six scattered copies and carries its own MANIFEST.txt + check.py, so VENDORED.txt and scripts/check_vendored.py are removed. A new owned reports/design.py configures the shared layer (accent, QC/sensor predicates, ATTR_GROUP_EXTRAS, toggles); reports/__init__.py resolves public names lazily (PEP 562) so importing the layer does not pull the page pipeline.
  • Inventory tables come from the vendored builders (_read_nc_metadata calls coords_rows/variables_rows/scalars_rows/globals_rows/summary_counts); the local _nc_tables.py, five _nc_*.html templates, and _html_helpers row builders are deleted. Type labels read string, the coordinates table gains a Dims column, history is excluded from the globals table (exclude=("history",)) and shown only in its own panel, an all-empty Standard/long-name column drops (optional= includes stdname), and the QC marker shows the real suffix ((_qc)) coloured with --qc-mark.
  • The processing-history panel is a properties_table plus a sortable Time·Event table with a leading # ordinal column (position in history, so a sort never loses order when events share a timestamp).
  • Report chrome: shared masthead nav macro, click-to-sort tables, per-figure/per-table source: captions, and a per-page <style> block stripped of rules the shared stylesheet provides (guarded by test_no_base_rule_duplicates_vendored_css).
  • Array page: the mooring map is the vendored Leaflet track_map (one marker per mooring, each with a permanent name label, hover-linked to the list) behind design.ARRAY_MAP_LEAFLET — interactive on screen, matplotlib PNG when printing. The masthead gains deployment/recovery, position and extent, water depth, an instrument by-type breakdown, and processed-to counts from the YAMLs.
  • A figure whose draw raises renders a short stub with the reason (as_panel) instead of vanishing.

Breaking changes

None to the NetCDF outputs or the public API (from oceanarray.reports import MooringReport is unchanged). The report HTML changes (masthead nav markup, inventory-table layout and columns, type labels now string, source: captions); the committed goldens are rebaselined to match.

Tests

pytest green (1077 tests); the five dune2 goldens are rebaselined. Coverage floor raised 38% → 58% (both main and this branch measure 59%). New: test_vendored.py (self-contained vendored check), test_nc_tables.py (globals_rows with ATTR_GROUP_EXTRAS), test_base_css_no_vendored_dup.py, test_stub_reason.py, an empty-nc_meta tolerance test, and test_seam_history_excluded_and_stdname_column_drops — a real dune2 stage-3 file stripped of standard names and of every provenance attribute but history, asserting the owned call-site adoptions hold (history and its emptied group excluded; the all-empty Standard/long-name column drops) — the paths the goldens do not exercise.

Notes

reports/_vendored/ is upstream-managed and never edited here; the directory's check.py verifies it byte-identical to ctdcast 15fa38b both ways. Two array-map gaps found while eyeballing (west-edge latitude labels clip; scale bar under the hover panel) are filed upstream and fixed on a ctdcast branch — they arrive on the next re-vendor as a separate small PR, not patched locally. This PR does not wait on them.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved review findings include a critical report-generation memory-retention issue and several metadata and map-rendering correctness issues.

3 open issues
What changed in this PR

Refactors report rendering to use the shared vendored design layer, builders, templates, and interactive maps.

Changes:

  • Consolidates vendored report assets and adds owned configuration.
  • Migrates inventory and history tables to shared builders.
  • Updates report layouts, metadata, maps, figure stubs, tests, and coverage.
File Change
VENDORED.txt Removes obsolete vendoring manifest.
tests/​unit/​test_vendored.py Tests vendored integrity checks.
tests/​unit/​test_unit_label_literals.py Updates label-literal exclusions.
tests/​unit/​test_stub_reason.py Tests figure failure stubs.
tests/​unit/​test_report.py Updates report metadata tests.
tests/​unit/​test_report_tokens.py Uses vendored design tokens.
tests/​unit/​test_report_golden.py Updates golden-report testing.
tests/​unit/​test_plot_guard.py Uses vendored token configuration.
tests/​unit/​test_nc_tables.py Tests shared inventory builders.
tests/​unit/​test_nav.py Updates navigation token tests.
tests/​unit/​test_mooring_manifest.py Uses vendored page model.
tests/​unit/​test_manifest.py Updates manifest tests.
tests/​unit/​test_instrument_manifest.py Uses vendored page model.
tests/​unit/​test_grid_manifest.py Uses vendored page model.
tests/​unit/​test_base_css_no_vendored_dup.py Guards against duplicated CSS.
tests/​fixtures/​golden/​dune2/​dune2_1_2026_report.html Rebaselines generated report output.
tests/​conftest.py Updates plot-error configuration.
scripts/​check_vendored.py Removes obsolete checker.
pyproject.toml Packages vendored assets and updates configuration.
oceanarray/​reports/​templates/​base.html Uses shared navigation and sorting.
oceanarray/​reports/​templates/​array.html Adds array metadata and map rendering.
oceanarray/​reports/​templates/​_nc_variables.html Removes superseded inventory template.
oceanarray/​reports/​templates/​_nc_var_macros.html Removes superseded inventory macros.
oceanarray/​reports/​templates/​_nc_scalars.html Removes superseded scalar template.
oceanarray/​reports/​templates/​_nc_globals.html Removes superseded globals template.
oceanarray/​reports/​templates/​_nc_coords.html Removes superseded coordinates template.
oceanarray/​reports/​templates/​_macros.html Adds figure source captions.
oceanarray/​reports/​templates/​_instrument_files.html Adds sortable file ordinals.
oceanarray/​reports/​templates/​_grid_history.html Renders processing-history tables.
oceanarray/​reports/​design.py Adds oceanarray-specific report configuration.
oceanarray/​reports/​_vendored/​units_display.py Adds shared units formatting.
oceanarray/​reports/​_vendored/​templates/​_nc_tables.html Adds shared inventory macros.
oceanarray/​reports/​_vendored/​templates/​_nav.html Adds shared navigation markup.
oceanarray/​reports/​_vendored/​templates/​_map.html Adds shared interactive map rendering.
oceanarray/​reports/​_vendored/​report.mplstyle Provides shared plotting style.
oceanarray/​reports/​_vendored/​README.md Documents vendoring workflow.
oceanarray/​reports/​_vendored/​page_model.py Provides page models and stub reasons.
oceanarray/​reports/​_vendored/​MANIFEST.txt Records vendored file hashes.
oceanarray/​reports/​_vendored/​leaflet/​LICENSE Adds Leaflet licensing information.
oceanarray/​reports/​_vendored/​leaflet/​leaflet.min.css Bundles Leaflet styling.
oceanarray/​reports/​_vendored/​leaflet.py Provides map asset helpers.
oceanarray/​reports/​_vendored/​figure_png.py Adds figure source tracking.
oceanarray/​reports/​_vendored/​design_tokens.py Centralizes shared design tokens.
oceanarray/​reports/​_vendored/​css.py Generates shared CSS and sorting scripts.
oceanarray/​reports/​_vendored/​check.py Adds vendored integrity checking.
oceanarray/​reports/​_vendored/​__init__.py Initializes the vendored package.
oceanarray/​reports/​_stack.py Migrates stack panels and handling.
oceanarray/​reports/​_slots.py Uses vendored rendering tokens.
oceanarray/​reports/​_report_css.py Removes superseded CSS wiring.
oceanarray/​reports/​_plots.py Uses vendored design tokens.
oceanarray/​reports/​_nc_tables.py Removes local inventory builders.
oceanarray/​reports/​_navs.py Uses the vendored page model.
oceanarray/​reports/​_mooring.py Migrates mooring panels and handling.
oceanarray/​reports/​_instrument.py Migrates instrument panels and inventory keys.
oceanarray/​reports/​_html_helpers.py Integrates shared metadata and history builders.
oceanarray/​reports/​_grid.py Migrates grid panels and inventory keys.
oceanarray/​reports/​_figdebug.py Adds figure failure capture and stubs.
oceanarray/​reports/​_env.py Loads vendored templates and builders.
oceanarray/​reports/​_array.py Builds array metadata and map payloads.
oceanarray/​reports/​__init__.py Adds lazy public report imports.
oceanarray/​plotters/​ts.py Uses vendored design tokens.
oceanarray/​plotters/​timeseries.py Uses vendored design tokens.
oceanarray/​plotters/​spectrum.py Uses vendored design tokens.
oceanarray/​plotters/​primitives.py Uses vendored design tokens.
oceanarray/​plotters/​hydrography.py Uses vendored design tokens.
oceanarray/​plotters/​diagnostic.py Uses vendored design tokens.
oceanarray/​plotters/​current.py Uses vendored design tokens.
oceanarray/​plotters/​_cli_legacy.py Updates legacy style paths.
oceanarray/​config/​parameters.py Points to the vendored matplotlib style.
CHANGELOG.md Documents the refactor.
.github/​workflows/​tests.yml Raises the coverage threshold.

Review effort: Lite

Comment thread oceanarray/reports/_array.py
Comment thread oceanarray/reports/_vendored/templates/_map.html
Comment thread oceanarray/reports/templates/array.html
@eleanorfrajka
eleanorfrajka merged commit 8aeef15 into main Oct 18, 2026
8 checks passed
@eleanorfrajka
eleanorfrajka deleted the rep/vendored-sync-2 branch October 18, 2026 05:24
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.

2 participants