Move the hack to fetch completed cards to the insight command logic

We need to rework this as part of the filters revamp. "indexed_by" being
a mix of filters keeps biting us.
This commit is contained in:
Jorge Manrubia
2025-07-24 15:52:57 +02:00
parent fc26329daf
commit 5ad2d09eae
13 changed files with 131645 additions and 41 deletions
+12 -7
View File
@@ -62,6 +62,8 @@ class Command::Ai::TranslatorTest < ActionDispatch::IntegrationTest
end
test "filter by card id" do
assert_command({ context: { card_ids: [ cards(:logo).id ] } }, "this card", context: :card)
assert_command({ context: { card_ids: [ 123 ] } }, "card 123")
assert_command({ context: { card_ids: [ 123, 456 ] } }, "card 123, 456")
assert_command({ commands: [ "/search 123" ] }, "123") # Notice existing cards will be intercepted earlier
@@ -167,19 +169,22 @@ class Command::Ai::TranslatorTest < ActionDispatch::IntegrationTest
vcr_record!
test "get insight" do
assert_command({ context: { indexed_by: "all" }, commands: [ "/insight cards where mike has commented on" ] }, "cards where mike has commented on")
assert_command({ context: { indexed_by: "latest" }, commands: [ "/insight cards similar to 1234" ] }, "cards similar to 1234")
assert_command({ context: { indexed_by: "latest" }, commands: [ "/insight cards where mike has commented on" ] }, "cards where mike has commented on")
assert_command({ context: { assignee_ids: ["jz"] }, commands: [ "/insight cards where mike has commented" ] }, "cards where mike has commented assigned to jz")
assert_command({ context: { indexed_by: "latest" }, commands: [ "/insight are there blockers here?" ] }, "are there blockers here?")
assert_command({ context: { indexed_by: "all" }, commands: [ "/insight stuff that jz has done lately" ] }, "stuff that jz has done lately")
assert_command({ context: { indexed_by: "latest" }, commands: [ "/insight stuff that jz has done lately" ] }, "stuff that jz has done lately")
assert_command({ context: { indexed_by: "latest" }, commands: [ "/insight challenging cards" ] }, "challenging cards")
assert_command({ context: { indexed_by: "all" }, commands: [ "/insight who is everywhere?" ] }, "who is everywhere?")
assert_command({ context: { indexed_by: "all" }, commands: [ "/insight who is overloaded" ] }, "who is overloaded")
assert_command({ context: { indexed_by: "latest" }, commands: [ "/insight who is everywhere?" ] }, "who is everywhere?")
assert_command({ context: { indexed_by: "latest" }, commands: [ "/insight who is overloaded" ] }, "who is overloaded")
assert_command({ commands: [ "/insight summarize this" ] }, "summarize this")
assert_command({ commands: [ "/insight summarize this" ] }, "summarize this", context: :card)
assert_command({ context: { indexed_by: "latest" }, commands: [ "/insight cards similar to this one" ] }, "cards similar to this one", context: :card)
assert_command({ commands: [ "/insight summarize" ] }, "summarize", context: :card)
assert_command({ commands: [ "/insight are there blockers?" ] }, "are there blockers?", context: :card)
assert_command({ context: { indexed_by: "all" }, commands: [ "/insight cards with much activity" ] }, "cards with much activity")
assert_command({ context: { indexed_by: "latest" }, commands: [ "/insight cards with much activity" ] }, "cards with much activity")
end
test "combine commands and filters" do