Skip to content

Publish only the person entity as is_person - #765

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

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

Conversation

@vahid-ahmadi

Copy link
Copy Markdown
Contributor

Fixes #764

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 the model version would publish two person entities. That fails test_model_entities.py, which blocks UK release certification. It also breaks the API catalog's "exactly one person entity" check and makes the app offer firm inputs as person variables.

_populate_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. The tests add a fake-system regression and use the key rule for the country check. The UK pin accepts an optional trailing ("firm", "firms", False) row, so they pass on both the pinned policyengine-uk 2.177.7 and the firm release.

🤖 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 the model version published
two person entities (person and firm), which breaks the "exactly one person
entity" contract in the API catalog and misroutes firm inputs in the app.

Derive is_person by comparing each entity's key with the key of the first
is_person entity (core's own person_entity rule). Keys, not identity: a
cloned core system copies its person entity.

Tests: a fake-system regression test with a trailing firm entity, the
country-model check now uses the person_entity key rule, and the UK pin
accepts an optional trailing ("firm", "firms", False) row so the tests pass
on both the pinned policyengine-uk 2.177.7 and the firm release.

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

This branch has not been deployed

No deployments
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.

Model version publishes the new UK firm entity as a person

1 participant