Skip to content

fix(config): decouple ignore datasets fetching from config loading#792

Merged
lewisjared merged 2 commits into
mainfrom
fix/ignore-datasets-decouple
Jul 6, 2026
Merged

fix(config): decouple ignore datasets fetching from config loading#792
lewisjared merged 2 commits into
mainfrom
fix/ignore-datasets-decouple

Conversation

@lewisjared

Copy link
Copy Markdown
Contributor

Description

Resolves #549. This is a non-breaking re-cut of the salvageable core of #622, which had drifted too far behind main to rebase.

Decouple fetching from Config construction. Config.default() no longer performs network I/O as a side effect: the field factory for ignore_datasets_file is now a pure path computation, and the download moves to a new refresh_ignore_datasets_file() helper called lazily from ExecutionSolver.build_from_db at solve time. Read-only commands such as ref providers list and ref datasets list never touch the network. This also removes the __validation_ignore_datasets.yaml shim from Config.validate(), which only existed to dodge the side-effecting factory.

New Config.ignore_datasets_url field (env REF_IGNORE_DATASETS_URL) controls where the file is fetched from. Setting it to an empty string disables fetching entirely, which is what offline / air-gapped HPC deployments need. ignore_datasets_file is also now overridable via REF_IGNORE_DATASETS_FILE and coerced to a Path.

Fail-safe refresh. A failed download no longer creates an empty placeholder file (which previously suppressed the ignore list for six hours): an existing cached copy is reused unchanged, and a solve with no cached copy raises IgnoreDatasetsRefreshError rather than silently running without ignore-dataset protections.

Deterministic tests. Both test config fixtures now pin the in-tree default_ignore_datasets.yaml with fetching disabled, so tests exercise the shipped default file instead of whatever copy happens to be cached on the host, and a PR editing the file will correctly ripple into test results (the root cause of #590's cached-copy problem).

The docs gain a "Grey list" section describing the mechanism, the lazy fetch behaviour, and the offline workflow. The section notes that the ignore_datasets_* settings will be renamed to grey_list_* in a future release; the rename deliberately stays out of this PR to keep it non-breaking.

Checklist

Please confirm that this pull request has done the following:

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

`Config.default()` no longer performs network I/O as a side effect:
the field factory for `ignore_datasets_file` is now a pure path computation,
and the download moves to a new `refresh_ignore_datasets_file` helper
called lazily from `ExecutionSolver.build_from_db` at solve time.

A new `Config.ignore_datasets_url` field (env `REF_IGNORE_DATASETS_URL`)
controls where the file is fetched from;
setting it to an empty string disables fetching entirely
for offline and air-gapped deployments.

A failed download no longer creates an empty placeholder file:
an existing cached copy is reused unchanged (content and mtime preserved),
and a solve with no cached copy raises `IgnoreDatasetsRefreshError`
rather than silently running without ignore-dataset protections.

Test fixtures now pin the in-tree `default_ignore_datasets.yaml`
with fetching disabled,
so tests are deterministic, offline,
and exercise the shipped default file.

Closes #549
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@lewisjared, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c04dd8a-da98-4bc2-b03b-7a2f7f16fadd

📥 Commits

Reviewing files that changed from the base of the PR and between 67f1580 and e1942f4.

📒 Files selected for processing (9)
  • changelog/792.fix.md
  • docs/configuration.md
  • packages/climate-ref-core/src/climate_ref_core/exceptions.py
  • packages/climate-ref/src/climate_ref/config.py
  • packages/climate-ref/src/climate_ref/conftest_plugin.py
  • packages/climate-ref/src/climate_ref/solver.py
  • packages/climate-ref/tests/unit/test_config.py
  • packages/climate-ref/tests/unit/test_provider_registry.py
  • packages/climate-ref/tests/unit/test_solver.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ignore-datasets-decouple

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.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
packages/climate-ref/src/climate_ref/config.py 92.85% 1 Missing and 1 partial ⚠️
Flag Coverage Δ
core 92.44% <93.75%> (-0.02%) ⬇️
providers 86.97% <ø> (ø)

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

Files with missing lines Coverage Δ
...limate-ref-core/src/climate_ref_core/exceptions.py 97.72% <100.00%> (+0.10%) ⬆️
packages/climate-ref/src/climate_ref/solver.py 98.93% <100.00%> (+<0.01%) ⬆️
packages/climate-ref/src/climate_ref/config.py 96.52% <92.85%> (-0.85%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lewisjared lewisjared merged commit 7fca73d into main Jul 6, 2026
28 checks passed
@lewisjared lewisjared deleted the fix/ignore-datasets-decouple branch July 6, 2026 04:30
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.

Decouple ignore_datasets_file cache location from fetch logic

1 participant