Skip to content

Enforce signed UK parity counts, directions, and magnitudes in code #772

Description

@MaxGhenis

The signed register says water moved about +0.10 and entity counts moved
person +32 / benunit −12, but the verifier only matches surface, column,
expectation, and entity
(packages/microcosm-build/src/microcosm/build/uk_runtime/signed_differences.py:124-184;
tools/verify_uk_spine_parity.py:124-188). On current main, missing candidate
counts and counts set to 1 both matched the count entry with no unsigned
difference; water moving from 0.776937 to 0.0 also matched the
positive-direction entry. Commit 76e39f9b fixes entity scope but does not
enforce the quantitative facts.

Acceptance criteria:

  • Represent and validate exact expected counts or bounded count deltas.
  • Represent and validate signed direction and bounded magnitude for share and
    total entries.
  • Add adversarial tests for omitted counts, implausible counts, reversed
    direction, and out-of-bound magnitude.

From the post-merge verification of #747 (round-1 review + fresh reproductions on merged main); full evidence: https://github.com/PolicyEngine/microcosm/blob/review/pr-747-audit/REVIEW-747.md

🤖 Filed by the microcosm owner session with Claude Code

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