Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

A supplied UC latent deduction rate can give deductions to a unit flagged as having none

Abierto
#2,739 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
57/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

Read uc_deduction_rate, uc_latent_deduction_rate and _reduction_allocation.py to trace how a supplied rate and the protected floor affect deductions. Add the requested YAML case with a positive supplied rate, uc_has_deduction set to False and a floor, plus the property or documented exception described in the issue. Check that the example unit and the current law and protected floor cases behave as intended.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

What happens

A supplied uc_latent_deduction_rate can produce UC deductions for a benefit unit whose uc_has_deduction is False.

  • uc_latent_deduction_rate's formula returns where(has_deduction, rate, 0), so the formula path never gives an unflagged unit a positive rate.
  • uc_deduction_rate reads the latent rate, not the flag. A rate supplied as an input, by a dataset or a user situation, therefore skips the flag.
  • Under current law this shows only when the unit has award left after the cap. allocate_uc_reductions takes deductions from max(pre-cap award − gross cap − penny, 0).
  • Under a protected floor it also shows when the gross cap takes the whole award. The floor branch (_reduction_allocation.py, floor_deductions = …) takes deductions from the pre-cap award. Meanwhile uc_has_deduction reads the award left after the gross cap, so it is False for that unit.

Example (from the independent review of #2647, with an 85% protected floor): EXAMPLE_UNITS[5] gets uc_deductions of £720.25 with uc_has_deduction False, and an applied cap of 0. Under current law the same unit has deductions of 0 and an applied cap of £1,000.

How often on the certified Microcosm file

None. The UK hub's #2647 runs on Microcosm build a6299504 (28–29 October) counted units with uc_deductions > 0 and uc_has_deduction False:

Run Benefit-unit records Weighted units Amount
Head, current law, each year 2025–2030 0 0 £0
Base and head, benefit cap at £5,000, 2025 0 0 £0
Base and head, 85% protected floor, 2025 0 0 £0

So Microcosm's stored latent rates agree with the flag. The gap is reachable only through a supplied rate that disagrees with it.

Fix: pick one

  1. Make the deduction demand zero when uc_has_deduction is False, for example in uc_deduction_rate, so that a supplied rate follows the same rule as the formula path.
  2. Or document that a supplied uc_latent_deduction_rate overrides the flag, and say why.

Separately, decide what the flag should mean under a floor. It reads the award left after the gross cap. That is "no award left, so no deductions" under current law, but under a floor the family keeps an award that deductions can come from.

Either way, add:

  • a YAML case with a supplied positive latent rate, uc_has_deduction False and a floor;
  • a property that uc_deductions is 0 whenever the flag is False, or the documented exception.

Context

This came up as finding P3-6 in the independent review of #2647. That PR doesn't cause it: its awards and deductions equal the reference. But it shapes what benefit_cap_reduction reports under a floor.

axiom: n/a: uc_has_deduction and uc_latent_deduction_rate are imputations under gov.simulation, not law; the protected floor is JRF's proposal, zero under current law.

Lenguaje dominante
Python
Estrellas
53
Forks
34
Merge medio
4 d 54 min
PR fusionados (30 d)
381

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PolicyEngine/policyengine-uk

Todos los issues de PolicyEngine/policyengine-uk

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.