Skip to content

[AIT-667] spec/ait: align AIT-ST4b with turn-lifecycle error pattern#452

Open
JoaoDiasAbly wants to merge 1 commit intoai-transport-featuresfrom
AIT-667/align-turn-start-error-handling
Open

[AIT-667] spec/ait: align AIT-ST4b with turn-lifecycle error pattern#452
JoaoDiasAbly wants to merge 1 commit intoai-transport-featuresfrom
AIT-667/align-turn-start-error-handling

Conversation

@JoaoDiasAbly
Copy link
Copy Markdown
Contributor

Summary

Aligns AIT-ST4b (turn-start publish failure) with the rejection-only error pattern adopted for AIT-ST5c and AIT-ST7b in PR #449.

Context

PR #449 reworked server-transport error handling so that awaited lifecycle methods surface publish failures via promise rejection only, with an Ably.ErrorInfo(TurnLifecycleError) wrapping the underlying error as cause. The per-turn onError callback is reserved for paths with no other signal — streamResponse stream errors (AIT-ST6b3) and onCancel handler failures (AIT-ST9a).

AIT-ST4b still carried the pre-existing "invoke onError and re-throw" wording. That was intentionally left out of PR #449's scope to keep it focused on what its branch name declared; this PR is the promised follow-up.

Change

Spec point Change
AIT-ST4b Turn-start publish failure must reject with an Ably.ErrorInfo (code TurnLifecycleError) wrapping the underlying error as cause. onError is not invoked.

Wording now matches AIT-ST5c and AIT-ST7b verbatim in structure.

Test plan

  • Reads consistently with AIT-ST5c and AIT-ST7b (same pattern, same phrasing)
  • No remaining "invoke onError and re-throw" references in specifications/ai-transport-features.md
  • Companion implementation PR in ably-ai-transport-js already removed onError from start()'s catch block, so no code change is blocked on this

🤖 Generated with Claude Code

AIT-ST4b (turn-start publish failure) previously said onError must be
invoked and the error re-thrown. PR #449 reworked ST5c and ST7b to the
rejection-only pattern: the method must reject with an Ably.ErrorInfo
carrying code TurnLifecycleError and wrapping the underlying error as
cause, and onError must NOT be invoked.

This brings ST4b in line with ST5c and ST7b.

Per the project's single-delivery-channel rule, awaited methods must
not surface the same error through both rejection and onError. Since
start() is awaited, rejection is the sole delivery channel; onError is
reserved for paths with no other signal (streamResponse stream errors
in AIT-ST6b3, onCancel handler failures in AIT-ST9a).

Scope: deliberately left out of PR #449 to keep that PR's scope to its
branch name; this is the promised follow-up.

Refs: AIT-667

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JoaoDiasAbly
Copy link
Copy Markdown
Contributor Author

I've already merged the other PRs, this is just a follow-up to improve something that was flagged after I've applied the changes you've requested in the original PR ably/ably-ai-transport-js#60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant