Fix circular dependency in NY A06774 Enhanced CDCC reform#7428
Open
DTrim99 wants to merge 2 commits intoPolicyEngine:mainfrom
Open
Fix circular dependency in NY A06774 Enhanced CDCC reform#7428DTrim99 wants to merge 2 commits intoPolicyEngine:mainfrom
DTrim99 wants to merge 2 commits intoPolicyEngine:mainfrom
Conversation
Use cdcc_potential instead of cdcc in the NY A06774 reform formula to avoid circular dependency through income_tax_before_credits. The cdcc variable depends on cdcc_credit_limit which depends on income_tax_before_credits, creating a cycle when ny_cdcc (a refundable credit) affects state income tax through SALT deduction. Fixes PolicyEngine#7427 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7428 +/- ##
=======================================
Coverage 70.80% 70.80%
=======================================
Files 3871 3871
Lines 55779 55779
Branches 276 276
=======================================
Hits 39492 39492
Misses 16286 16286
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PavelMakarchuk
requested changes
Feb 18, 2026
| # Calculate the enhanced credit (110% of federal CDCC potential) | ||
| # Use cdcc_potential instead of cdcc to avoid circular dependency | ||
| # (cdcc depends on cdcc_credit_limit which depends on income_tax_before_credits) | ||
| federal_cdcc_potential = tax_unit("cdcc_potential", period) |
Collaborator
There was a problem hiding this comment.
can you add tests to make sure this works
Add 5 new tests to verify the circular dependency fix works: - Married filing jointly with two earners - Explicit cdcc_potential calculation verification - Maximum expenses stress test - Income just above threshold boundary case - Low income with maximum CDCC rate All 10 tests pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Collaborator
Author
Fixes AppliedTests Added for
|
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
Fixes #7427
The NY A06774 Enhanced Child and Dependent Care Credit reform had a circular dependency that caused simulation crashes. The reform's
ny_cdccformula was callingcdcc, which depends oncdcc_credit_limit, which in turn depends onincome_tax_before_credits. Sinceny_cdccis a refundable credit that affects state income tax (which feeds into SALT deduction), this created a cycle.Changes
cdccwithcdcc_potentialin the reform formulacdcc_potentialcalculates the credit value (expenses × rate) without the credit limit, avoiding the dependency cycleTest plan
Related