Spec requirement
RTL4g: "If the channel is in the FAILED state, the attach request sets its errorReason to null." After a successful re-attach from FAILED, the channel's errorReason should be cleared.
Current behavior
errorReason persists from the FAILED state through a successful re-attach. In realtimechannel.ts line ~843, notifyState() only sets errorReason when reason is truthy:
if (reason) {
this.errorReason = reason;
}
When a successful ATTACHED arrives (no error), reason is falsy, so the old errorReason from the FAILED state is never cleared.
Root cause
notifyState() in realtimechannel.ts treats errorReason as write-only-on-error. There is no code path that sets it back to null after initial construction (this.errorReason = null in the constructor). The fix would be something like this.errorReason = reason || null; or an explicit clear when entering attached.
Related
- specification#459 — proposed spec clarification that a successful attach should clear errorReason
- specification#461 — clarify whether errorReason should be cleared after a clean detach
UTS tests
RTL4g - errorReason cleared on re-attach from FAILED in test/uts/realtime/unit/channels/channel_attributes.test.ts
RTL4g - errorReason cleared on re-attach and detach in test/uts/realtime/unit/channels/channel_attributes.test.ts
RTL4c - errorReason after successful re-attach (deviation) in test/uts/realtime/unit/channels/channel_state_events.test.ts
Found via UTS (Universal Test Specification) compliance testing.
┆Issue is synchronized with this Jira Task by Unito
Spec requirement
RTL4g: "If the channel is in the FAILED state, the attach request sets its errorReason to null." After a successful re-attach from FAILED, the channel's
errorReasonshould be cleared.Current behavior
errorReasonpersists from the FAILED state through a successful re-attach. Inrealtimechannel.tsline ~843,notifyState()only setserrorReasonwhenreasonis truthy:When a successful ATTACHED arrives (no error),
reasonis falsy, so the olderrorReasonfrom the FAILED state is never cleared.Root cause
notifyState()inrealtimechannel.tstreatserrorReasonas write-only-on-error. There is no code path that sets it back tonullafter initial construction (this.errorReason = nullin the constructor). The fix would be something likethis.errorReason = reason || null;or an explicit clear when enteringattached.Related
UTS tests
RTL4g - errorReason cleared on re-attach from FAILEDintest/uts/realtime/unit/channels/channel_attributes.test.tsRTL4g - errorReason cleared on re-attach and detachintest/uts/realtime/unit/channels/channel_attributes.test.tsRTL4c - errorReason after successful re-attach (deviation)intest/uts/realtime/unit/channels/channel_state_events.test.tsFound via UTS (Universal Test Specification) compliance testing.
┆Issue is synchronized with this Jira Task by Unito