@fairfox/polly 0.15.7 → 0.15.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ SPECIFICATION Spec
4
4
  CONSTANTS
5
5
  Contexts = {background, content, popup}
6
6
  MaxMessages = 4
7
- MaxTabId = 2
7
+ Tabs = {0, 1, 2}
8
8
  TimeoutLimit = 3
9
9
 
10
10
  \* Invariants to check
@@ -19,7 +19,7 @@ EXTENDS Integers, Sequences, FiniteSets, TLC
19
19
  CONSTANTS
20
20
  Contexts, \* Set of all contexts: {"background", "content", "popup", ...}
21
21
  MaxMessages, \* Bound on number of messages (for model checking)
22
- MaxTabId, \* Maximum tab ID
22
+ Tabs, \* Set of tab identifiers (integers or model values for symmetry)
23
23
  TimeoutLimit \* Message timeout threshold
24
24
 
25
25
  VARIABLES
@@ -156,7 +156,7 @@ TimeoutMessage(msgIndex) ==
156
156
  Next ==
157
157
  \/ \E c \in Contexts : ConnectPort(c)
158
158
  \/ \E c \in Contexts : DisconnectPort(c)
159
- \/ \E src \in Contexts : \E targetSet \in (SUBSET Contexts \ {{}}) : \E tab \in 0..MaxTabId : \E msgType \in {"msg1", "msg2"} : SendMessage(src, targetSet, tab, msgType)
159
+ \/ \E src \in Contexts : \E targetSet \in (SUBSET Contexts \ {{}}) : \E tab \in Tabs : \E msgType \in {"msg1", "msg2"} : SendMessage(src, targetSet, tab, msgType)
160
160
  \/ \E i \in 1..Len(messages) : RouteMessage(i)
161
161
  \/ CompleteRouting
162
162
  \/ \E i \in 1..Len(messages) : TimeoutMessage(i)
@@ -603,12 +603,15 @@ class TLAGenerator {
603
603
  for (let i = 0;i < this.tabCount; i++) {
604
604
  lines.push(` Tab${i} = Tab${i}`);
605
605
  }
606
+ const tabValues = Array.from({ length: this.tabCount }, (_, i) => `Tab${i}`).join(", ");
607
+ lines.push(` Tabs = {${tabValues}}`);
606
608
  } else if ("maxTabs" in messages && messages.maxTabs !== undefined) {
607
- lines.push(` MaxTabId = ${messages.maxTabs}`);
609
+ const tabValues = Array.from({ length: messages.maxTabs + 1 }, (_, i) => i).join(", ");
610
+ lines.push(` Tabs = {${tabValues}}`);
608
611
  } else if (hasProjectConstant) {
609
- lines.push(" MaxTabId = 0");
612
+ lines.push(" Tabs = {0}");
610
613
  } else {
611
- lines.push(" MaxTabId = 1");
614
+ lines.push(" Tabs = {0, 1}");
612
615
  }
613
616
  lines.push(" TimeoutLimit = 3");
614
617
  }
@@ -954,8 +957,6 @@ class TLAGenerator {
954
957
  this.line(tabConstants.join(", "));
955
958
  this.indent--;
956
959
  this.line("");
957
- this.line(`Tabs == {${tabConstants.join(", ")}}`);
958
- this.line("");
959
960
  this.line("TabSymmetry == Permutations(Tabs)");
960
961
  this.line("");
961
962
  const hasMessageSymmetry = this.symmetrySets.length > 0 && this.symmetrySets[0] === "Symmetry";
@@ -1724,8 +1725,7 @@ class TLAGenerator {
1724
1725
  if (hasValidHandlers) {
1725
1726
  this.line("\\/ \\E c \\in Contexts : ConnectPort(c) /\\ UNCHANGED <<contextStates, payload>>");
1726
1727
  this.line("\\/ \\E c \\in Contexts : DisconnectPort(c) /\\ UNCHANGED <<contextStates, payload>>");
1727
- const tabSet = this.tabSymmetryEnabled ? "Tabs" : "0..MaxTabId";
1728
- this.line(`\\/ \\E src \\in Contexts : \\E targetSet \\in (SUBSET Contexts \\ {{}}) : \\E tab \\in ${tabSet} : \\E msgType \\in UserMessageTypes :`);
1728
+ this.line("\\/ \\E src \\in Contexts : \\E targetSet \\in (SUBSET Contexts \\ {{}}) : \\E tab \\in Tabs : \\E msgType \\in UserMessageTypes :");
1729
1729
  this.indent++;
1730
1730
  this.line("SendMessage(src, targetSet, tab, msgType) /\\ UNCHANGED <<contextStates, payload>>");
1731
1731
  this.indent--;
@@ -6234,4 +6234,4 @@ main().catch((error) => {
6234
6234
  process.exit(1);
6235
6235
  });
6236
6236
 
6237
- //# debugId=A9938BA1A7CCD3B464756E2164756E21
6237
+ //# debugId=30BEA370D0E300CD64756E2164756E21