Skip to content

Fix the Social Security state-machine test helper for Core 3.39.0 - #11657

Merged
hua7450 merged 2 commits into
mainfrom
fix-ss-state-backend-core-339
Dec 1, 2026
Merged

hua7450 merged 2 commits into
mainfrom
fix-ss-state-backend-core-339

Conversation

@hua7450

@hua7450 hua7450 commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #11658

Fixes the test_social_security_input_state_machine.py failure that started on every PR after policyengine-core 3.39.0 was released.

What and why

CI installs the newest compatible Core on each run. Core 3.39.0, released on December 1, 2026 at 3:10pm EST, adds read-only simulations. The test's helper, _social_security_state_backend.py, runs selected Core method bodies inside a small fixture. Those bodies now use three things the fixture lacked:

Core 3.39.0 change What the fixture lacked Fix
_cache_result, _calculate, get_branch, _bind_to_tax_benefit_system and _invalidate_all_caches read self.read_only The attribute read_only = False on the fixture's Simulation. The fixture never makes a simulation read-only
Write routes in the simulation, holder, builder and helpers first call refuse_on_read_only, and calculation routes call make_non_writable for a read-only simulation Both names in the namespace the bodies run in Both are taken from Core when it has them
Holder.delete_arrays calls a new Holder._delete_arrays The method Added to the selected holder methods when Core has it

The first failure was AttributeError: 'DelegatingSimulation' object has no attribute 'read_only' in "Full Suite - Rest (Python shard 1)" on #11235, whose shard started ten minutes after the release.

Each addition depends on the installed Core, so the helper still works with the locked Core 3.37.2. No model code changes.

Test plan

  • policyengine_us/tests/core/test_social_security_input_state_machine.py passes locally against Core 3.39.0 and against the locked Core 3.37.2. It failed against 3.39.0 before the change. No other test imports the helper.
  • I diffed every Core body the helper selects between 3.38.0 and 3.39.0, and the three changes in the table are all of them. A scan of the global names those bodies look up finds no new unresolved name under 3.39.0: the same three as under 3.37.2 (Reform, psutil and tools), on routes the test does not reach.
  • Policy YAML tests: not applicable.
  • Source conflicts: not applicable.
  • make format: ruff format --check and ruff check pass on the changed file.
  • Changelog fragment in changelog.d/

axiom: n/a: test helper only; no policy change

🤖 Generated with Claude Code

Core 3.39.0 adds read-only simulations. The Core bodies this helper selects
now read Simulation.read_only, call refuse_on_read_only and
make_non_writable, and route Holder.delete_arrays through a new
_delete_arrays. Give the fixture each of them when the installed Core has it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@hua7450
hua7450 merged commit 1408c29 into main Dec 1, 2026
36 checks passed
@hua7450
hua7450 deleted the fix-ss-state-backend-core-339 branch December 1, 2026 22:02
@PavelMakarchuk PavelMakarchuk mentioned this pull request Dec 1, 2026
3 of 5 tasks
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.

Social Security input state-machine test fails on policyengine-core 3.39.0

1 participant