Skip to content

Validator missing overlap detection for categorical/boolean modifiers under last-wins semantics #122

@RandomOscillations

Description

@RandomOscillations

Summary

Categorical and boolean modifier application uses last-wins semantics, but validators do not detect ambiguous overlapping conditions. This makes behavior depend on modifier order and can unintentionally flatten distributions.

Why This Matters

When multiple conditions can match the same agent, the final outcome may be dominated by whichever modifier appears last, not intended policy.

Current Behavior (Code)

In /Users/adithyasrinivasan/Projects/extropy/extropy/population/sampler/modifiers.py:

  • categorical: last weight_overrides wins (line ~195-216)
  • boolean: last probability_override wins (line ~225-236)

Validators check syntax/references and some semantics, but not overlap ambiguity for these last-wins paths.

Proposed Fix

  1. Add static overlap analysis for categorical/boolean modifiers on each attribute:
  • detect pairs/groups of conditions that can co-match
  • flag as warning/error depending on strictness
  1. Require explicit policy annotation for overlapping sets:
  • exclusive (must be mutually exclusive) OR
  • ordered_override (intentional precedence)
  1. In strict mode, fail if overlap is detected without explicit precedence policy.

Tests

  • overlapping modifiers without policy -> strict fail
  • mutually exclusive modifiers -> pass
  • intentional ordered override with explicit policy -> pass

Acceptance Criteria

  • Accidental overlap is surfaced before sampling.
  • Teams can encode intentional precedence explicitly.

Pipeline Impact

Addresses the exact "last wins flattening" class of bugs seen in real runs.

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