Skip to content

Describe only the person entity as a person in country metadata - #4339

Draft
vahid-ahmadi wants to merge 1 commit into
masterfrom
firm-entity-is-person
Draft

vahid-ahmadi wants to merge 1 commit into
masterfrom
firm-entity-is-person

Conversation

@vahid-ahmadi

Copy link
Copy Markdown
Contributor

Fixes #4338

policyengine-core flags any root population with no members as is_person. policyengine-uk's new firm entity (PolicyEngine/policyengine-uk#2940) is one, so /uk/metadata would describe firm with is_person: true. app-v2 would then offer the firm inputs as person variables, and calculating would fail with household_variable_wrong_entity.

build_entities now sets is_person only for the entity whose key matches the first is_person entity, which is core's person_entity rule. It compares keys rather than identity because cloned systems copy the person entity. This matches the policyengine.py fix (PolicyEngine/policyengine.py#765), which the v2 catalog's "exactly one person entity" check relies on.

🤖 Generated with Claude Code

policyengine-core flags any root population with no members as is_person.
policyengine-uk's new firm entity is one, so /uk/metadata would describe
firm with is_person true and the app would offer firm inputs as person
variables. build_entities now sets is_person only for the entity whose key
matches the first is_person entity (core's person_entity rule); keys rather
than identity because a cloned system copies its person entity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.59%. Comparing base (80a42dd) to head (c13c4f1).

Files with missing lines Patch % Lines
policyengine_api/country.py 66.66% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (66.66%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4339      +/-   ##
==========================================
- Coverage   93.63%   93.59%   -0.04%     
==========================================
  Files         408      408              
  Lines       23282    23284       +2     
  Branches     3648     3649       +1     
==========================================
- Hits        21799    21793       -6     
- Misses        868      875       +7     
- Partials      615      616       +1     
Flag Coverage Δ
integration 57.79% <0.00%> (-0.01%) ⬇️
unit 90.92% <66.66%> (-0.04%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch was previously deployed

1 inactive deployment
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.

Country metadata describes the new UK firm entity as a person

1 participant