KogenCredo.Diff.Rules.ChangesetWeakened (KogenCredo v0.1.0)

View Source

changeset-weakened: a changed function lost validations or gained a sensitive cast field.

Reported when, comparing the function plus the same-module helpers it reaches:

  • a validate_* or *_constraint call (for example validate_length, unique_constraint) present at the base for a field is gone at the head, including a field dropped from the list of validate_required;
  • a field in option :cast_sensitive_fields (default [:is_admin, :admin, :role, :user_id, :tenant_id, :account_id, :organization_id, :owner_id, :confirmed_at, :password_hash]) was added to a cast list.

Calls are keyed by name and literal field atoms, so changing a validator's options is not noticed, and a local validator call without field atoms is keyed by name only.

Limits

Validation moved to another module, fields cast through a module attribute or variable, and validate_change/custom validators that are renamed are invisible or look like a loss. The fact is reported, intent decides. Advisory by default; no precision has been measured.