Skip to content

feat(FOSMVVM): task(error:) twins + unified async cancellation contract - #136

Merged
foscomputerservices merged 5 commits into
mainfrom
feat/task-error-twin
Aug 21, 2026
Merged

feat(FOSMVVM): task(error:) twins + unified async cancellation contract#136
foscomputerservices merged 5 commits into
mainfrom
feat/task-error-twin

Conversation

@foscomputerservices

Copy link
Copy Markdown
Owner

Summary

Adds the error-routing twins of SwiftUI's task modifiers — task(error:priority:_:) and task(id:error:priority:_:) — completing the async error surface begun in 0.13.0: view-lifetime and value-keyed loads now deposit thrown errors into the same screen-level error: binding the async Button forms feed, presented by one alert(error:).

The arc also ratified a unified cancellation contract, applied to both families (a behavior change to the 0.13.0 button engine):

  • Cancellation never reaches error, of any provenance: a cancelled invocation deposits nothing, and the language's CancellationError sentinel type is filtered even from a non-cancelled invocation — making the quiet exit (throw CancellationError to end with nothing presented) a supported idiom.
  • The filter is sentinel-only; domain-vocabulary cancellation errors (URLError.cancelled etc.) deposit and present normally.
  • Every discarded outcome emits a debug notice.

Documentation

  • New DocC article Async Action Lifecycle and Cancellation (AsyncLifecycle.md) — the ratified semantic contract, walked situation-by-situation with sequence diagrams against one rooted screen; nine walkthroughs, each ending with the rule it demonstrates.
  • AsyncActionsAndErrors.md gains a View-Lifetime Loads section and cross-links the new article.
  • Generator skills (fosmvvm-swiftui-view-generator, fosmvvm-ui-tests-generator) retire the hand-caught .task { do/catch } interim; plugin 2.28.0.
  • API catalog: new task entry, updated button/alert entries, LocalizableErrorOptions gap covered; audit 0 gaps / 0 stale.

Testing

  • 9 new AsyncTaskTests pin the twin's contract through AsyncTaskEngine.run (clear-on-launch, outcomes, cancellation incl. the raced-genuine-failure discard, the id-restart race, sentinel filter + boundary, compile surface).
  • 3 new AsyncButtonActivityTests pin the sentinel filter and discard semantics in the button engine.
  • Full suite passes: 781 tests across all targets.

AsyncLifecycle.md walks the async error/lifecycle contract situation-by-
situation with sequence diagrams against one rooted screen; ratified as
the semantic contract for the .task(error:) twin arc, including the
CancellationError sentinel filter and discard logging. The plan file
carries the ratified design and decomposition.
…nding

The engine's deposit guard now filters the CancellationError sentinel
type in addition to the invocation-cancelled check: a CancellationError
thrown by a non-cancelled invocation is discarded, making the quiet
exit a supported idiom. Filter is sentinel-only; domain-vocabulary
cancellation errors still deposit. All discarded outcomes emit a debug
notice. Contract documented in the AsyncLifecycle DocC article; pinned
by three new AsyncButtonActivityTests.
Twins of SwiftUI's task(priority:_:) and task(id:priority:_:): the
action becomes throwing, and a thrown error lands in the required
error: binding, cleared on each start. Cancellation — view
disappearance, an id-change restart, or the CancellationError sentinel
— never reaches the binding; discards emit a debug notice. Both
overloads forward to AsyncTaskEngine.run, pinned by AsyncTaskTests.
Contract documented in the AsyncLifecycle DocC article.
Retires the hand-caught .task { do/catch } interim from the view-
generator and ui-tests-generator skills; the wiring article gains a
View-Lifetime Loads section and cross-links AsyncLifecycle from the
Overview.
Adds the FOSMVVM § SwiftUI Support catalog entry for the task(error:)
twins, updates the button/alert entries for the unified cancellation
contract, covers the LocalizableErrorOptions catalog gap from 0.13.0,
and indexes the new reach in the discovery skill and CLAUDE.md.
Catalog audit: 0 gaps, 0 stale. Full test suite passes (781 tests).
@foscomputerservices
foscomputerservices merged commit 6159fa1 into main Aug 21, 2026
13 checks passed
@foscomputerservices
foscomputerservices deleted the feat/task-error-twin branch August 21, 2026 09:39
foscomputerservices added a commit that referenced this pull request Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant