Skip to content

Address review priorities — v0.13.0#27

Merged
bk86a merged 1 commit intomainfrom
feature/review-priorities
Feb 23, 2026
Merged

Address review priorities — v0.13.0#27
bk86a merged 1 commit intomainfrom
feature/review-priorities

Conversation

@bk86a
Copy link
Owner

@bk86a bk86a commented Feb 23, 2026

Summary

Addresses all 5 top priorities identified in the project review (scored 7/10), implemented as GitHub issues #22#26:

  • Centralize duplicated logic (Centralize duplicated logic #22): normalize_country() replaces duplicate GR→EL blocks, _db_connection() context manager replaces 6 manual SQLite connect/close patterns, _build_result() helper eliminates repetitive result dict construction across all 5 lookup tiers. Added requirements-dev.txt and return type hints.
  • Narrow exception handling (Narrow exception handling #23): 9 bare except Exception blocks in data_loader.py replaced with specific types (sqlite3.Error, httpx.RequestError, OSError, etc.). Silent catch in import_estimates.py now logs a message.
  • Add Makefile and dev tooling (Add Makefile, pre-commit hooks, ruff format CI check #24): Makefile with standard targets, .pre-commit-config.yaml with ruff hooks, ruff format --check added to CI lint job.
  • Add automated test suite (Add automated test suite #25): 69 pytest tests — test_postal_patterns.py (preprocessing, tercet_map, extraction for 11 countries), test_data_loader.py (normalize functions, all 5 lookup tiers), test_api.py (all 3 endpoints). CI test job added to workflow.
  • Version bump to 0.13.0. Tags and branch cleanup (Tag missing versions and clean up stale branches #26) to follow after merge.

Test plan

  • ruff check app/ tests/ — passes
  • ruff format --check app/ tests/ — passes
  • pytest tests/ -v — 69/69 tests pass
  • python -c "from app.main import app; print('imports OK')" — passes
  • CI pipeline passes (lint, format, test, import-check, security, docker)
  • After merge: tag v0.11.0, v0.12.0, v0.13.0; delete stale remote branches (Tag missing versions and clean up stale branches #26)

Closes #22, closes #23, closes #24, closes #25

…(v0.13.0)

Address all 5 review priorities from project review:
- Centralize duplicated logic: normalize_country(), _db_connection(),
  _build_result() helpers (#22)
- Narrow exception handling: replace 9 bare except Exception blocks
  with specific types (#23)
- Add Makefile, pre-commit hooks, ruff format CI check (#24)
- Add 69 pytest tests covering postal_patterns, data_loader, and
  API endpoints with CI test job (#25)
- Version bump to 0.13.0, requirements-dev.txt, .dockerignore updates

Closes #22, closes #23, closes #24, closes #25
@bk86a bk86a merged commit 2c175a1 into main Feb 23, 2026
10 checks passed
@bk86a bk86a deleted the feature/review-priorities branch February 23, 2026 20:23
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 757ac305a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

logger.info("Loaded %d estimates from %s", count, csv_path)
return count > 0
except Exception as exc:
except (OSError, KeyError, ValueError) as exc:

Choose a reason for hiding this comment

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

P2 Badge Catch CSV parser errors when loading estimates

The narrowed exception tuple in _load_estimates_from_csv no longer includes csv.Error, so malformed estimate CSVs (for example files containing NUL bytes or parser-level CSV corruption) will now raise out of this function and bubble into load_data() during startup, taking the service down instead of logging a warning and continuing without estimates. This is a behavior regression from the previous broad handling of this optional input path.

Useful? React with 👍 / 👎.

bk86a added a commit that referenced this pull request Mar 12, 2026
Address review priorities — v0.13.0
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.

Add automated test suite Add Makefile, pre-commit hooks, ruff format CI check Narrow exception handling Centralize duplicated logic

1 participant