What is uncovered
DynamicIslandChatButton.messagesForSession filters which chat turns render in session history.
Its predicate now admits only turn.type == "normal"; the previously-admitted "task_result"
branch was removed when scheduled-task execution was taken out of the app.
That predicate has no test coverage in either direction:
- no test asserts a
"normal" turn renders,
- no test asserts a non-
"normal" turn does not.
Why it was left uncovered
messagesForSession is a private func on a View struct carrying ~20 property wrappers, so it
cannot be reached from a test as written. Covering it requires extracting the predicate into a
pure, testable helper — a production change wider than the deletion that exposed the gap, so it
was deliberately not bundled into that change.
Suggested fix
Extract the turn-admission predicate into a pure function over the turn's type (a free function or
a static member — no View instance, no property wrappers), have messagesForSession call it, and
test it directly.
Per the repo's refactoring rule, write the characterisation tests first against current
behaviour, verify they pass, then extract, then verify the same tests still pass.
Acceptance
- A test proves a
"normal" turn is admitted.
- A test proves an unknown/other turn type is rejected, and that test fails if the predicate is
widened back to admit it (red-first, so it pins the invariant rather than the current spelling).
- The invariant under test is only explicitly-admitted turn types render, not a fact about any
one type name.
What is uncovered
DynamicIslandChatButton.messagesForSessionfilters which chat turns render in session history.Its predicate now admits only
turn.type == "normal"; the previously-admitted"task_result"branch was removed when scheduled-task execution was taken out of the app.
That predicate has no test coverage in either direction:
"normal"turn renders,"normal"turn does not.Why it was left uncovered
messagesForSessionis aprivate funcon aViewstruct carrying ~20 property wrappers, so itcannot be reached from a test as written. Covering it requires extracting the predicate into a
pure, testable helper — a production change wider than the deletion that exposed the gap, so it
was deliberately not bundled into that change.
Suggested fix
Extract the turn-admission predicate into a pure function over the turn's type (a free function or
a static member — no
Viewinstance, no property wrappers), havemessagesForSessioncall it, andtest it directly.
Per the repo's refactoring rule, write the characterisation tests first against current
behaviour, verify they pass, then extract, then verify the same tests still pass.
Acceptance
"normal"turn is admitted.widened back to admit it (red-first, so it pins the invariant rather than the current spelling).
one type name.