Skip to content

Sampler silently ignores modifier condition evaluation failures #121

@RandomOscillations

Description

@RandomOscillations

Summary

Modifier condition evaluation failures are currently logged as warnings and treated as "modifier does not apply." This can silently disable intended logic and flatten distributions.

Why This Matters

A malformed or mismatched when condition should not quietly degrade behavior in critical runs.

Current Behavior (Code)

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

  • apply_modifiers_and_sample(...) wraps eval_condition(...) in try/except (line ~59-66)
  • exceptions are logged and ignored

In /Users/adithyasrinivasan/Projects/extropy/extropy/utils/eval_safe.py:

  • default condition failures return False (line ~272)

Expected Behavior

For strict-quality sampling, condition-eval failures should fail validation/sampling (or at least be escalated), not become silent no-ops.

Proposed Fix

  1. Add strict mode behavior for modifier condition errors:
  • collect structured errors (attribute, modifier index, condition, exception)
  • fail sampling when any occur (in strict mode)
  1. Keep permissive mode for backward compatibility, but expose counts in output.

  2. Improve diagnostics:

  • include offending condition string and referenced unknown values/names where possible.

Tests

  • malformed condition causes strict sampling failure
  • permissive mode logs and continues with explicit warning count
  • valid conditions unaffected

Acceptance Criteria

  • No silent modifier disablement in strict runs.
  • Users can reliably detect condition-eval failures before trusting sample outputs.

Pipeline Impact

Prevents hidden rule dropouts in step 3 and reduces iterative debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions