Skip to content

Sim's model of reports lacks the required type and ck_reports_type, which API v1 adds #1208

Done

Description

@anth-volk

API v1's v2 revision 24b571d7d079 (PolicyEngine/policyengine-api#4400, D1 · 8) sets each report's type from its household and window size where they differ, makes reports.type NOT NULL, and adds the check ck_reports_type:

type IN ('economy', 'household', 'budget_window')
AND (type = 'household') = (household_id IS NOT NULL)
AND (type = 'budget_window') = (budget_window_size IS NOT NULL)

Sim's Report model in libs/policyengine-simulation-persistence/src/policyengine_simulation_persistence/tables.py declares type as optional with no check. test_the_models_match_the_public_api_tables compares the models with API v1's tables constraint by constraint (rule sim.persistence.models-match-public-api), so from #4400's merge on it fails against API v1's master: the weekly drift run fails, and no PR can move public-api-commit past that merge.

The tests that write reports into API v1's database must also follow the check once the pin moves. Some insert reports with no type, and some store a type the check refuses so they can test the re-run's refusal of such rows.

Done when:

  • Report.type is NOT NULL and Report declares ck_reports_type with API v1's text.
  • libs/policyengine-simulation-persistence/public-api-commit names #4400's merge commit, so the comparison and the weekly drift run pass.
  • Every test that writes reports writes a type the check accepts. The re-run's refusal of a missing, unknown or disagreeing type stays, tested without a database, because production rows may hold one until API v1's revision runs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions