Repository navigation
fix(comments): a failed comment publish no longer leaves every model unguarded - #298
Merged
Merged
Conversation
…insert no longer leaves every model unguarded in a long-lived worker
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v1.6.69 #298 +/- ##
===================================================
Coverage 100.00% 100.00%
- Complexity 8269 8271 +2
===================================================
Files 453 454 +1
Lines 26441 26442 +1
===================================================
+ Hits 26441 26442 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 12, 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.
What
Comment::publish()calledstatic::unguard()and only calledstatic::reguard()after a successful insert. When the insert throws (for example a comment posted with no subject), the global unguarded flag stays on. Under Octane the worker lives on, so every model in that worker becomes unguarded:isFillable()answers true for any key, so request parameters becomewhereclauses. Two of the errors seen wereUnknown column 'with_gateways'on networks andUnknown column 'viewMode'on categories.Unknown column 'certificate'on notification channels.publish()now wraps the insert instatic::unguarded(fn () => static::create($attributes)). That restores the guard in afinally, even when the insert throws.Validation
it leaves models guarded when publishing a comment fails, publishes a comment twice with the same primary key. It fails against the old code and passes with the fix.php-cs-fixeris clean.networks?with_gateways=1returned 500. After an Octane reload and this fix, the same requests succeed, and a failing comment no longer leaks.Notes