Files
openclaw/apps/macos/Tests/OpenClawIPCTests/TextSummarySupportTests.swift
Peter Steinberger 76cb418b6f fix(macos): reopen AI choice, fix daemon error text, hand onboarding off to the dashboard custodian (#117921)
* fix(macos): let onboarding replace an auto-connected AI

The AI page auto-tests the best detected candidate and connects without
asking, then hides every alternative route. Add 'Choose a different AI'
to the connected banner: a re-detect pass with auto-activation
suppressed that ends at the picker (candidates, provider sign-in, API
keys). Also disable the manual key Connect button while another test
runs (submitManualKey silently dropped the tap), and isolate a test
that read the machine's real resume store.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(macos): surface real daemon errors past the Node banner

Gateway daemon failures summarized as 'Node.js v26.5.1' because the
summary takes the last non-empty line and Node fatal errors end with a
version banner. Drop trailing banner lines and prefer the last
error-shaped line above them; all other output keeps its last line.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(macos): hand onboarding off to the dashboard custodian

Native onboarding now ends once inference verifies: welcome, connection,
install (when needed), AI setup. Finish opens the dashboard at
/custodian?onboarding=1, where the custodian onboarding owns memory
import, channels, app recommendations, and the hatch (browser-first per
the onboarding redesign). The native memory-import and permissions
pages leave the first-run flow; 'Set up later' keeps the native ready
page. The native navigation bridge gains a validated optional search
field so the handoff can request onboarding chrome; the URL fallback
carries the query alongside the token fragment.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor(macos): delete the unreachable native memory-import module

The dashboard handoff removed the memory-import page from every flow,
leaving the module reachable only from tests. CI's dead-code scan
rightly flagged the first orphans; remove the whole path (model, page,
mascot wiring, tests) instead of trimming symbol by symbol. The
dashboard's own memory-import surface owns the feature.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Peter Steinberger <steipete@mac-studio-sf2.local>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-02 02:57:25 -07:00

51 lines
1.8 KiB
Swift

import Testing
@testable import OpenClaw
struct TextSummarySupportTests {
@Test func `keeps the last line for plain output`() {
#expect(TextSummarySupport.summarizeLastLine("first\nsecond") == "second")
}
@Test func `returns nil for blank output`() {
#expect(TextSummarySupport.summarizeLastLine(" \n\t\n") == nil)
}
@Test func `truncates long lines`() {
let summary = TextSummarySupport.summarizeLastLine(String(repeating: "x", count: 300))
#expect(summary?.count == 200)
#expect(summary?.hasSuffix("…") == true)
}
@Test func `surfaces the error line instead of the Node version banner`() {
let nodeFatal = """
node:internal/modules/cjs/loader:1215
throw err;
^
Error: Cannot find module '/Users/example/dist/index.js'
at Function._resolveFilename (node:internal/modules/cjs/loader:1212:15)
at node:internal/main/run_main_module:36:49 {
code: 'MODULE_NOT_FOUND'
}
Node.js v26.5.1
"""
#expect(TextSummarySupport.summarizeLastLine(nodeFatal)
== "Error: Cannot find module '/Users/example/dist/index.js'")
}
@Test func `falls back to the last real line when no error line precedes the banner`() {
let output = "some diagnostic\nNode.js v26.5.1"
#expect(TextSummarySupport.summarizeLastLine(output) == "some diagnostic")
}
@Test func `banner-only output keeps the banner`() {
#expect(TextSummarySupport.summarizeLastLine("Node.js v26.5.1") == "Node.js v26.5.1")
}
@Test func `does not jump to old error lines without a banner`() {
let output = "Error: transient\nretrying\ndone"
#expect(TextSummarySupport.summarizeLastLine(output) == "done")
}
}