• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive-studio / 29571051485

17 Jul 2026 09:44AM UTC coverage: 71.713% (+0.5%) from 71.204%
29571051485

Pull #2475

github

samuv
fix(chat): harden Effect runtime adapters after external review

Make readiness and runtime retrieval atomic, type adapter programs against
ChatServices, and tighten domain-error narrowing plus agent/settings edge cases.

Co-authored-by: Cursor <cursoragent@cursor.com>
Pull Request #2475: refactor(chat): migrate main-process chat to Effect domain services

5476 of 8187 branches covered (66.89%)

871 of 1363 new or added lines in 42 files covered. (63.9%)

1 existing line in 1 file now uncovered.

8153 of 11369 relevant lines covered (71.71%)

137.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/main/src/chat/runtime/logging.ts
1
import { Effect, Logger, LogLevel } from 'effect'
2
import log from '../../logger'
3

4
const electronLogger = Logger.make(
13✔
5
  ({ logLevel, message, cause, annotations }) => {
6
    const prefix = `[CHAT/${logLevel.label}]`
34✔
7
    const annotationSuffix =
8
      Object.keys(annotations).length > 0
34!
9
        ? ` ${JSON.stringify(annotations)}`
10
        : ''
11
    const text = `${prefix} ${message}${annotationSuffix}`
34✔
12

13
    if (logLevel._tag === 'Error' || logLevel._tag === 'Fatal') {
34!
NEW
14
      if (cause._tag === 'Fail') {
×
NEW
15
        log.error(text, cause.error)
×
16
      } else {
NEW
17
        log.error(text)
×
18
      }
NEW
19
      return
×
20
    }
21

22
    if (logLevel._tag === 'Warning') {
34✔
23
      log.warn(text)
2✔
24
      return
2✔
25
    }
26

27
    if (logLevel._tag === 'Debug' || logLevel._tag === 'Trace') {
32!
NEW
28
      log.debug(text)
×
NEW
29
      return
×
30
    }
31

32
    log.info(text)
32✔
33
  }
34
)
35

36
export const ChatLoggerLayer = Logger.replace(
13✔
37
  Logger.defaultLogger,
38
  electronLogger
39
)
40

41
export const ChatLogLevelLayer = Logger.minimumLogLevel(LogLevel.Info)
13✔
42

43
export function chatLogInfo(message: string): Effect.Effect<void> {
44
  return Effect.logInfo(message)
32✔
45
}
46

47
export function chatLogWarning(message: string): Effect.Effect<void> {
48
  return Effect.logWarning(message)
2✔
49
}
50

51
export function chatLogError(
52
  message: string,
53
  cause?: unknown
54
): Effect.Effect<void> {
NEW
55
  return cause === undefined
×
56
    ? Effect.logError(message)
57
    : Effect.logError(message, cause)
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc