GPT-6.1 Sol · 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
- 4 of 4
- Comments published
- 8
- Comments matching a bug
- 4
- Comments not matching
- 4
- Cost of this PR
- $2.123
Published comments (8)
Unquoted host settings allow SQL injection during migration — An apostrophe in persisted `h` can break the SQL statement or inject SQL executed with migration privileges. Quote `h` with the database adapter or use a parameterized insert.
Host validation rejects valid top-level domains longer than five letters — The `host` validation rejects valid embedding domains such as `example.technology` and `example.museum`, which the previous hostname comparison supported. Remove the obsolete five-character top-level-domain limit.
Mixed-case URL hostnames are incorrectly rejected — Legitimate mixed-case URLs fail embedding authorization and topic retrieval because `URI.host` preserves case while `lower(host)` normalizes only the stored value. Compare against `host.downcase` and add mixed-case URL and configuration tests.
Empty embed category query result aborts the migration — An unset or stale `embed_category` produces no rows, so indexing the first result raises `NoMethodError` and aborts the migration before the `category_id` fallback. Read the row safely and fall back to the uncategorized category when no match exists.
Migrated embeddable hosts retain schemes and paths that prevent matching — Previously working scheme-prefixed hosts stop authorizing embedding because `EmbeddableHost.record_for_host` compares against `URI(url).host`, while these SQL inserts bypass model normalization. Strip the scheme and path from `h` consistently with the model before storing migrated entries.
Allowed hosts with ports never match request URLs — A saved `host` such as `example.com:8080` passes validation but never matches because `uri.host` excludes the port, causing embedding to be rejected. Either reject port-qualified entries or normalize and match them consistently.
Saving Uncategorized clears the displayed host category — The server replaces a null chooser value with `uncategorized_category_id`, but `Category.findById(null)` clears the displayed category until reload. Resolve the category from the saved `host` object's returned `category_id` instead of `categoryId`.
Host-absence test passes without exercising the expansion prerequisites — The test passes even if `expandable_first_post?` ignores host presence because `embed_truncate` and a topic embed are missing. Replace it with the intended no-host behavior, or enable those prerequisites if host absence should still prevent expansion.
Gold bugs found (4)
Gold bugs missed (0)
None.