Skip to content

feat(pmp): key reference identity on reference_source_id and emit kind#775

Merged
lewisjared merged 1 commit into
mainfrom
feat/layer-a-pmp
Jul 1, 2026
Merged

feat(pmp): key reference identity on reference_source_id and emit kind#775
lewisjared merged 1 commit into
mainfrom
feat/layer-a-pmp

Conversation

@lewisjared

@lewisjared lewisjared commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Description

Unifies PMP reference identity onto the shared metric-value contract. ENSO previously keyed reference identity on reference_datasets while variability-modes and annual-cycle already used reference_source_id; this makes every PMP diagnostic key reference identity the same way and declare its role with the first-class kind (model for all PMP scalars, which are model-vs-reference scores).

Core mechanism: iter_results now lifts a kind bundle dimension into ScalarMetricValue.kind, so a producer can declare a value's role inline while it stays a first-class field with its own column. Bundles that do not carry a kind dimension keep the field default, so existing baselines and providers that predate the contract are unaffected.

Combined references (the STOP-gated step in the plan): ENSO scores some metrics jointly against two observation datasets (for example HadISST_GPCP-Monthly-3-2). These are kept as a single combined reference_source_id value rather than split, because the score is one value that depends on both references and the source data does not expose a per-reference decomposition; splitting is left as a possible follow-up.

The resulting ENSO json_structure is ["kind", "mip_id", "source_id", "member_id", "grid_label", "experiment_id", "metric", "reference_source_id"].

All 21 PMP regression baselines were re-minted (17 via replay for the key/kind change; the 4 ENSO cases execute-minted) and Diagnostic.version bumped accordingly. The coupling gate routes all 21 cases to replay with zero failures.

Portable regression provenance

While re-minting, the committed baselines were found to embed machine-specific values in the CMEC command-line provenance: the source-checkout path of in-repo driver/param scripts (e.g. /home/jared/.../packages/climate-ref-pmp/.../enso_driver.py) and the host OS (Darwin/Linux). These were pre-existing on main and would drift between a macOS mint and a Linux CI execute. Regression capture now redacts both to portable <SOURCE_DIR> and <OS> placeholders (the source-path redaction is checkout-agnostic, so a Linux-minted and a macOS-re-derived baseline reduce to identical bytes). Applied symmetrically through the capture path, so replay reproduces the committed bundle.

Surfaced while minting locally (not fixed here): #773 — on macOS the Application Support space in the default software path breaks the PMP conda console-script shebang; the PMP conda-lock is also not resolved for osx-arm64, so local mints use MAMBA_PLATFORM=osx-64 with a space-free REF_SOFTWARE_ROOT.

Checklist

Please confirm that this pull request has done the following:

  • Tests added
  • Documentation added (where applicable)
  • Changelog item added to changelog/

Summary by CodeRabbit

  • New Features
    • Metric outputs now expose a first-class kind field and include consistent “model” role metadata.
    • Diagnostics standardise reference identity via reference_source_id (including consistent handling when scoring is computed jointly).
    • Updated diagnostic result nesting to align with the new kind/model structure.
  • Bug Fixes
    • Improved portability of generated committed baselines by redacting machine-specific paths and host OS details to reusable placeholders.
  • Tests
    • Added/updated unit coverage for the new metric shape and backwards compatibility.
    • Refreshed regression fixtures/manifests and checksums to match the updated schema.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7b993c8d-8225-4542-8c39-53efd1ac56ac

📥 Commits

Reviewing files that changed from the base of the PR and between 6f6a387 and a2fb09e.

📒 Files selected for processing (60)
  • changelog/775.feature.md
  • changelog/775.fix.md
  • packages/climate-ref-core/src/climate_ref_core/pycmec/metric.py
  • packages/climate-ref-core/src/climate_ref_core/regression/capture.py
  • packages/climate-ref-core/tests/unit/pycmec/test_cmec_metric.py
  • packages/climate-ref-core/tests/unit/regression/test_capture.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/annual_cycle.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/enso.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/variability_modes.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/drivers/enso_driver.py
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/unit/test_variability_modes.py
✅ Files skipped from review due to trivial changes (17)
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/manifest.json
  • changelog/775.fix.md
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/manifest.json
🚧 Files skipped from review as they are similar to previous changes (41)
  • packages/climate-ref-core/tests/unit/pycmec/test_cmec_metric.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/drivers/enso_driver.py
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/unit/test_variability_modes.py
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip7/regression/diagnostic.json
  • packages/climate-ref-core/tests/unit/regression/test_capture.py
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/enso.py
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/regression/output.json
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/variability_modes.py
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/annual_cycle.py
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip7/manifest.json
  • packages/climate-ref-core/src/climate_ref_core/pycmec/metric.py
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip6/regression/diagnostic.json
  • packages/climate-ref-core/src/climate_ref_core/regression/capture.py
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/manifest.json

📝 Walkthrough

Walkthrough

This PR adds first-class kind handling to CMEC scalar metric values, updates PMP diagnostics and drivers to emit kind and reference_source_id, and refreshes regression capture logic plus the affected changelog and fixture data.

Changes

PMP kind/reference_source_id migration

Layer / File(s) Summary
Core CMEC kind lifting
packages/climate-ref-core/src/climate_ref_core/pycmec/metric.py, packages/climate-ref-core/tests/unit/pycmec/test_cmec_metric.py, changelog/775.feature.md
Adds _KIND_DIMENSION handling and _build_scalar_value to lift a kind dimension into ScalarMetricValue.kind, updates _walk_results to use it, adds unit tests, and documents the change in the changelog.
Committed bundle redaction
packages/climate-ref-core/src/climate_ref_core/regression/capture.py, packages/climate-ref-core/tests/unit/regression/test_capture.py, changelog/775.fix.md
Adds checkout-root source-path redaction for committed bundle JSON, updates regression tests for the placeholder output, and documents the provenance redaction behaviour in the changelog.
Annual Cycle diagnostic and fixtures
packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/annual_cycle.py, packages/climate-ref-pmp/tests/test-data/annual-cycle/*
Adds a kind facet, bumps the schema version, renames reference_datasets to reference_collection, prepends kind: "model" to output bundles, and regenerates the annual-cycle manifests and regression fixtures.
ENSO diagnostic, driver, and fixtures
packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/enso.py, packages/climate-ref-pmp/src/climate_ref_pmp/drivers/enso_driver.py, packages/climate-ref-pmp/tests/test-data/enso_proc/*, packages/climate-ref-pmp/tests/test-data/enso_tel/*
Bumps the diagnostic version, replaces reference_datasets with reference_source_id, prepends kind: "model", updates CMEC dimension naming in the driver, and regenerates the ENSO procedure and tel fixtures.
Variability Modes diagnostic and fixtures
packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/variability_modes.py, packages/climate-ref-pmp/tests/unit/test_variability_modes.py, packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-*/*
Adds a kind facet, bumps the schema version, renames reference_datasets to reference_collection, prepends kind: "model", adds a unit test validating bundle dimensions, and regenerates the variability-mode manifests and regression fixtures across NAM, NAO, NPGO, NPO, PDO, PNA, and SAM modes.

Sequence Diagram(s)

sequenceDiagram
  participant Bundle as CMECMetric bundle
  participant Walker as _walk_results
  participant Builder as _build_scalar_value
  participant Value as ScalarMetricValue

  Bundle->>Walker: iterate metadata and value
  Walker->>Builder: pass dimensions, value, attributes
  Builder->>Builder: remove kind from dimensions
  Builder->>Value: construct with kind and remaining dimensions
  Value-->>Walker: yielded scalar value
Loading

Possibly related PRs

  • Climate-REF/climate-ref#761: Also updates committed-bundle sanitisation in packages/climate-ref-core/src/climate_ref_core/regression/capture.py for portable regression artefacts.

Suggested labels: review_needed_senior_swe, review_depth_deep

Suggested reviewers: None identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely captures the main change: using reference_source_id and emitting kind for PMP metrics.
Description check ✅ Passed The description matches the required template and includes the checklist items, with tests, docs, and changelog entries confirmed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/layer-a-pmp

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ate-ref-core/src/climate_ref_core/pycmec/metric.py 90.00% 1 Missing ⚠️
...mp/src/climate_ref_pmp/diagnostics/annual_cycle.py 83.33% 1 Missing ⚠️
Flag Coverage Δ
core 92.35% <94.11%> (+0.01%) ⬆️
providers 86.30% <88.88%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ef-core/src/climate_ref_core/regression/capture.py 94.59% <100.00%> (+0.47%) ⬆️
...te-ref-pmp/src/climate_ref_pmp/diagnostics/enso.py 79.26% <100.00%> (+0.25%) ⬆️
...c/climate_ref_pmp/diagnostics/variability_modes.py 89.18% <100.00%> (+0.09%) ⬆️
...ate-ref-core/src/climate_ref_core/pycmec/metric.py 98.26% <90.00%> (+0.05%) ⬆️
...mp/src/climate_ref_pmp/diagnostics/annual_cycle.py 45.02% <83.33%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/diagnostic.json (1)

50-80: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Scrub local provenance from these regression fixtures

packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/diagnostic.json still embeds /Users/jared/..., osx-64, and Darwin in the provenance block, and the same pattern appears in the matching output.json snapshots. Replace those fields with placeholders or sanitised values before committing so the golden data stays machine-agnostic.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 37a71f41-75fa-46dd-9725-282a969d85df

📥 Commits

Reviewing files that changed from the base of the PR and between cc8ac3d and 1d681d6.

📒 Files selected for processing (54)
  • changelog/775.feature.md
  • packages/climate-ref-core/src/climate_ref_core/pycmec/metric.py
  • packages/climate-ref-core/tests/unit/pycmec/test_cmec_metric.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/annual_cycle.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/enso.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/variability_modes.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/drivers/enso_driver.py
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/unit/test_variability_modes.py

Comment thread changelog/775.feature.md
Comment on lines +5 to +7
ENSO references that the metrics package scores against two observation datasets jointly
(for example `HadISST_GPCP-Monthly-3-2`) are kept as a single combined `reference_source_id` value,
because the score is one value that depends on both references and cannot be split per reference.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Minor grammar nit: unnecessary comma before "because".

Static analysis flags a restrictive "because" clause preceded by a comma.

✏️ Proposed fix
-ENSO references that the metrics package scores against two observation datasets jointly
-(for example `HadISST_GPCP-Monthly-3-2`) are kept as a single combined `reference_source_id` value,
-because the score is one value that depends on both references and cannot be split per reference.
+ENSO references that the metrics package scores against two observation datasets jointly
+(for example `HadISST_GPCP-Monthly-3-2`) are kept as a single combined `reference_source_id` value
+because the score is one value that depends on both references and cannot be split per reference.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ENSO references that the metrics package scores against two observation datasets jointly
(for example `HadISST_GPCP-Monthly-3-2`) are kept as a single combined `reference_source_id` value,
because the score is one value that depends on both references and cannot be split per reference.
ENSO references that the metrics package scores against two observation datasets jointly
(for example `HadISST_GPCP-Monthly-3-2`) are kept as a single combined `reference_source_id` value
because the score is one value that depends on both references and cannot be split per reference.
🧰 Tools
🪛 LanguageTool

[formatting] ~6-~6: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ...gle combined reference_source_id value, because the score is one value that depends on ...

(COMMA_BEFORE_BECAUSE)

Source: Linters/SAST tools

Comment thread packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/output.json Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/climate-ref-core/tests/unit/regression/test_capture.py (1)

170-243: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Integration test doesn't exercise _redact_source_paths end-to-end.

_leaky_provenance's commandLine only contains {software_root}/conda/... paths — no packages/climate-ref-<pkg>/ segment — so test_write_committed_bundle_redacts_and_placeholders_provenance never triggers the new checkout-root redaction through the real write_committed_bundle pipeline. The new behaviour is only verified via the standalone _redact_source_paths unit tests, not via the full sanitise → canonicalise pipeline interaction this PR relies on for the 21 re-minted PMP baselines.

Consider adding a package-path segment (e.g. .../packages/climate-ref-pmp/src/.../enso_driver.py) to the commandLine fixture and asserting <SOURCE_DIR> appears in the committed output, to cover the interaction between PlaceholderMap.sanitise() ordering and _redact_source_paths.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 665cb9b9-c48d-4bb8-810b-900c8b8d4e65

📥 Commits

Reviewing files that changed from the base of the PR and between 1d681d6 and 6f6a387.

📒 Files selected for processing (60)
  • changelog/775.feature.md
  • changelog/775.fix.md
  • packages/climate-ref-core/src/climate_ref_core/pycmec/metric.py
  • packages/climate-ref-core/src/climate_ref_core/regression/capture.py
  • packages/climate-ref-core/tests/unit/pycmec/test_cmec_metric.py
  • packages/climate-ref-core/tests/unit/regression/test_capture.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/annual_cycle.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/enso.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/variability_modes.py
  • packages/climate-ref-pmp/src/climate_ref_pmp/drivers/enso_driver.py
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/unit/test_variability_modes.py
✅ Files skipped from review due to trivial changes (17)
  • changelog/775.fix.md
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-pr/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip7-ts/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/manifest.json
🚧 Files skipped from review as they are similar to previous changes (32)
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/output.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pdo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip6/manifest.json
  • packages/climate-ref-core/src/climate_ref_core/pycmec/metric.py
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-pna/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/src/climate_ref_pmp/drivers/enso_driver.py
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip6/manifest.json
  • packages/climate-ref-pmp/tests/unit/test_variability_modes.py
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/annual_cycle.py
  • packages/climate-ref-pmp/tests/test-data/annual-cycle/cmip6-ts/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/enso.py
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npo/cmip7/manifest.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nam/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-npgo/cmip6/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-sam/cmip6/regression/diagnostic.json
  • packages/climate-ref-core/tests/unit/pycmec/test_cmec_metric.py
  • packages/climate-ref-pmp/tests/test-data/enso_proc/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/tests/test-data/extratropical-modes-of-variability-nao/cmip7/regression/diagnostic.json
  • packages/climate-ref-pmp/src/climate_ref_pmp/diagnostics/variability_modes.py
  • packages/climate-ref-pmp/tests/test-data/enso_tel/cmip7/manifest.json

Unify PMP reference identity onto the shared metric-value contract.
ENSO now keys reference identity on reference_source_id
(previously reference_datasets),
matching variability-modes and annual-cycle,
and every PMP scalar declares its role with the first-class kind of "model".

Core: iter_results lifts a kind bundle dimension into ScalarMetricValue.kind
so a producer can declare a value's role inline;
bundles without the dimension keep the default,
so baselines and providers that predate the contract are unaffected.

ENSO references scored jointly against two observation datasets
(for example HadISST_GPCP-Monthly-3-2)
are kept as a single combined reference_source_id value,
because the score is one value that depends on both references
and cannot be split per reference.

Regression capture now redacts the source-checkout path and host OS in
command-line provenance to portable <SOURCE_DIR> / <OS> placeholders,
so committed baselines stay reproducible across platforms and checkouts.

PMP regression baselines re-minted and Diagnostic.version bumped accordingly.
@lewisjared lewisjared merged commit cbf7075 into main Jul 1, 2026
28 checks passed
@lewisjared lewisjared deleted the feat/layer-a-pmp branch July 1, 2026 08:57
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