@fairfox/polly 0.12.2 → 0.12.4

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.
@@ -1,18 +1,22 @@
1
1
  FROM eclipse-temurin:11-jre
2
2
 
3
- # Install TLA+ tools v1.7.4 (latest stable)
3
+ # Install TLA+ tools v1.7.4 (latest stable, includes TLC 2.19 from August 2024)
4
4
  RUN apt-get update && apt-get install -y curl && \
5
5
  curl -L https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar \
6
6
  -o /opt/tla2tools.jar && \
7
7
  apt-get remove -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
8
8
 
9
- # Create wrapper script for TLC
10
- RUN echo '#!/bin/sh' > /usr/local/bin/tlc && \
11
- echo 'java -jar /opt/tla2tools.jar "$@"' >> /usr/local/bin/tlc && \
12
- chmod +x /usr/local/bin/tlc
9
+ # Create entrypoint wrapper that handles "tlc" command
10
+ RUN echo '#!/bin/sh' > /usr/local/bin/docker-entrypoint.sh && \
11
+ echo '# Strip "tlc" command if passed as first argument' >> /usr/local/bin/docker-entrypoint.sh && \
12
+ echo 'if [ "$1" = "tlc" ]; then' >> /usr/local/bin/docker-entrypoint.sh && \
13
+ echo ' shift' >> /usr/local/bin/docker-entrypoint.sh && \
14
+ echo 'fi' >> /usr/local/bin/docker-entrypoint.sh && \
15
+ echo 'exec java -jar /opt/tla2tools.jar "$@"' >> /usr/local/bin/docker-entrypoint.sh && \
16
+ chmod +x /usr/local/bin/docker-entrypoint.sh
13
17
 
14
18
  # Set working directory
15
19
  WORKDIR /work
16
20
 
17
- # Default command runs TLC
18
- ENTRYPOINT ["java", "-jar", "/opt/tla2tools.jar"]
21
+ # Use wrapper script as entrypoint
22
+ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
@@ -1,13 +1,29 @@
1
- FROM tlaplus/tla:latest
1
+ # Development environment for working with TLA+ specifications
2
+ # This is separate from the main Dockerfile used by the CLI - this one includes
3
+ # additional tools for interactive development and editing of specs.
2
4
 
3
- # Install additional tools for better DX
4
- RUN apk add --no-cache \
5
+ FROM eclipse-temurin:11-jre
6
+
7
+ # Install TLA+ tools v1.7.4 (matches main Dockerfile)
8
+ RUN apt-get update && apt-get install -y curl && \
9
+ curl -L https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar \
10
+ -o /opt/tla2tools.jar && \
11
+ apt-get remove -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Install development tools for better DX
14
+ RUN apt-get update && apt-get install -y \
5
15
  bash \
6
16
  vim \
7
17
  less \
8
- tree
18
+ tree \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+ # Create tlc wrapper script
22
+ RUN echo '#!/bin/bash' > /usr/local/bin/tlc && \
23
+ echo 'java -jar /opt/tla2tools.jar "$@"' >> /usr/local/bin/tlc && \
24
+ chmod +x /usr/local/bin/tlc
9
25
 
10
26
  WORKDIR /specs
11
27
 
12
- # Default command: keep container alive for exec commands
28
+ # Default command: keep container alive for interactive use
13
29
  CMD ["tail", "-f", "/dev/null"]
@@ -14,20 +14,27 @@ TLA+ specifications for formal verification:
14
14
  - `README.md` - Documentation for running TLA+ verification
15
15
 
16
16
  ### Docker Setup
17
- - `Dockerfile` - Container setup for TLA+ toolchain
18
- - `docker-compose.yml` - Docker Compose configuration for running verification
17
+ - `Dockerfile` - Development container with TLA+ tools and editing utilities (vim, less, tree)
18
+ - `docker-compose.yml` - Docker Compose configuration for interactive development
19
+
20
+ **Note:** This is separate from the main `/tools/verify/Dockerfile` which is used by the Polly CLI for automated verification. Use this Dockerfile for interactive development and manual spec editing.
19
21
 
20
22
  ## Running Verification
21
23
 
22
- ### With Docker (Recommended)
24
+ ### With Docker Compose (Interactive Development)
25
+ Start a container with TLA+ tools and development utilities:
23
26
  ```bash
24
- cd packages/verify/specs
25
- docker-compose up
27
+ cd tools/verify/specs
28
+ docker-compose up -d
29
+ docker-compose exec tla bash
30
+ # Inside container:
31
+ cd tla
32
+ tlc MessageRouter.tla -config MessageRouter.cfg
26
33
  ```
27
34
 
28
35
  ### With TLC Directly
29
36
  ```bash
30
- cd packages/verify/specs/tla
37
+ cd tools/verify/specs/tla
31
38
  tlc MessageRouter.tla -config MessageRouter.cfg
32
39
  ```
33
40
 
@@ -1835,6 +1835,12 @@ class TLAGenerator {
1835
1835
  if (fieldConfig.type === "enum" && fieldConfig.values && fieldConfig.values.length > 0) {
1836
1836
  return `"${fieldConfig.values[0]}"`;
1837
1837
  }
1838
+ if (fieldConfig.type === "array") {
1839
+ return "<<>>";
1840
+ }
1841
+ if (fieldConfig.type === "string") {
1842
+ return '""';
1843
+ }
1838
1844
  }
1839
1845
  if ("maxLength" in fieldConfig) {
1840
1846
  return "<<>>";
@@ -1943,6 +1949,7 @@ class DockerRunner {
1943
1949
  "-v",
1944
1950
  `${specDir}:/work`,
1945
1951
  this.IMAGE_NAME,
1952
+ "tlc",
1946
1953
  "-workers",
1947
1954
  `${options?.workers || 1}`,
1948
1955
  `${specName}.tla`
@@ -3608,6 +3615,9 @@ class HandlerExtractor {
3608
3615
  if (Node2.isCallExpression(node)) {
3609
3616
  this.extractArrayMutationAssignment(node, assignments);
3610
3617
  }
3618
+ if (Node2.isPostfixUnaryExpression(node) || Node2.isPrefixUnaryExpression(node)) {
3619
+ this.extractUnaryExpressionAssignment(node, assignments);
3620
+ }
3611
3621
  });
3612
3622
  }
3613
3623
  extractBinaryExpressionAssignment(node, assignments) {
@@ -3683,6 +3693,23 @@ class HandlerExtractor {
3683
3693
  }
3684
3694
  }
3685
3695
  }
3696
+ extractUnaryExpressionAssignment(node, assignments) {
3697
+ if (!Node2.isPostfixUnaryExpression(node) && !Node2.isPrefixUnaryExpression(node))
3698
+ return;
3699
+ const operator = node.getOperatorToken();
3700
+ const operatorText = operator.toString();
3701
+ if (operatorText !== "++" && operatorText !== "--")
3702
+ return;
3703
+ const operand = node.getOperand();
3704
+ if (!Node2.isPropertyAccessExpression(operand))
3705
+ return;
3706
+ const fieldPath = this.getPropertyPath(operand);
3707
+ if (fieldPath.startsWith("state.")) {
3708
+ const field = fieldPath.substring(6);
3709
+ const value = operatorText === "++" ? "@ + 1" : "@ - 1";
3710
+ assignments.push({ field, value });
3711
+ }
3712
+ }
3686
3713
  extractArrayMutationAssignment(node, assignments) {
3687
3714
  if (!Node2.isCallExpression(node))
3688
3715
  return;
@@ -5296,4 +5323,4 @@ main().catch((error) => {
5296
5323
  process.exit(1);
5297
5324
  });
5298
5325
 
5299
- //# debugId=1B51E02C2E7CEC9764756E2164756E21
5326
+ //# debugId=7CAD4356DD5A25CD64756E2164756E21