Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions docs/architecture/tla/McpConnectionOwnership.LateDetach.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions docs/architecture/tla/McpConnectionOwnership.LateSetup.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions docs/architecture/tla/McpConnectionOwnership.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions docs/architecture/tla/McpConnectionOwnership.tla
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---- MODULE McpConnectionOwnership ----
EXTENDS Naturals
\* Source: McpHub.deleteConnection removes a connection and awaits SDK cleanup.
\* Sink: isCurrentOAuthConnection gates continuations; cleanup must preserve a replacement.
\* Failure: removing the closing set permits access while the old connection remains registered.
\* Failure: cleanup by server name removes a replacement published during the await.
\* Invariants: NoStaleAccess, ReplacementRetained, and NoLateSetup.
\* Expect: synchronous removal replaces the closing-set guard. No new defect is expected.
\* Cost: one agent; a two-connection model, property tests, and a runtime refactor.
\* Result: fixed holds in 28 states. LateDetach fails at 5, DeleteReplacement at 11, LateSetup at 9.
\* Finding: the refactor needs cancellation to invalidate its reconnect setup permit.
\* Replay: the held HTTP initialize case passes after cancelling the owned setup.
\* Runtime sabotage: late registry removal fails two tests; missing setup cancellation fails one.
\* Review ratchet: PR #2762, follow-up D in the supplied review. Added 1, covered 0, gap 0.
\* Expect: StopReconnect without KeepStoppedRow violates RecoveryVisible.
\* Cost: one agent; row visibility model and real HTTP regression cases.
\* Follow-up result: LostRecoveryRow fails at 10 states. Cancel and timeout fail before the fix.
\* Replay: both error rows are posted to the panel and can restart against a real HTTP server.
\* Runtime sabotage: removing recovery fails the cancel and timeout cases. A later delete still wins.
\* Gap: the model does not describe SDK resource cleanup or browser behavior.
\* Simplification: McpHub.stopOAuthReconnect performs StopReconnect as one synchronous operation.
\* Source: a cancel cleanup on the flow supplies the server name, source, revision, and config.
\* Sink: cleanup starts, and a cancel retains the error row before any await.
\* Expect: existing RecoveryVisible and ReplacementRetained still hold. No new defect is expected.
\* Cost: one agent; function extraction with no extra model state or dependencies.
\* Simplification result: fixed holds in 28 states and all four failure variants still fail.
\* Null result: all 17 HTTP cases pass after extraction. No new runtime defect was found.
\* Runtime sabotage: removing the extracted recovery step fails cancel and timeout cases.
\* The second PR #2762 review (#21, #52) removed the timeout reconnect path and the unused CheckClosing.
\* Simplification: stopOAuthReconnect runs only for a cancel, as a flow cleanup. Model unchanged.
\* Gap: the rediscovery reconnect has no flow. The integration spec covers its removal check.
CONSTANTS DetachBeforeClose, PreserveReplacement, GuardSetup, KeepStoppedRow
\* registered = 3 is a disconnected row with an error and an enabled retry action.
VARIABLES registered, closing, staleAccess, replacementLost, permit, setup, latePublish, recoveryRequired
vars == <<registered, closing, staleAccess, replacementLost, permit, setup, latePublish, recoveryRequired>>
Init ==
/\ registered = 1 /\ closing = 0
/\ staleAccess = FALSE /\ replacementLost = FALSE
/\ permit = TRUE /\ setup = TRUE /\ latePublish = FALSE /\ recoveryRequired = FALSE
BeginClose ==
/\ closing = 0 /\ registered = 1
/\ closing' = 1
/\ registered' = IF DetachBeforeClose THEN 0 ELSE registered
/\ UNCHANGED <<permit, setup, latePublish, recoveryRequired, staleAccess, replacementLost>>
ContinueOld ==
/\ staleAccess' = (staleAccess \/ (registered = 1 /\ closing = 1))
/\ UNCHANGED <<registered, closing, replacementLost, permit, setup, latePublish, recoveryRequired>>
PublishReplacement ==
/\ closing = 1 /\ registered # 2
/\ registered' = 2 /\ recoveryRequired' = FALSE
/\ UNCHANGED <<closing, staleAccess, replacementLost, permit, setup, latePublish>>
CompleteClose ==
/\ closing = 1
/\ registered' = IF PreserveReplacement /\ registered \in {2, 3} THEN registered ELSE 0
/\ closing' = 2
/\ replacementLost' = (replacementLost \/ (registered \in {2, 3} /\ ~PreserveReplacement))
/\ UNCHANGED <<staleAccess, permit, setup, latePublish, recoveryRequired>>
CancelSetup ==
/\ permit' = FALSE
/\ UNCHANGED <<registered, closing, staleAccess, replacementLost, setup, latePublish, recoveryRequired>>
PublishSetup ==
/\ setup
/\ setup' = FALSE
/\ latePublish' = (~permit /\ ~GuardSetup)
/\ UNCHANGED <<registered, closing, staleAccess, replacementLost, permit, recoveryRequired>>
\* A cancellation stops reconnect, but retains an error row. The timer cannot fire during a reconnect.
StopReconnect ==
/\ registered = 2
/\ registered' = IF KeepStoppedRow THEN 3 ELSE 0
/\ recoveryRequired' = TRUE
/\ UNCHANGED <<closing, staleAccess, replacementLost, permit, setup, latePublish>>
NoLateSetup == ~latePublish
RecoveryVisible == recoveryRequired => registered = 3
Next == StopReconnect \/ BeginClose \/ ContinueOld \/ PublishReplacement \/ CompleteClose \/ CancelSetup \/ PublishSetup
Spec == Init /\ [][Next]_vars
TypeOK == /\ registered \in 0..3 /\ closing \in 0..2
/\ staleAccess \in BOOLEAN /\ replacementLost \in BOOLEAN
/\ permit \in BOOLEAN /\ setup \in BOOLEAN /\ latePublish \in BOOLEAN
/\ recoveryRequired \in BOOLEAN
NoStaleAccess == ~staleAccess
ReplacementRetained == ~replacementLost
====
13 changes: 13 additions & 0 deletions docs/architecture/tla/McpOAuthFlowEnd.ClaimTimer.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions docs/architecture/tla/McpOAuthFlowEnd.DeleteLeak.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions docs/architecture/tla/McpOAuthFlowEnd.DisposeLeak.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions docs/architecture/tla/McpOAuthFlowEnd.DoubleClaim.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions docs/architecture/tla/McpOAuthFlowEnd.ErrorLeak.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions docs/architecture/tla/McpOAuthFlowEnd.FinishTimer.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions docs/architecture/tla/McpOAuthFlowEnd.IgnoreOutcome.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions docs/architecture/tla/McpOAuthFlowEnd.ReplaceLeak.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions docs/architecture/tla/McpOAuthFlowEnd.StaleContinuation.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions docs/architecture/tla/McpOAuthFlowEnd.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading