mirror of
https://github.com/block/buzz.git
synced 2026-11-28 20:22:39 +00:00
Speed up mobile Solo chat creation and agent discovery (#8547)
## Summary Solo compose now opens before agent discovery finishes, and chat creation avoids full channel-list reloads while overlapping independent reads. Durable retries, ownership checks, and relay confirmation remain intact. The agent picker uses the owner's saved inventory, excludes known archived identities, verifies profiles off the UI thread, and reuses avatar artwork. ### Related issue No matching issue found. Related: #8546 adds project selection to the same compose surface. ### Testing - Full mobile suite: 3,755 passed, 19 skipped; four additional artifact tests passed. - Analysis, formatting, file-size checks, and iOS Release build passed. - Regression tests fail when the old blocking paths are restored. - Installed on a physical iPhone with existing profile/community settings preserved. Owner tested the earlier creation/picker improvements; final compose timing awaits device feedback. No timing recording captured. --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
This commit is contained in:
@@ -6,6 +6,8 @@ struct MeAgentAccessibilityTests {
|
||||
@MainActor static func main() {
|
||||
for locked in [false, true] {
|
||||
for empty in [false, true] {
|
||||
let savedName = "Saved agent"
|
||||
var submitted: [String: String]?
|
||||
let controller = NativeProfileTextEditorViewController(
|
||||
title: "New chat", initialValue: "Chat", placeholder: "Chat name",
|
||||
multiline: false, pageBackgroundColor: .systemGroupedBackground,
|
||||
@@ -14,8 +16,8 @@ struct MeAgentAccessibilityTests {
|
||||
channelDescription: nil, originalName: nil, originalDescription: nil,
|
||||
canEditDetails: true, canEditCanvas: false, canvasContent: "",
|
||||
canvasLoaded: false,
|
||||
chatOptions: ["fieldsLocked": locked, "assistants": empty ? [] : [["id": "agent", "name": "Agent"]]],
|
||||
onCancel: {}, onSet: { _ in }
|
||||
chatOptions: ["selectedAssistant": "agent", "savedAssistant": ["id": "agent", "name": savedName], "presentationId": "test", "assistantsLoading": empty, "fieldsLocked": locked, "assistants": empty ? [] : [["id": "agent", "name": "Agent"]]],
|
||||
onCancel: {}, onSet: { submitted = $0 as? [String: String] }
|
||||
)
|
||||
controller.loadViewIfNeeded()
|
||||
precondition(controller.numberOfSections(in: controller.tableView) == 3)
|
||||
@@ -27,10 +29,45 @@ struct MeAgentAccessibilityTests {
|
||||
precondition(project.isEnabled == !locked)
|
||||
precondition(project.showsMenuAsPrimaryAction && project.menu != nil)
|
||||
let cell = controller.tableView(controller.tableView, cellForRowAt: IndexPath(row: 0, section: 2))
|
||||
let content = cell.contentConfiguration as! UIListContentConfiguration
|
||||
precondition(content.text == (empty ? (locked ? savedName : "Choose an agent") : "Agent"))
|
||||
precondition((content.image != nil) == (locked || !empty))
|
||||
let disabled = locked || empty
|
||||
precondition(cell.accessibilityTraits.contains(.notEnabled) == disabled)
|
||||
precondition(cell.accessibilityTraits.contains(.button) == !disabled)
|
||||
precondition((cell.selectionStyle == .none) == disabled)
|
||||
let canSubmit = locked || !empty
|
||||
precondition(controller.navigationItem.rightBarButtonItem?.isEnabled == canSubmit)
|
||||
// Invoke the action even when disabled to check its independent gate.
|
||||
_ = controller.perform(NSSelectorFromString("setTapped"))
|
||||
precondition(submitted?["assistant"] == (canSubmit ? "agent" : nil))
|
||||
if empty && !locked {
|
||||
controller.tableView.frame = CGRect(x: 0, y: 0, width: 390, height: 844)
|
||||
controller.tableView.reloadData()
|
||||
controller.tableView.layoutIfNeeded()
|
||||
precondition(controller.tableView(controller.tableView, titleForFooterInSection: 1) == nil)
|
||||
precondition(controller.tableView(controller.tableView, titleForFooterInSection: 2) == "Loading agents…")
|
||||
controller.updateChatAssistants([
|
||||
"presentationId": "test",
|
||||
"assistants": [["id": "agent", "name": "Agent"]],
|
||||
])
|
||||
controller.tableView.layoutIfNeeded()
|
||||
let updated = controller.tableView.cellForRow(at: IndexPath(row: 0, section: 2))!
|
||||
precondition(updated.accessibilityTraits.contains(.button))
|
||||
precondition(!updated.accessibilityTraits.contains(.notEnabled))
|
||||
precondition(controller.tableView(controller.tableView, titleForFooterInSection: 2) == nil)
|
||||
}
|
||||
submitted = nil
|
||||
controller.updateChatAssistants([
|
||||
"presentationId": "test",
|
||||
"assistants": empty ? [] : [["id": "agent", "name": "Agent"]],
|
||||
])
|
||||
let refreshedCell = controller.tableView(controller.tableView, cellForRowAt: IndexPath(row: 0, section: 2))
|
||||
let refreshed = refreshedCell.contentConfiguration as! UIListContentConfiguration
|
||||
precondition(refreshed.text == (empty ? (locked ? savedName : "Choose an agent") : "Agent"))
|
||||
precondition(controller.navigationItem.rightBarButtonItem?.isEnabled == canSubmit)
|
||||
_ = controller.perform(NSSelectorFromString("setTapped"))
|
||||
precondition(submitted?["assistant"] == (canSubmit ? "agent" : nil))
|
||||
}
|
||||
}
|
||||
avatarTests()
|
||||
|
||||
Reference in New Issue
Block a user