Skip to content

DNP: Extend UserRestrictionHistory to record matched restriction instances - #25337

Closed
jasonBirchall wants to merge 1 commit into
masterfrom
addonsops-2230
Closed

DNP: Extend UserRestrictionHistory to record matched restriction instances#25337
jasonBirchall wants to merge 1 commit into
masterfrom
addonsops-2230

Conversation

@jasonBirchall

@jasonBirchall jasonBirchall commented Aug 24, 2026

Copy link
Copy Markdown

I gave up in this attempt and decided to go with #25344

When a RestrictionChecker fails we currently record only which
restriction class it failed on, not which specific restriction row
matched. The matching row is known at the point of failure, but then
discarded. so the reviewers and Redash can see "an email restriction
fired" and never "becaude of the pattern *@example.com" for example.

This add the schema to hold that, but it doesn't actually wire it up
just yet:

- restriction_type, upload and version on UserRestrictionHistory, so a
record says which action was being checked and what it applied to.
Existing records predate them, the request-based paths have no upload,
and the version is only known after the check runs.

- UserRestrictionHistoryMatch, holding one row per matched restriction.
A child model rather than fields, because a single failed check can
match several restrictions. The link is a generic foreign key since
matches span five restriction models, alongside a snapshot of str() at
match time.

A failure with no matches is legitimate and the schema allows it: some
restrictions classes are not backed by the database at all. The ones
that are can deny structurally without any row being involved.
@jasonBirchall

Copy link
Copy Markdown
Author

closed by #25344

@jasonBirchall jasonBirchall changed the title WIP: Extend UserRestrictionHistory to record matched restriction instances DNP: Extend UserRestrictionHistory to record matched restriction instances Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant