Record moderator actions on ticket status updates with explicit action details#150
Draft
Record moderator actions on ticket status updates with explicit action details#150
Conversation
Co-authored-by: alexgarel <144788+alexgarel@users.noreply.github.com>
Co-authored-by: alexgarel <144788+alexgarel@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix empty moderators_actions table in production
Record moderator actions on ticket status updates
Mar 6, 2026
alexgarel
reviewed
Mar 9, 2026
Comment on lines
+490
to
+495
| ModeratorActionModel.create( | ||
| action_type=f"set_status_{status.value}", | ||
| user_id=user_id, | ||
| ticket=ticket, | ||
| created_at=datetime.now(timezone.utc), | ||
| ) |
Member
There was a problem hiding this comment.
Ok the code is really correct, but it does not bring new information if we do that.
So What we should do instead is: add a parameter, so that the caller can explain what was done.
I propose to add an "action" parameter which is free text.
The documentation should suggest those terms: "fix", "edit", "dismiss".
We will change the frontend on the other end to use this new parameter.
Author
There was a problem hiding this comment.
Implemented in 344124f. PUT /tickets/{ticket_id}/status now accepts optional free-text action, stores it in moderator_actions.action_type, and documents suggested values (fix, edit, dismiss). If omitted or whitespace-only, it falls back to set_status_<status>.
Co-authored-by: alexgarel <144788+alexgarel@users.noreply.github.com>
Author
Copilot
AI
changed the title
Record moderator actions on ticket status updates
Record moderator actions on ticket status updates with explicit action details
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
moderator_actionsexisted in schema but was never written during moderation workflows, leaving production without an audit trail of ticket decisions. This change wires status updates to persistent moderator action logging and now lets callers specify what moderation action was performed.Status update now writes audit records
PUT /api/v1/tickets/{ticket_id}/statuscreates aModeratorActionModelrow whenever a moderator changes ticket status.action_type,user_id,ticket_id,created_at.New optional
actionparameter for richer audit logsPUT /api/v1/tickets/{ticket_id}/statusnow accepts an optional free-textactionparameter.fix,edit,dismiss.actionis omitted or whitespace-only, it falls back toset_status_<status>to preserve previous behavior.Auth dependency now returns normalized actor identity
auth_dependencyreturns user payload and normalizes a canonicaluser_idfield (with safe fallback to"unknown"), so moderation endpoints can consistently attribute actions.Focused coverage for the new behavior
"unknown"when moderator identity is unavailable,Example of the new write path:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.