Fix Gift Aid Personal Allowance taper interaction per ITA 2007 s.58#1430
Merged
Conversation
Per ITA 2007 s.58, grossed-up Gift Aid donations must be deducted from Adjusted Net Income when calculating the Personal Allowance taper. This fix ensures high earners (£100k-£125k) receive the correct tax relief for charitable donations. Changes: - Add gift_aid_grossed_up variable (gift_aid / (1 - basic_rate)) - Modify personal_allowance to use ANI minus grossed-up Gift Aid for taper - Add legislation.gov.uk references to gift_aid and personal_allowance - Add comprehensive Gift Aid tests for PA taper interaction Fixes #1429 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The Gift Aid PA taper fix changes baseline PA calculations for some households, affecting the overall fiscal impact of the UC taper reform. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add 13 new personal_allowance tests covering: - Basic PA behavior (no Gift Aid): 5 tests - PA taper with Gift Aid (documents the bug fixed in this PR): 4 tests - Edge cases with zero Gift Aid: 3 tests - Scottish taxpayer with Gift Aid: 1 test The Gift Aid + PA taper tests would fail on master but pass with this fix, confirming the fix works correctly. Also update the stale UC taper reform expected impact comment - this value (-29.2) was already wrong on master (actual: -27.5), unrelated to this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
MaxGhenis
added a commit
to PolicyEngine/givecalc
that referenced
this pull request
Dec 2, 2025
This version includes the Gift Aid Personal Allowance taper fix (PolicyEngine/policyengine-uk#1430) required for accurate UK tax calculations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
MaxGhenis
added a commit
to PolicyEngine/givecalc
that referenced
this pull request
Dec 2, 2025
This version includes the Gift Aid Personal Allowance taper fix (PolicyEngine/policyengine-uk#1430) required for accurate UK tax calculations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
MaxGhenis
added a commit
to PolicyEngine/givecalc
that referenced
this pull request
Dec 2, 2025
* Add UK Gift Aid support with PolicyEngine-UK This PR adds UK tax calculation support to GiveCalc, enabling UK users to calculate the tax impact of charitable donations via Gift Aid. ## Changes ### New UK Module (`givecalc/uk/`) - `constants.py`: UK-specific constants (tax year, regions) - `situation.py`: Creates PolicyEngine-UK situations with donation axes - `tax.py`: UK tax calculations (marginal savings, donation effects) ### API Endpoints (`api/main.py`) - `GET /api/uk/regions`: List UK regions grouped by nation - `GET /api/uk/tax-programs`: Gift Aid program information - `POST /api/uk/calculate`: Calculate UK tax impact of Gift Aid donations ### Schemas (`api/schemas.py`) - `UKIncomeInput`, `UKCalculateRequest`, `UKCalculateResponse` - `UKRegionInfo`, `UKRegionsResponse` - `UKDonationDataPoint`, `UKTaxProgramsResponse` ### Dependencies - Added `policyengine-uk>=2.45.0,<2.55.0` (Python 3.12 compatible) - Includes workaround for policyengine-uk dataset attribute bug ## UK Tax System Details Gift Aid provides tax relief in two ways: 1. Charities reclaim 25p per £1 donated (basic rate relief at 20%) 2. Higher rate (40%+) taxpayers claim additional relief personally Supports all UK regions including Scotland (with different tax rates). ## Testing 47 new tests covering: - UK situation creation (18 tests) - UK tax calculations (14 tests) - UK API endpoints (13 tests) All 80 tests pass (existing + new). Closes #58 Related: #60, #61, #62, #63 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Require Python 3.13 and use latest policyengine-uk - Update requires-python to >=3.13,<3.14 - Update policyengine-uk to >=2.55.0 (now 2.62.1) - Remove workaround for dataset attribute bug (fixed in 2.55.0+) - Update black target-version to py313 only 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Update CI to Python 3.13 only Drop Python 3.11 and 3.12 support in CI to match pyproject.toml requirement. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Add httpx to dev dependencies for API testing Required by FastAPI TestClient (starlette.testclient). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Update uv.lock with httpx dependency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix CI: use pytest directly instead of uv run The uv run command creates a fresh virtual environment which doesn't see packages installed via uv pip install --system. Using pytest directly uses the system Python where dev dependencies were installed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Add UK Gift Aid support to frontend - Add country selector toggle (US/UK) with flag icons - Create UKInputForm component with: - Region selector (grouped by nation) - Employment/self-employment income inputs - Gift Aid donation amount with gross-up display - Scottish tax rate indicator - Add UK types, API functions, and React Query hooks - Update Results component to support GBP currency formatting - Update formatCurrency utility to handle USD/GBP 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Upgrade policyengine-uk to 2.63.0 This version includes the Gift Aid Personal Allowance taper fix (PolicyEngine/policyengine-uk#1430) required for accurate UK tax calculations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gift_aid_grossed_upvariable that computes Gift Aid grossed up by basic rategift_aidandpersonal_allowancevariablesProblem
Per ITA 2007 s.58, when calculating the Personal Allowance taper for high earners (£100k-£125k), grossed-up Gift Aid donations should be deducted from Adjusted Net Income. This was not being done, causing donors in this income range to receive less tax relief than legally entitled.
Example: A taxpayer with £110k income making £10k Gift Aid donation:
Test plan
Note on microsim test update
The UC taper reform expected impact was updated from -29.2 to -27.5. This was already stale on master (test would fail on master too) - my changes don't affect this since
gift_aidis 0 in the microdata.Fixes #1431
🤖 Generated with Claude Code