Skip to content

fix(comments): a failed comment publish no longer leaves every model unguarded - #298

Merged
roncodes merged 2 commits into
release/v1.6.69from
fix/comment-publish-unguard
Oct 12, 2026
Merged

roncodes merged 2 commits into
release/v1.6.69from
fix/comment-publish-unguard

Conversation

@roncodes

Copy link
Copy Markdown
Member

What

Comment::publish() called static::unguard() and only called static::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 become where clauses. Two of the errors seen were Unknown column 'with_gateways' on networks and Unknown column 'viewMode' on categories.
  • Payload keys that are not columns are inserted. One error seen was Unknown column 'certificate' on notification channels.

publish() now wraps the insert in static::unguarded(fn () => static::create($attributes)). That restores the guard in a finally, even when the insert throws.

Validation

  • A new test, 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.
  • The existing comment tests pass, and php-cs-fixer is clean.
  • Reproduced in a local console: after a failed note, networks?with_gateways=1 returned 500. After an Octane reload and this fix, the same requests succeed, and a failing comment no longer leaks.

Notes

@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (0a08e12) to head (f3fe0b1).
⚠️ Report is 5 commits behind head on release/v1.6.69.

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     
Flag Coverage Δ
backend 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roncodes
roncodes merged commit cbf13c5 into release/v1.6.69 Oct 12, 2026
5 checks passed
@roncodes
roncodes deleted the fix/comment-publish-unguard branch October 12, 2026 13:18
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