Context
Currency response parsing assumes Content-Type is present and that HTML error pages contain the expected XPath element. Unexpected server responses can raise KeyError or IndexError instead of project exceptions.
Scope
Make currency response parsing defensive for missing headers, unexpected HTML, malformed CSV, malformed dates, malformed numeric columns, and empty response bodies.
Branching
Create the implementation branch from project-health-hardening and merge the fix back into project-health-hardening before any merge to main.
Acceptance Criteria
- Missing
Content-Type and unexpected HTML raise stable BCBAPIError variants.
- CSV/date/numeric parsing errors produce clear messages.
- Sync and async response parsing stay in parity.
uv run pytest -m "not integration", Ruff, and mypy pass.
Context
Currency response parsing assumes
Content-Typeis present and that HTML error pages contain the expected XPath element. Unexpected server responses can raiseKeyErrororIndexErrorinstead of project exceptions.Scope
Make currency response parsing defensive for missing headers, unexpected HTML, malformed CSV, malformed dates, malformed numeric columns, and empty response bodies.
Branching
Create the implementation branch from
project-health-hardeningand merge the fix back intoproject-health-hardeningbefore any merge tomain.Acceptance Criteria
Content-Typeand unexpected HTML raise stableBCBAPIErrorvariants.uv run pytest -m "not integration", Ruff, and mypy pass.