Gemini 3.8 Flash · Balanced

feature-can-edit-category-host-relationships-for-embedding-discourse-cursor

Discourse · Ruby · M · 100–299 lines · 6 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
1 of 4
Comments published
2
Comments matching a bug
1
Comments not matching
1
Cost of this PR
$0.381

Published comments (2)

highbugdb/migrate/20150818190757_create_embeddable_hosts.rb:9-16

NoMethodError when category settings are absent from site_settings — Missing `embed_category` or `uncategorized_category_id` records in `site_settings` crash the migration when indexing the empty query result. Check `cmd_tuples` on the result before accessing `[0]`.

mediumbugapp/models/embeddable_host.rb:5-8

Calling sub! raises NoMethodError when host is nil — A `nil` `host` crashes the callback before validation can handle it. Guard the `sub!` calls with `self.host.present?` so missing hosts fail validation cleanly.

Gold bugs found (1)

highThe migration reads execute(...)[0]['id'] for embed_category without checking for an empty result, so installs without that setting stored crash the migration instead of falling back to the uncategorized category.

Gold bugs missed (3)

mediumAfter saving a host, the component overwrites its category with findById(categoryId); when no category was chosen this is null even though the server saved the uncategorized category, so the row shows no category until reload.
highHosts saved with a port (allowed by the validation regex) are stored as host:port, but lookup compares only URI.host, so those configured hosts never match and embedding fails for them.
highEmbeddableHost's host format validation only accepts TLDs of 2-5 letters, so admins cannot add embeddable hosts on longer TLDs like example.technology.