Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(openhuman-core): remove unused test files and fix chat edit affordance test

Steven Enamakelcba523a7dc04
diff --git a/app/test/playwright/specs/chat-user-message-edit-affordance.spec.ts b/app/test/playwright/specs/chat-user-message-edit-affordance.spec.ts
index 63536acb1a..d90d7e9486 100644
--- a/app/test/playwright/specs/chat-user-message-edit-affordance.spec.ts
+++ b/app/test/playwright/specs/chat-user-message-edit-affordance.spec.ts
@@ -101,20 +101,28 @@ test.describe('User-message action bar — capability-gated affordances (#5897)'
await setMockBehavior('llmForcedResponses', JSON.stringify([{ content: REPLY }]));
});
- test('no Edit button is offered while the runtime cannot edit', async ({ page }) => {
+ test('the Edit button opens the vendored EditMessage composer', async ({ page }) => {
const input = await openChat(page);
const userMessage = await sendOneTurn(page, input, 'a message to hover');
- // Hover is the state in which the action bar reveals its controls, so this
- // is the moment the dead button used to appear.
+ // Hover is the state in which the action bar reveals its controls.
await userMessage.hover();
await page.waitForTimeout(300);
- await expect(page.locator('.aui-user-action-edit')).toHaveCount(0);
+ const editButton = page.locator('.aui-user-action-edit');
+ await expect(editButton).toHaveCount(1);
+ await editButton.click();
- // And no edit composer can be reached, which is the reason the button had
- // to go rather than be left in place.
- await expect(page.locator('.aui-edit-composer-input')).toHaveCount(0);
+ // The vendored `EditMessage` element's editing state: a textarea seeded
+ // with the original text, plus its Cancel/Send controls.
+ const editTextarea = page.getByRole('textbox', { name: 'Edit your message' });
+ await expect(editTextarea).toBeVisible();
+ await expect(editTextarea).toHaveValue('a message to hover');
+
+ // Cancel exits the composer without truncating the thread.
+ await page.getByRole('button', { name: 'Cancel' }).click();
+ await expect(editTextarea).toHaveCount(0);
+ await expect(page.getByText('a message to hover')).toBeVisible();
});
test('the action bar itself still renders after the Edit button is withheld', async ({
diff --git a/crates/openhuman-core/src/commands/ops.rs b/crates/openhuman-core/src/commands/ops.rs
index cf463b85d5..cd417f8dad 100644
--- a/crates/openhuman-core/src/commands/ops.rs
+++ b/crates/openhuman-core/src/commands/ops.rs
@@ -17,7 +17,10 @@ const BUILTINS: &[(&str, &str)] = &[
("/new", "Start a new conversation"),
("/clear", "Clear the current conversation"),
("/plan", "Switch to plan mode (draft without side effects)"),
- ("/build", "Switch to build mode (resume normal tool execution)"),
+ (
+ "/build",
+ "Switch to build mode (resume normal tool execution)",
+ ),
("/goal", "Set or view this thread's goal"),
("/todo", "View or manage the thread's todo list"),
("/stop", "Stop the current run"),
@@ -61,11 +64,7 @@ async fn invoke(
}
}
-fn entries_from_array(
- value: &Value,
- array_field: &str,
- kind: CommandKind,
-) -> Vec<CommandEntry> {
+fn entries_from_array(value: &Value, array_field: &str, kind: CommandKind) -> Vec<CommandEntry> {
let Some(items) = value.get(array_field).and_then(Value::as_array) else {
return Vec::new();
};
diff --git a/crates/openhuman-core/src/commands/ops_tests.rs b/crates/openhuman-core/src/commands/ops_tests.rs
index 8832d8799c..07b9ae726b 100644
--- a/crates/openhuman-core/src/commands/ops_tests.rs
+++ b/crates/openhuman-core/src/commands/ops_tests.rs
@@ -6,7 +6,10 @@ fn builtin_entries_cover_every_documented_slash_command() {
let entries = builtin_entries();
let ids: Vec<&str> = entries.iter().map(|e| e.id.as_str()).collect();
for expected in ["new", "clear", "plan", "build", "goal", "todo", "stop"] {
- assert!(ids.contains(&expected), "missing builtin {expected}: {ids:?}");
+ assert!(
+ ids.contains(&expected),
+ "missing builtin {expected}: {ids:?}"
+ );
}
}
@@ -14,7 +17,10 @@ fn builtin_entries_cover_every_documented_slash_command() {
fn every_builtin_carries_its_own_insert_text() {
for entry in builtin_entries() {
assert_eq!(entry.kind, CommandKind::Builtin);
- let insert = entry.insert.as_deref().expect("builtins always insert text");
+ let insert = entry
+ .insert
+ .as_deref()
+ .expect("builtins always insert text");
assert!(insert.starts_with('/'), "{insert}");
assert_eq!(insert.trim_start_matches('/'), entry.id);
}
@@ -61,7 +67,10 @@ async fn commands_list_always_includes_every_builtin_even_if_catalogs_fail() {
let outcome = commands_list().await.expect("commands_list must not fail");
let ids: Vec<&str> = outcome.value.iter().map(|e| e.id.as_str()).collect();
for expected in ["new", "clear", "plan", "build", "goal", "todo", "stop"] {
- assert!(ids.contains(&expected), "missing builtin {expected}: {ids:?}");
+ assert!(
+ ids.contains(&expected),
+ "missing builtin {expected}: {ids:?}"
+ );
}
let builtin_count = outcome
.value
diff --git a/crates/openhuman-core/src/commands/schemas_tests.rs b/crates/openhuman-core/src/commands/schemas_tests.rs
index d0e1decb9f..51c4c6e22c 100644
--- a/crates/openhuman-core/src/commands/schemas_tests.rs
+++ b/crates/openhuman-core/src/commands/schemas_tests.rs
@@ -30,7 +30,9 @@ fn unknown_function_falls_back_to_an_error_schema() {
async fn handle_list_returns_every_builtin() {
use serde_json::Map;
- let value = handle_list(Map::new()).await.expect("handler must not fail");
+ let value = handle_list(Map::new())
+ .await
+ .expect("handler must not fail");
// Bare (no logs) or wrapped ({"result": ...}) — read through both.
let commands = value
.get("result")
@@ -43,6 +45,9 @@ async fn handle_list_returns_every_builtin() {
.filter_map(|c| c.get("id").and_then(|v| v.as_str()))
.collect();
for expected in ["new", "clear", "plan", "build", "goal", "todo", "stop"] {
- assert!(ids.contains(&expected), "missing builtin {expected}: {ids:?}");
+ assert!(
+ ids.contains(&expected),
+ "missing builtin {expected}: {ids:?}"
+ );
}
}
diff --git a/crates/openhuman-core/src/commands/types_tests.rs b/crates/openhuman-core/src/commands/types_tests.rs
index 653c5807dc..a4af5a26b5 100644
--- a/crates/openhuman-core/src/commands/types_tests.rs
+++ b/crates/openhuman-core/src/commands/types_tests.rs
@@ -2,9 +2,18 @@ use super::*;
#[test]
fn command_kind_serializes_snake_case() {
- assert_eq!(serde_json::to_string(&CommandKind::Builtin).unwrap(), "\"builtin\"");
- assert_eq!(serde_json::to_string(&CommandKind::Skill).unwrap(), "\"skill\"");
- assert_eq!(serde_json::to_string(&CommandKind::Workflow).unwrap(), "\"workflow\"");
+ assert_eq!(
+ serde_json::to_string(&CommandKind::Builtin).unwrap(),
+ "\"builtin\""
+ );
+ assert_eq!(
+ serde_json::to_string(&CommandKind::Skill).unwrap(),
+ "\"skill\""
+ );
+ assert_eq!(
+ serde_json::to_string(&CommandKind::Workflow).unwrap(),
+ "\"workflow\""
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
index b6ed310f24..9eeaf619f1 100644
--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
@@ -425,7 +425,7 @@ async fn openhuman_jwt_slug_discloses_pinned_model() {
descriptor: EgressDescriptor::network_fetch(sentinel),
thread_id: None,
client_id: None,
- request_id: None,
+ request_id: None,
});
let mut count = 0usize;
@@ -483,7 +483,7 @@ async fn native_claude_turn_routes_disclose_pinned_models() {
descriptor: EgressDescriptor::network_fetch(sentinel),
thread_id: None,
client_id: None,
- request_id: None,
+ request_id: None,
});
let mut sdk_count = 0usize;
diff --git a/crates/openhuman-core/src/inference/provider/factory_egress_fallback_tests.rs b/crates/openhuman-core/src/inference/provider/factory_egress_fallback_tests.rs
index a763c3c88d..2515b81534 100644
--- a/crates/openhuman-core/src/inference/provider/factory_egress_fallback_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_egress_fallback_tests.rs
@@ -29,7 +29,7 @@ async fn create_chat_model_managed_emits_exactly_one_egress_realpath() {
descriptor: EgressDescriptor::network_fetch(sentinel),
thread_id: None,
client_id: None,
- request_id: None,
+ request_id: None,
});
let mut count = 0usize;
@@ -81,7 +81,7 @@ async fn create_chat_model_local_runtime_does_not_emit_egress_realpath() {
descriptor: EgressDescriptor::network_fetch(sentinel),
thread_id: None,
client_id: None,
- request_id: None,
+ request_id: None,
});
loop {