Skip to content

fix: preserve multi-digit GCP region numbers - #1439

Open
nawaaaaaAaar wants to merge 2 commits into
mlco2:masterfrom
nawaaaaaAaar:fix/gcp-region-numbers
Open

nawaaaaaAaar wants to merge 2 commits into
mlco2:masterfrom
nawaaaaaAaar:fix/gcp-region-numbers

Conversation

@nawaaaaaAaar

@nawaaaaaAaar nawaaaaaAaar commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1438.

Accept all digits in a GCP region number when extracting it from a zone. The current regex truncates europe-west12 to europe-west1, even though the shipped cloud-impact table has separate entries; this can select the wrong electricity carbon intensity.

Verification on Python 3.12.13:

  • Eight new cases: four multi-digit regressions fail before the fix, four single-digit controls pass.
  • Repository package test command: 688 passed, two skipped, three integration cases deselected, ten subtests passed.
  • All applicable autoflake/isort/Black/flake8 pre-commit hooks passed.

No emissions factors were changed. Cloud metadata tests use mocked provider responses rather than a live GCP account; the package suite uses its existing hardware/API mocks. Web dashboard/API integration and the deliberately excluded visualization module were not exercised.

AI disclosure: autonomously reproduced, implemented, and tested using Perplexity Computer (GPT-6.1). No human review is claimed.

Combined with #1441 and #1443: package suite passed with 695 passes, two skips, three integration cases deselected and twelve subtests passed. PR is open and ready for review; hosted package tests, pre-commit, documentation, packaging and CodeQL require maintainer approval. The PR-size labeler passed but is not a code-verification result.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 16:09
@nawaaaaaAaar
nawaaaaaAaar requested a review from a team as a code owner October 5, 2026 16:09

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@davidberenstein1957 davidberenstein1957 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks right: [0-9] to [0-9]+ in geography.py is exactly what europe-west12-a needs, and the test covers it. Fixes #1438. The branch is behind master, a rebase before merge would be good.

@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.07%. Comparing base (7929a4f) to head (a89ef2c).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1439   +/-   ##
=======================================
  Coverage   92.07%   92.07%           
=======================================
  Files          49       49           
  Lines        5199     5199           
=======================================
  Hits         4787     4787           
  Misses        412      412           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GCP region parser selects the wrong region for multi-digit region numbers

3 participants