Skip to content

fix(ev): keep the BNetzA safety floor armed when it is set below 1 - #144

Merged
GeiserX merged 1 commit into
mainfrom
fix/bnetza-floor-guard
Sep 18, 2026
Merged

GeiserX merged 1 commit into
mainfrom
fix/bnetza-floor-guard

Conversation

@GeiserX

@GeiserX GeiserX commented Sep 18, 2026 •

Copy link
Copy Markdown
Owner

PUMPERLY_BNETZA_MIN_STATIONS=0.5 floored to 0, and refreshed < 0 is never true, so the guard on the BNetzA scraper's two destructive sweeps (stale-row prune, Open Charge Map retirement) was silently gone for anyone who set a fractional or zero floor. base.run() still blocks a truly empty fetch, so this needed a misconfigured floor plus a degraded fetch to bite, but a guard that can be turned off by a typo is not a guard.

Values that floor below 1 now fall back to the 10,000 default, the same as a non-numeric value. The regression test covers 0.5, 0 and -3 and fails against the previous line.

Also fixes the README feature bullet that still claimed Open Charge Map covers every country (Germany and Spain use their official registries).

Follow-up to #143, from CodeRabbit's post-merge finding.

Summary by CodeRabbit

  • Bug Fixes

    • Improved EV charging station data cleanup safeguards when configured minimum thresholds are invalid, including fractional values below 1.
    • Invalid threshold values now use the standard fallback instead of potentially allowing unintended cleanup behavior.
    • Added coverage for zero, negative, and fractional threshold values.
  • Documentation

    • Clarified that Open Charge Map is the default fallback source, while official registries are used where available in Spain and Germany.

A fractional or zero PUMPERLY_BNETZA_MIN_STATIONS floored to 0, and `refreshed < 0` is never true, so the guard on the two destructive sweeps silently disappeared. Values below 1 now fall back to the 10,000 default like non-numeric ones. Also fixes the README line that still said Open Charge Map covers every country.
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: fc819993-c8ff-4784-afca-bbf669fd22f9

📥 Commits

Reviewing files that changed from the base of the PR and between d1ac375 and d70d934.

📒 Files selected for processing (3)
  • README.md
  • src/scrapers/bnetza.test.ts
  • src/scrapers/bnetza.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

BNetzA minimum station floor validation

Layer / File(s) Summary
Threshold validation and source documentation
src/scrapers/bnetza.ts, README.md
Values below 1 now use the 10,000 default. The README identifies Open Charge Map as the fallback source.
Regression coverage
src/scrapers/bnetza.test.ts
Tests cover 0.5, 0, and -3, and verify that no DELETE sweep runs.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to d70d9

The threshold safeguard, regression coverage, and source documentation are consistent with the stated behavior, so the change is mergeable.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: keeping the BNetzA safety floor active when configured below 1.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@GeiserX
GeiserX merged commit b841958 into main Sep 18, 2026
8 checks passed
@GeiserX
GeiserX deleted the fix/bnetza-floor-guard branch September 18, 2026 11:22
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