Files
Pulse/Sources/PulseUI/Helpers
Bartosz Dolewski 07f1008abe Fix SIGTRAP in NetworkTaskEntity.state(in:) when session UUID is NULL
NetworkTaskEntity.session is declared @NSManaged var session: UUID
(non-optional), but the matching attribute in LoggerStore+Model.swift
is created without explicitly setting isOptional = false:

    Attribute("session", .UUIDAttributeType),

NSAttributeDescription.isOptional defaults to true, so Core Data
permits NULL for session. Rows that end up with a NULL session (e.g.
data persisted under an older schema and carried through lightweight
migration) trap on read: the implicit ObjC->Swift UUID bridge calls
UUID._unconditionallyBridgeFromObjectiveC, which fires SIGTRAP on nil.

The only PulseUI read site is FileViewModelContext.swift:52, hit
transitively from ConsoleFormatter.status(for:store:) while rendering
ConsoleTaskCell.

Switch that read to value(forKey:) so a NULL stored value is surfaced
as Optional.none instead of trapping the bridge. Semantics are preserved:
- For valid rows, the comparison behaves exactly as before.
- For NULL-session rows, the cast yields nil, the comparison nil != sessionID
  is true, and the function returns nil — matching the existing doc
  comment ("returns nil if the task is an unknown state ... from the
  previous app run").
2026-05-15 12:24:35 +02:00
..