Skip to content

chore(backend): drop pre-Reader metric-value code#42

Merged
lewisjared merged 2 commits into
mainfrom
chore/delete-dead-metric-value-code
Jul 20, 2026
Merged

chore(backend): drop pre-Reader metric-value code#42
lewisjared merged 2 commits into
mainfrom
chore/delete-dead-metric-value-code

Conversation

@lewisjared

@lewisjared lewisjared commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Removes the dead metric-value helpers left behind by the results-reader adoption in #39.

  • Trims core/metric_values.py to MetricValueType and parse_id_list, the only symbols the routes still use.
  • Deletes core/outliers.py and the AnnotatedScalarValue model. Outlier detection now happens inside the reader via OutlierPolicy.
  • Drops the mock-based tests that covered the removed helpers. The MetricValueCollection builder tests still cover the live reader path.

Net -1147 lines with no behaviour change. Direct tests for core/reader_values.py are planned as a follow-up.

Summary by CodeRabbit

  • Removed Features

    • Removed automatic outlier detection and related outlier annotations from metric values.
    • Metric results now use the standard scalar and series value representations.
  • Bug Fixes

    • Updated invalid comma-separated ID handling to avoid returning a specialised HTTP 400 response.
  • Chores

    • Removed unused metric-value helpers and their associated test coverage.

Removes the dead CSV/outlier helpers in core/metric_values.py and all
of core/outliers.py, plus AnnotatedScalarValue from models.py.
These were superseded by climate_ref.results.Reader and had no
production caller left, only mock-based tests.

Keeps the tests that cover live code: TestParseIdList and the
build_scalar_from_reader/build_series_from_reader tests.
@netlify

netlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploy Preview for climate-ref canceled.

Name Link
🔨 Latest commit 4a6411d
🔍 Latest deploy log https://app.netlify.com/projects/climate-ref/deploys/6a5d9570fc81a10008ee8aed

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Removed legacy outlier detection and annotated scalar-value helpers, deleted their tests, changed invalid ID parsing error propagation, and updated the changelog.

Changes

Legacy metric-value cleanup

Layer / File(s) Summary
Remove outlier and annotated value flow
backend/src/ref_backend/core/outliers.py, backend/src/ref_backend/models.py, backend/tests/test_core/test_outliers.py, backend/tests/test_core/test_metric_values.py
The outlier utilities, AnnotatedScalarValue, and related outlier, CSV, and scalar-processing tests were removed.
Update metric-value parsing
backend/src/ref_backend/core/metric_values.py, changelog/42.trivial.md
Imports were reduced, invalid ID parsing errors are no longer converted to HTTP 400 responses, and the changelog records the helper removal.

Possibly related PRs

  • Climate-REF/ref-app#39: Uses the reader-based metric-value flow associated with the removed outlier and annotated-value machinery.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: removing obsolete pre-Reader metric-value code from the backend.
✨ 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 chore/delete-dead-metric-value-code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@lewisjared
lewisjared marked this pull request as ready for review July 20, 2026 03:26
@lewisjared
lewisjared merged commit eb3cbc2 into main Jul 20, 2026
9 checks passed
@lewisjared
lewisjared deleted the chore/delete-dead-metric-value-code branch July 20, 2026 05:15
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