Skip to content

The agent that grows with you

test(bot-mode): favor behavior over source assertions

Goktug Vatandas7af25a92b06b
diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.js b/apps/desktop/src/plugins/hermes-bots/plugin.js
index 16368aa5e2b..aa9454e12df 100644
--- a/apps/desktop/src/plugins/hermes-bots/plugin.js
+++ b/apps/desktop/src/plugins/hermes-bots/plugin.js
@@ -7309,9 +7309,9 @@ function ActiveNowStrip({ roster, activeProfile, gatewayState, metaByName, onOpe
})
}
-/** Manage a bot's group-chat memberships. Existing groups are independent
- * toggles; the input creates and joins a new one. The canonical groups array
- * and legacy scalar projection both ride ui_meta like pin/title. */
+/** Assign a bot to a group-chat membership without replacing its others.
+ * Existing groups are independent toggles; the input creates and joins a new
+ * one. Canonical groups + the legacy scalar projection ride ui_meta. */
function GroupDialog({ bot, onClose }) {
const meta = useValue($botMeta)
const [name, setName] = useState('')
diff --git a/apps/desktop/src/plugins/hermes-bots/tests/active-now-strip.test.mjs b/apps/desktop/src/plugins/hermes-bots/tests/active-now-strip.test.mjs
index 3859adced78..59d0a36c700 100644
--- a/apps/desktop/src/plugins/hermes-bots/tests/active-now-strip.test.mjs
+++ b/apps/desktop/src/plugins/hermes-bots/tests/active-now-strip.test.mjs
@@ -90,7 +90,7 @@ test('ActiveNowStrip renders above the roster, is a live region, and is click-ac
assert.match(source, /jsx\('button', \{\s*type: 'button',\s*title: `Open \$\{label\}'s chat`/)
// The key rides as jsx()'s third argument — the ONLY form React treats as
// a list key; a `key:` prop leaves chips unkeyed (index identity).
- assert.match(source, /\}, botRosterKey\(bot\)\)\s*\}\)\s*\]\s*\}\)\s*\}\s*\/\*\* Manage a bot's group-chat memberships/s)
+ assert.match(source, /\}, botRosterKey\(bot\)\)\s*\}\)\s*\]\s*\}\)\s*\}\s*\/\*\* Assign a bot to a group/s)
assert.match(source, /jsx\(BotFace,\s*\{[\s\S]*?mood: 'work'/)
assert.match(source, /let pinnedChat = botRosterMeta\(bot, allMeta\)\?\.chat/)
assert.match(source, /await prepareBotSource\(bot, pinnedChat\)/)
diff --git a/apps/desktop/src/plugins/hermes-bots/tests/create-group-chat.test.mjs b/apps/desktop/src/plugins/hermes-bots/tests/create-group-chat.test.mjs
index f4e6f8b9dac..1eb1e1e57fa 100644
--- a/apps/desktop/src/plugins/hermes-bots/tests/create-group-chat.test.mjs
+++ b/apps/desktop/src/plugins/hermes-bots/tests/create-group-chat.test.mjs
@@ -21,16 +21,9 @@ test('source contract: create-group modal has search, checkboxes, name, create',
assert.match(pluginSource, /const visible = filterBots\(roster, allMeta, query\)/)
// Selection is checkbox-driven and capped at the room member limit.
assert.match(pluginSource, /const atCap = selected\.length >= GROUP_CHAT_MAX_MEMBERS/)
- // Create requires 2+ members and appends to the canonical multi-group field
- // without replacing existing memberships.
+ // Create requires 2+ members. Membership mutation is covered by the
+ // behavioral groupMembershipPatch tests rather than another source regex.
assert.match(pluginSource, /selected\.length >= 2/)
- assert.match(
- pluginSource,
- /groupMembershipPatch\(botRosterMeta\(bot, allMeta\), groupName, true\)/
- )
- // Existing membership labels enumerate every canonical group.
- assert.match(pluginSource, /const currentGroups = botGroups\(meta\)/)
- assert.match(pluginSource, /currentGroups\.map\(group => `“\$\{group\}”`\)\.join\(', '\)/)
// Creating drops the user straight into the room (main window when the
// desktop offers host.openWorkspace, in-panel fallback otherwise).
assert.match(pluginSource, /onCreated: groupName => openGroupChat\(groupName\)/)
diff --git a/apps/desktop/src/plugins/hermes-bots/tests/roster-groups.test.mjs b/apps/desktop/src/plugins/hermes-bots/tests/roster-groups.test.mjs
index 2081192ca31..f4a58bdcefb 100644
--- a/apps/desktop/src/plugins/hermes-bots/tests/roster-groups.test.mjs
+++ b/apps/desktop/src/plugins/hermes-bots/tests/roster-groups.test.mjs
@@ -189,16 +189,12 @@ test('stripPreviewMarkdown: flattens bold, quotes, code, and links out of previe
assert.equal(stripPreviewMarkdown(''), '')
})
-test('source contract: the roster stays flat while the row menu manages multiple groups', () => {
+test('source contract: the roster stays a flat list of bot and group rows', () => {
// Ordering is deliberately unchanged in this PR; sectioned ordering follows separately.
assert.doesNotMatch(pluginSource, /function groupRoster\(/)
assert.match(pluginSource, /rosterRows\.map\(row =>/)
assert.match(pluginSource, /function GroupRow\(/)
assert.match(pluginSource, /onGroup: setGrouping/)
- assert.match(pluginSource, /'Manage groups…'/)
- assert.match(pluginSource, /!bot\.remoteSource\s*\? jsx\(ContextMenuItem, \{\s*onSelect: \(\) => onGroup\(bot\)/)
- assert.match(pluginSource, /botGroups\(meta\[bot\?\.name\]\)/)
- assert.match(pluginSource, /groupMembershipPatch\(meta\[bot\.name\], group, enabled\)/)
})
test('source contract: group rows carry the needs-you badge and open via openGroupChat', () => {