MiniMax M3 · Heavy
feature-can-edit-category-host-relationships-for-embedding-discourse-cursor
Discourse · Ruby · M · 100–299 lines · 6 files
The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.
- Gold bugs found
- 0 of 4
- Comments published
- 6
- Comments matching a bug
- 0
- Comments not matching
- 6
- Cost of this PR
- $0.281
Published comments (6)
SQL injection via string interpolation in INSERT — Interpolating `h` and `category_id` into the `INSERT` lets a stray `'` in legacy `site_settings.value` terminate the SQL literal. Use parameterized placeholders so the values cannot break out.
Migration breaks on host values containing a single quote — Single quotes in legacy `embeddable_hosts` values break the interpolated `INSERT` and abort the upgrade. Sanitize `h` (e.g. doubling quotes) or switch to parameterized insertion.
expandable_first_post? dropped embeddable_hosts guard — After dropping the `SiteSetting.embeddable_hosts.present?` check, `expandable_first_post?` returns true even when no `EmbeddableHost` rows exist and embedding is actually dead. Add `EmbeddableHost.exists?` so the flag reflects runtime capability.
destroy action crashes with NoMethodError when host id is missing — `host.destroy` runs without a nil check, so a bad id raises `NoMethodError` and returns 500. Raise `ActiveRecord::RecordNotFound unless host` before destroying.
expandable_first_post? test with blank embeddable_host no longer tests anything meaningful — With the `SiteSetting.embeddable_hosts = nil` setup removed, "is false if embeddable_host is blank" only asserts defaults and would miss a regression reintroducing that dependency. Rename it or delete it.
before_validation crashes with NoMethodError when host is nil — `before_validation` calls `self.host.sub!` unconditionally, so a missing `:host` param from `Admin::EmbeddableHostsController#save_host` blows up as a 500. Guard with `self.host.to_s.sub!` or skip when blank.
Gold bugs found (0)
None.