pi-t3-pstack 0.0.0-stage → 0.1.0
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.
- package/LICENSE +23 -0
- package/index.ts +87 -0
- package/package.json +62 -4
- package/pstack/.claude-plugin/icon.png +0 -0
- package/pstack/.claude-plugin/plugin.json +35 -0
- package/pstack/.codex-plugin/plugin.json +50 -0
- package/pstack/README.md +26 -0
- package/pstack/agents/comment-sicko.md +32 -0
- package/pstack/agents/poteto-agent.md +8 -0
- package/pstack/agents/thermo-nuclear-code-quality-review-subagent.md +23 -0
- package/pstack/agents/thermo-nuclear-review-subagent.md +28 -0
- package/pstack/assets/pstack-icon.png +0 -0
- package/pstack/assets/pstack-icon.prompt.txt +8 -0
- package/pstack/hooks/codex-hooks.json +16 -0
- package/pstack/hooks/hooks.json +15 -0
- package/pstack/hooks/session-start-context.md +17 -0
- package/pstack/hooks/session-start.ps1 +33 -0
- package/pstack/hooks/session-start.sh +34 -0
- package/pstack/models.json +261 -0
- package/pstack/skills/architect/SKILL.md +85 -0
- package/pstack/skills/architect/references/design-red-flags.md +57 -0
- package/pstack/skills/architect/references/rationale-template.md +35 -0
- package/pstack/skills/architect/references/runner-prompt.md +20 -0
- package/pstack/skills/arena/SKILL.md +55 -0
- package/pstack/skills/automate-me/SKILL.md +104 -0
- package/pstack/skills/benchmark-checklist/SKILL.md +39 -0
- package/pstack/skills/blast-radius/SKILL.md +50 -0
- package/pstack/skills/bro/SKILL.md +7 -0
- package/pstack/skills/correct/SKILL.md +32 -0
- package/pstack/skills/create-formal-verification-skill/SKILL.md +43 -0
- package/pstack/skills/create-verification-skill/SKILL.md +44 -0
- package/pstack/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
- package/pstack/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
- package/pstack/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
- package/pstack/skills/deslop/SKILL.md +22 -0
- package/pstack/skills/figure-it-out/SKILL.md +52 -0
- package/pstack/skills/fix-ci/SKILL.md +29 -0
- package/pstack/skills/fix-merge-conflicts/SKILL.md +32 -0
- package/pstack/skills/get-pr-comments/SKILL.md +23 -0
- package/pstack/skills/how/SKILL.md +43 -0
- package/pstack/skills/how/references/explainer-prompt.md +55 -0
- package/pstack/skills/how/references/explorer-prompt.md +35 -0
- package/pstack/skills/in-your-own-words/SKILL.md +7 -0
- package/pstack/skills/interrogate/SKILL.md +37 -0
- package/pstack/skills/ketchup/SKILL.md +43 -0
- package/pstack/skills/ketchup-video/SKILL.md +29 -0
- package/pstack/skills/maintain-formal-verification-skill/SKILL.md +58 -0
- package/pstack/skills/maintain-verification-skill/SKILL.md +39 -0
- package/pstack/skills/make-pr-easy-to-review/SKILL.md +59 -0
- package/pstack/skills/no-comments/SKILL.md +24 -0
- package/pstack/skills/poteto-help/SKILL.md +162 -0
- package/pstack/skills/poteto-help/references/prompting.md +51 -0
- package/pstack/skills/poteto-help/references/recipes.md +51 -0
- package/pstack/skills/poteto-mode/SKILL.md +186 -0
- package/pstack/skills/poteto-mode/brief.md +70 -0
- package/pstack/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
- package/pstack/skills/poteto-mode/playbooks/autonomous-run.md +13 -0
- package/pstack/skills/poteto-mode/playbooks/autopilot-full.md +25 -0
- package/pstack/skills/poteto-mode/playbooks/autopilot-stack.md +8 -0
- package/pstack/skills/poteto-mode/playbooks/babysit.md +23 -0
- package/pstack/skills/poteto-mode/playbooks/bug-fix.md +15 -0
- package/pstack/skills/poteto-mode/playbooks/eval.md +25 -0
- package/pstack/skills/poteto-mode/playbooks/feature.md +21 -0
- package/pstack/skills/poteto-mode/playbooks/hillclimb.md +21 -0
- package/pstack/skills/poteto-mode/playbooks/investigation.md +14 -0
- package/pstack/skills/poteto-mode/playbooks/multi-phase-plan.md +155 -0
- package/pstack/skills/poteto-mode/playbooks/opening-a-pr.md +34 -0
- package/pstack/skills/poteto-mode/playbooks/orchestrate.md +25 -0
- package/pstack/skills/poteto-mode/playbooks/pause-safely.md +10 -0
- package/pstack/skills/poteto-mode/playbooks/perf-issue.md +25 -0
- package/pstack/skills/poteto-mode/playbooks/prototype.md +14 -0
- package/pstack/skills/poteto-mode/playbooks/refactoring.md +16 -0
- package/pstack/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
- package/pstack/skills/poteto-mode/playbooks/session-pickup.md +11 -0
- package/pstack/skills/poteto-mode/playbooks/shipping.md +12 -0
- package/pstack/skills/poteto-mode/playbooks/trace-forensics.md +14 -0
- package/pstack/skills/poteto-mode/playbooks/visual-parity.md +11 -0
- package/pstack/skills/poteto-mode/playbooks/worktree-cleanup.md +12 -0
- package/pstack/skills/poteto-mode/references/bugbot-triage.md +142 -0
- package/pstack/skills/poteto-mode/references/licenses/LICENSE +23 -0
- package/pstack/skills/poteto-mode/references/licenses/LICENSE-cursor-team-kit +21 -0
- package/pstack/skills/poteto-mode/references/licenses/LICENSE-thermos +21 -0
- package/pstack/skills/poteto-mode/references/licenses/NOTICE.md +14 -0
- package/pstack/skills/poteto-mode/scripts/.prettierrc.json +3 -0
- package/pstack/skills/poteto-mode/scripts/bootstrap.ts +62 -0
- package/pstack/skills/poteto-mode/scripts/bun.lock +67 -0
- package/pstack/skills/poteto-mode/scripts/check-plan.mjs +205 -0
- package/pstack/skills/poteto-mode/scripts/check-plan.test.ts +110 -0
- package/pstack/skills/poteto-mode/scripts/package.json +12 -0
- package/pstack/skills/poteto-mode/scripts/resolve-codex-transcript +4 -0
- package/pstack/skills/poteto-mode/scripts/resolve-codex-transcript.ts +314 -0
- package/pstack/skills/poteto-mode/scripts/test-utils/node-test.ts +204 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/cli.test.ts +225 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/cli.ts +231 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +142 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/github.test.ts +498 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/github.ts +760 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/policy.test.ts +483 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/policy.ts +1023 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/render.ts +188 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/settle.test.ts +552 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/settle.ts +406 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/tsconfig.json +18 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/types.compile.ts +93 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/types.ts +444 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/verdicts.test.ts +796 -0
- package/pstack/skills/poteto-mode/scripts/watch-pr/watch-pr +3 -0
- package/pstack/skills/poteto-mode/scripts/worktree-audit.sh +170 -0
- package/pstack/skills/principle-attack-the-premise/SKILL.md +21 -0
- package/pstack/skills/principle-boundary-discipline/SKILL.md +34 -0
- package/pstack/skills/principle-build-the-lever/SKILL.md +23 -0
- package/pstack/skills/principle-encode-lessons-in-structure/SKILL.md +11 -0
- package/pstack/skills/principle-exhaust-the-design-space/SKILL.md +9 -0
- package/pstack/skills/principle-experience-first/SKILL.md +19 -0
- package/pstack/skills/principle-explain-the-number/SKILL.md +18 -0
- package/pstack/skills/principle-fix-root-causes/SKILL.md +21 -0
- package/pstack/skills/principle-foundational-thinking/SKILL.md +21 -0
- package/pstack/skills/principle-guard-the-context-window/SKILL.md +12 -0
- package/pstack/skills/principle-laziness-protocol/SKILL.md +10 -0
- package/pstack/skills/principle-make-operations-idempotent/SKILL.md +22 -0
- package/pstack/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +14 -0
- package/pstack/skills/principle-minimize-reader-load/SKILL.md +18 -0
- package/pstack/skills/principle-model-the-domain/SKILL.md +24 -0
- package/pstack/skills/principle-never-block-on-the-human/SKILL.md +15 -0
- package/pstack/skills/principle-outcome-oriented-execution/SKILL.md +21 -0
- package/pstack/skills/principle-prove-it-works/SKILL.md +22 -0
- package/pstack/skills/principle-redesign-from-first-principles/SKILL.md +16 -0
- package/pstack/skills/principle-separate-before-serializing-shared-state/SKILL.md +16 -0
- package/pstack/skills/principle-sequence-verifiable-units/SKILL.md +17 -0
- package/pstack/skills/principle-subtract-before-you-add/SKILL.md +18 -0
- package/pstack/skills/principle-test-behavior-not-implementation/SKILL.md +20 -0
- package/pstack/skills/principle-type-system-discipline/SKILL.md +13 -0
- package/pstack/skills/recall/SKILL.md +35 -0
- package/pstack/skills/reflect/SKILL.md +86 -0
- package/pstack/skills/reflect/references/divergent-reviewer.md +38 -0
- package/pstack/skills/reflect/references/judgment-reviewer.md +37 -0
- package/pstack/skills/reflect/references/synthesizer.md +56 -0
- package/pstack/skills/reflect/references/tooling-reviewer.md +48 -0
- package/pstack/skills/reflect/scripts/find-transcript.mjs +245 -0
- package/pstack/skills/setup-pstack/SKILL.md +77 -0
- package/pstack/skills/setup-pstack/scripts/read-sheet.sh +14 -0
- package/pstack/skills/setup-pstack/scripts/t3-sheet.mjs +169 -0
- package/pstack/skills/sharpen/SKILL.md +16 -0
- package/pstack/skills/show-me-your-work/SKILL.md +82 -0
- package/pstack/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
- package/pstack/skills/show-me-your-work/scripts/log.sh +42 -0
- package/pstack/skills/statechart/SKILL.md +82 -0
- package/pstack/skills/statechart/references/render.md +93 -0
- package/pstack/skills/statechart/scripts/backends/cfg.ts +33 -0
- package/pstack/skills/statechart/scripts/backends/mermaid.ts +201 -0
- package/pstack/skills/statechart/scripts/backends/plain-text.ts +72 -0
- package/pstack/skills/statechart/scripts/backends/report.ts +177 -0
- package/pstack/skills/statechart/scripts/frontends/config.ts +276 -0
- package/pstack/skills/statechart/scripts/frontends/dot.ts +74 -0
- package/pstack/skills/statechart/scripts/frontends/marks.ts +93 -0
- package/pstack/skills/statechart/scripts/frontends/messages.ts +52 -0
- package/pstack/skills/statechart/scripts/frontends/spec.ts +114 -0
- package/pstack/skills/statechart/scripts/frontends/trace.ts +24 -0
- package/pstack/skills/statechart/scripts/frontends/value.ts +166 -0
- package/pstack/skills/statechart/scripts/frontends/verdict.ts +40 -0
- package/pstack/skills/statechart/scripts/frontends/view.ts +119 -0
- package/pstack/skills/statechart/scripts/ir.ts +547 -0
- package/pstack/skills/statechart/scripts/package.json +11 -0
- package/pstack/skills/statechart/scripts/passes/annotate.ts +128 -0
- package/pstack/skills/statechart/scripts/passes/label.ts +269 -0
- package/pstack/skills/statechart/scripts/passes/lift.ts +85 -0
- package/pstack/skills/statechart/scripts/passes/loop-check.ts +68 -0
- package/pstack/skills/statechart/scripts/passes/paths.ts +60 -0
- package/pstack/skills/statechart/scripts/passes/reach.ts +135 -0
- package/pstack/skills/statechart/scripts/passes/region-check.ts +97 -0
- package/pstack/skills/statechart/scripts/passes/regions.ts +295 -0
- package/pstack/skills/statechart/scripts/pipeline.ts +76 -0
- package/pstack/skills/statechart/scripts/run.ts +481 -0
- package/pstack/skills/statechart/scripts/statechart +29 -0
- package/pstack/skills/statechart/scripts/statechart.ts +164 -0
- package/pstack/skills/statechart/scripts/test/ConfigOracle.java +63 -0
- package/pstack/skills/statechart/scripts/test/chart.test.ts +1210 -0
- package/pstack/skills/statechart/scripts/test/charts/Braces.mmd +7 -0
- package/pstack/skills/statechart/scripts/test/charts/Escapes.mmd +11 -0
- package/pstack/skills/statechart/scripts/test/charts/Phases.mmd +29 -0
- package/pstack/skills/statechart/scripts/test/cli.test.ts +1314 -0
- package/pstack/skills/statechart/scripts/test/config-fuzz.test.ts +263 -0
- package/pstack/skills/statechart/scripts/test/corpus/Counter/ChartRun.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/Counter/Counter.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/Counter/Counter.tla +10 -0
- package/pstack/skills/statechart/scripts/test/corpus/Counter/chart.mmd +9 -0
- package/pstack/skills/statechart/scripts/test/corpus/Counter/graph.dot +16 -0
- package/pstack/skills/statechart/scripts/test/corpus/Counter/report.md +7 -0
- package/pstack/skills/statechart/scripts/test/corpus/Counter/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/Counter/verdict-1.out +49 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/ChartRun.out +60 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.cfg +4 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.tla +22 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/chart.mmd +26 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/graph.dot +19 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/report.md +20 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.out +56 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.out +82 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterAction/verdict-3.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/ChartRun.out +59 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.tla +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/chart.mmd +22 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/graph.dot +16 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/report.md +17 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.out +56 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.out +77 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterFan/ChartRun.out +69 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.cfg +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.tla +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterFan/chart.mmd +85 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterFan/graph.dot +70 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterFan/report.md +12 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterFan/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.out +67 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterFan/verdict-2.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.out +85 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.cfg +6 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.tla +13 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/chart.mmd +5 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/graph.dot +10 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/report.md +31 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.out +64 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.out +77 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/ChartRun.out +55 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.tla +10 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/chart.mmd +12 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/graph.dot +6 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/report.md +12 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.out +33 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-2.out +54 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/ChartRun.out +54 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.tla +10 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/chart.mmd +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/graph.dot +6 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/report.md +7 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/verdict-1.out +46 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInstance/ChartRun.out +59 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.cfg +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.tla +10 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInstance/CounterSteps.tla +6 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInstance/chart.mmd +17 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInstance/graph.dot +15 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInstance/report.md +14 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInstance/sany.out +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.out +78 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterJump/ChartRun.out +59 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.tla +19 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterJump/chart.mmd +26 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterJump/graph.dot +22 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterJump/report.md +12 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterJump/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.out +58 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterJump/verdict-2.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterLoop/ChartRun.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.cfg +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.tla +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterLoop/chart.mmd +17 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterLoop/graph.dot +15 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterLoop/report.md +14 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterLoop/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.out +76 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/ChartRun.out +59 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.tla +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/chart.mmd +19 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/graph.dot +10 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/report.md +15 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.out +56 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.out +67 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/ChartRun.out +62 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.cfg +6 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.tla +24 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/Moves.tla +5 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/chart.mmd +22 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/graph.dot +10 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/report.md +23 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/sany.out +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.out +58 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.out +66 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.out +74 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-4.out +59 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStart/ChartRun.out +58 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.tla +15 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStart/chart.mmd +18 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStart/graph.dot +13 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStart/report.md +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStart/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.out +33 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStart/verdict-2.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStop/ChartRun.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.tla +15 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStop/chart.mmd +7 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStop/graph.dot +13 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStop/report.md +6 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStop/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterStop/verdict-1.out +49 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/ChartRun.out +61 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.cfg +4 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.tla +14 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/chart.mmd +30 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/graph.dot +19 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/report.md +27 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.out +56 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.out +64 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.out +87 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-4.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/ChartRun.out +60 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.tla +12 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/chart.mmd +23 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/graph.dot +19 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/report.md +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.out +56 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-2.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/ChartRun.out +61 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/CounterView.cfg +4 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/CounterView.tla +14 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/chart.mmd +23 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/graph.dot +19 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/report.md +27 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-1.out +56 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-2.out +64 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-3.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-3.out +87 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-4.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/CounterView/view.mjs +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/DieHard/ChartRun.out +59 -0
- package/pstack/skills/statechart/scripts/test/corpus/DieHard/DieHard.cfg +4 -0
- package/pstack/skills/statechart/scripts/test/corpus/DieHard/DieHard.tla +38 -0
- package/pstack/skills/statechart/scripts/test/corpus/DieHard/chart.mmd +92 -0
- package/pstack/skills/statechart/scripts/test/corpus/DieHard/graph.dot +126 -0
- package/pstack/skills/statechart/scripts/test/corpus/DieHard/report.md +17 -0
- package/pstack/skills/statechart/scripts/test/corpus/DieHard/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/DieHard/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/DieHard/verdict-1.out +91 -0
- package/pstack/skills/statechart/scripts/test/corpus/DieHard/verdict-2.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/ChartRun.out +61 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.cfg +6 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.tla +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/chart.mmd +22 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/graph.dot +16 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/report.md +25 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.out +56 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.out +64 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.out +64 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.out +77 -0
- package/pstack/skills/statechart/scripts/test/corpus/HiddenClock/ChartRun.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.cfg +4 -0
- package/pstack/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.tla +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/HiddenClock/chart.mmd +13 -0
- package/pstack/skills/statechart/scripts/test/corpus/HiddenClock/graph.dot +12 -0
- package/pstack/skills/statechart/scripts/test/corpus/HiddenClock/report.md +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/HiddenClock/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.out +72 -0
- package/pstack/skills/statechart/scripts/test/corpus/Login/ChartRun.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/Login/Login.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/Login/Login.tla +62 -0
- package/pstack/skills/statechart/scripts/test/corpus/Login/chart.mmd +27 -0
- package/pstack/skills/statechart/scripts/test/corpus/Login/graph.dot +40 -0
- package/pstack/skills/statechart/scripts/test/corpus/Login/report.md +7 -0
- package/pstack/skills/statechart/scripts/test/corpus/Login/sany.out +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/Login/verdict-1.out +47 -0
- package/pstack/skills/statechart/scripts/test/corpus/Login/view.mjs +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/ChartRun.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.cfg +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.tla +64 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/chart.mmd +28 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/graph.dot +37 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/report.md +8 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/sany.out +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/verdict-1.out +47 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/view.mjs +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/ChartRun.out +60 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.tla +64 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/chart.mmd +44 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/graph.dot +58 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/report.md +17 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/sany.out +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.out +83 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/verdict-2.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/LoginParallel/view.mjs +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/ChartRun.out +60 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.tla +103 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/chart.mmd +43 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/graph.dot +93 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/report.md +14 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/sany.out +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.out +59 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-2.out +72 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/view.mjs +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/ChartRun.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.cfg +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.tla +100 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/chart.mmd +31 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/graph.dot +85 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/report.md +9 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/sany.out +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/verdict-1.out +47 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/view.mjs +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/ChartRun.out +59 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayer.tla +103 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.tla +6 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/chart.mmd +42 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/graph.dot +93 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/report.md +19 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.out +61 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-2.out +59 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-3.out +61 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.out +66 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.out +58 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-6.out +49 -0
- package/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/view.mjs +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/PickWorker/ChartRun.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.cfg +6 -0
- package/pstack/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.tla +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/PickWorker/chart.mmd +5 -0
- package/pstack/skills/statechart/scripts/test/corpus/PickWorker/graph.dot +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/PickWorker/report.md +7 -0
- package/pstack/skills/statechart/scripts/test/corpus/PickWorker/sany.out +5 -0
- package/pstack/skills/statechart/scripts/test/corpus/PickWorker/verdict-1.out +70 -0
- package/pstack/skills/statechart/scripts/test/corpus/Shadow/ChartRun.out +61 -0
- package/pstack/skills/statechart/scripts/test/corpus/Shadow/Shadow.cfg +4 -0
- package/pstack/skills/statechart/scripts/test/corpus/Shadow/Shadow.tla +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/Shadow/ShadowLib.tla +6 -0
- package/pstack/skills/statechart/scripts/test/corpus/Shadow/ShadowSub.tla +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/Shadow/chart.mmd +9 -0
- package/pstack/skills/statechart/scripts/test/corpus/Shadow/graph.dot +16 -0
- package/pstack/skills/statechart/scripts/test/corpus/Shadow/report.md +8 -0
- package/pstack/skills/statechart/scripts/test/corpus/Shadow/sany.out +4 -0
- package/pstack/skills/statechart/scripts/test/corpus/Shadow/verdict-1.out +65 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/ChartRun.out +59 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.cfg +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.tla +9 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/chart.mmd +23 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/graph.dot +17 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/report.md +15 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/sany.out +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.out +65 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.out +75 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/ChartRun.out +69 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.tla +75 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/chart.mmd +60 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/graph.dot +297 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/report.md +20 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/sany.out +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.out +95 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/verdict-2.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhase/view.mjs +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/ChartRun.out +57 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.cfg +3 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.tla +75 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/chart.mmd +37 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/graph.dot +223 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/report.md +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/sany.out +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/verdict-1.out +47 -0
- package/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/view.mjs +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.out +75 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.cfg +5 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.tla +11 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/chart.mmd +18 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/graph.dot +14 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/report.md +29 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.out +64 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.out +75 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/ChartRun.out +58 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.cfg +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.tla +8 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/chart.mmd +22 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/graph.dot +16 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/report.md +15 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.out +56 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.exit +1 -0
- package/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.out +77 -0
- package/pstack/skills/statechart/scripts/test/corpus.test.ts +403 -0
- package/pstack/skills/statechart/scripts/test/differential.test.ts +565 -0
- package/pstack/skills/statechart/scripts/test/grid/Grid.cfg +2 -0
- package/pstack/skills/statechart/scripts/test/grid/Grid.tla +9 -0
- package/pstack/skills/statechart/scripts/test/grid/sany.out +2 -0
- package/pstack/skills/statechart/scripts/test/java.ts +63 -0
- package/pstack/skills/statechart/scripts/test/labels.ts +643 -0
- package/pstack/skills/statechart/scripts/test/messages.test.ts +212 -0
- package/pstack/skills/statechart/scripts/test/pipeline.test.ts +270 -0
- package/pstack/skills/statechart/scripts/test/plain-tlc.test.ts +255 -0
- package/pstack/skills/statechart/scripts/test/render.test.ts +81 -0
- package/pstack/skills/statechart/scripts/test/tlc-out.test.ts +90 -0
- package/pstack/skills/statechart/scripts/test/tlc.ts +158 -0
- package/pstack/skills/statechart/scripts/tsconfig.json +11 -0
- package/pstack/skills/statechart/scripts/worker.ts +35 -0
- package/pstack/skills/swarm/SKILL.md +47 -0
- package/pstack/skills/tdd/SKILL.md +42 -0
- package/pstack/skills/teach/SKILL.md +21 -0
- package/pstack/skills/technical-writing/SKILL.md +106 -0
- package/pstack/skills/thermo-nuclear-code-quality-review/SKILL.md +192 -0
- package/pstack/skills/thermo-nuclear-review/SKILL.md +51 -0
- package/pstack/skills/thermos/SKILL.md +21 -0
- package/pstack/skills/typescript-best-practices/SKILL.md +31 -0
- package/pstack/skills/typescript-best-practices/references/patterns.md +328 -0
- package/pstack/skills/unslop/SKILL.md +62 -0
- package/pstack/skills/what-did-i-get-done/SKILL.md +31 -0
- package/pstack/skills/why/SKILL.md +105 -0
- package/pstack/skills/why/references/epistemics.md +71 -0
- package/pstack/skills/why/references/investigator-prompt.md +84 -0
- package/pstack/skills/why/references/source-playbook.md +17 -0
- package/pstack/skills/why/references/sources/code-archaeology.md +51 -0
- package/pstack/skills/why/references/sources/databricks.md +70 -0
- package/pstack/skills/why/references/sources/datadog.md +97 -0
- package/pstack/skills/why/references/sources/incident-postmortem.md +5 -0
- package/pstack/skills/why/references/sources/linear.md +48 -0
- package/pstack/skills/why/references/sources/notion.md +55 -0
- package/pstack/skills/why/references/sources/sentry.md +66 -0
- package/pstack/skills/why/references/sources/slack.md +17 -0
- package/pstack/skills/why/references/synthesizer-prompt.md +129 -0
- package/src/accounts.ts +527 -0
- package/src/bash-timeout.ts +63 -0
- package/src/bridge-trim.ts +109 -0
- package/src/brief.ts +280 -0
- package/src/cards.ts +65 -0
- package/src/child.ts +570 -0
- package/src/failures.ts +73 -0
- package/src/models.ts +1249 -0
- package/src/plan.ts +252 -0
- package/src/resources.ts +30 -0
- package/src/results.ts +92 -0
- package/src/resume.ts +143 -0
- package/src/session.ts +70 -0
- package/src/state.ts +124 -0
- package/src/t3-http.ts +140 -0
- package/src/t3-json.ts +50 -0
- package/src/t3-mcp.ts +188 -0
- package/src/tasks.ts +163 -0
- package/src/transcript.ts +17 -0
- package/src/usage.ts +145 -0
- package/README.md +0 -3
|
@@ -0,0 +1,1210 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { test } from "node:test";
|
|
5
|
+
import { inspect } from "node:util";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import v8 from "node:v8";
|
|
8
|
+
import vm from "node:vm";
|
|
9
|
+
import { mermaid } from "../backends/mermaid.ts";
|
|
10
|
+
import { report } from "../backends/report.ts";
|
|
11
|
+
import { readConfig } from "../frontends/config.ts";
|
|
12
|
+
import { readChecks, readSany, readSpec } from "../frontends/spec.ts";
|
|
13
|
+
import { checkView, json } from "../frontends/view.ts";
|
|
14
|
+
import {
|
|
15
|
+
type Bug,
|
|
16
|
+
EC,
|
|
17
|
+
type Graph,
|
|
18
|
+
hasSection,
|
|
19
|
+
key,
|
|
20
|
+
type Lasso,
|
|
21
|
+
LEVEL,
|
|
22
|
+
type PathStep,
|
|
23
|
+
type Rule,
|
|
24
|
+
ruleKey,
|
|
25
|
+
show,
|
|
26
|
+
type Spec,
|
|
27
|
+
type State,
|
|
28
|
+
stateRules,
|
|
29
|
+
type Step,
|
|
30
|
+
type Value,
|
|
31
|
+
type Vars,
|
|
32
|
+
type View,
|
|
33
|
+
} from "../ir.ts";
|
|
34
|
+
import { addPast, deadEnds, finder, lasso, mark } from "../passes/annotate.ts";
|
|
35
|
+
import { pathGraph } from "../passes/paths.ts";
|
|
36
|
+
import { bugs, walk } from "../passes/reach.ts";
|
|
37
|
+
import { parseDot } from "../frontends/dot.ts";
|
|
38
|
+
import { parseValue } from "../frontends/value.ts";
|
|
39
|
+
import { readCounterexample, readMarks } from "../frontends/marks.ts";
|
|
40
|
+
import { readMessages } from "../frontends/messages.ts";
|
|
41
|
+
import { readTrace } from "../frontends/trace.ts";
|
|
42
|
+
import { readVerdict } from "../frontends/verdict.ts";
|
|
43
|
+
import { compile, project } from "../pipeline.ts";
|
|
44
|
+
import { fileLines } from "../run.ts";
|
|
45
|
+
|
|
46
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
47
|
+
const corpus = (name: string, file: string) => path.join(here, "corpus", name, file);
|
|
48
|
+
|
|
49
|
+
const corpusSpec = (name: string) => {
|
|
50
|
+
const configFile = corpus(name, `${name}.cfg`);
|
|
51
|
+
const config = readConfig({ file: configFile, text: fs.readFileSync(configFile, "utf8") });
|
|
52
|
+
return readSpec({
|
|
53
|
+
module: name,
|
|
54
|
+
sany: readSany(fs.readFileSync(corpus(name, "sany.out"), "utf8")),
|
|
55
|
+
checks: readChecks({ configFile, config }),
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
type StateRow = [id: string, vars: Vars, start?: boolean, breaks?: string[]];
|
|
60
|
+
type StepRow = [from: string, to: string, action: string];
|
|
61
|
+
|
|
62
|
+
const graphOf = (states: StateRow[], steps: StepRow[]) => {
|
|
63
|
+
const graph: Graph = { states: new Map(), steps: [] };
|
|
64
|
+
for (const [id, vars, start, breaks = []] of states) {
|
|
65
|
+
const rules: Rule[] = [];
|
|
66
|
+
for (const name of breaks) rules.push({ kind: "invariant", name });
|
|
67
|
+
graph.states.set(id, { vars, start: !!start, breaks: rules });
|
|
68
|
+
}
|
|
69
|
+
for (const [from, to, action] of steps) graph.steps.push({ from, to, action });
|
|
70
|
+
return graph;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const lookup = <K, V>(map: ReadonlyMap<K, V>, k: K) => {
|
|
74
|
+
const v = map.get(k);
|
|
75
|
+
assert.ok(v !== undefined, `${inspect(k)} is missing`);
|
|
76
|
+
return v;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const field = (value: Value, name: string) => {
|
|
80
|
+
if (typeof value !== "object" || value.kind !== "function")
|
|
81
|
+
throw new Error(`${inspect(value)} is not a function.`);
|
|
82
|
+
for (let i = 0; i < value.keys.length; i++) {
|
|
83
|
+
const k = value.keys[i];
|
|
84
|
+
if (k === name || (typeof k === "object" && k.kind === "model" && k.name === name))
|
|
85
|
+
return value.values[i];
|
|
86
|
+
}
|
|
87
|
+
throw new Error(`${inspect(value)} has no ${name}.`);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
function draw(graph: Graph, view: View, loops: Bug[] = []) {
|
|
91
|
+
const found = [...bugs(graph), ...loops];
|
|
92
|
+
const { chart, stories } = project(graph, walk(graph), view, found);
|
|
93
|
+
const spec: Spec = {
|
|
94
|
+
module: "Test",
|
|
95
|
+
variables: [],
|
|
96
|
+
invariants: [],
|
|
97
|
+
properties: [],
|
|
98
|
+
deadlock: false,
|
|
99
|
+
written: [],
|
|
100
|
+
};
|
|
101
|
+
const result = {
|
|
102
|
+
spec,
|
|
103
|
+
graph,
|
|
104
|
+
paths: undefined,
|
|
105
|
+
rules: [],
|
|
106
|
+
properties: [],
|
|
107
|
+
stop: undefined,
|
|
108
|
+
drawing: undefined,
|
|
109
|
+
states: { distinct: graph.states.size, initial: 1, complete: true, cut: false },
|
|
110
|
+
};
|
|
111
|
+
return { chart: mermaid(chart), report: report(result, found, chart, stories) };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const marked = (chart: string) => {
|
|
115
|
+
const out: { [label: string]: string } = {};
|
|
116
|
+
for (const [, id, cls] of chart.matchAll(/^ {2}class (s\d+) (breaks|mayBreak)$/gm)) {
|
|
117
|
+
const label = chart.match(new RegExp(`^\\s*${id}: (.*)$`, "m"))?.[1];
|
|
118
|
+
assert.ok(label !== undefined, `${id} has no label`);
|
|
119
|
+
out[label] = cls;
|
|
120
|
+
}
|
|
121
|
+
return out;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
test("TLA+ values reach the view as the skill says: sequences from 1, sets as arrays", () => {
|
|
125
|
+
const seen = (text: string) => json(parseValue(text));
|
|
126
|
+
assert.deepEqual(seen('<<1, "a", <<>>>>'), { 1: 1, 2: "a", 3: {} });
|
|
127
|
+
assert.deepEqual(seen("{r1, -2}"), ["r1", -2]);
|
|
128
|
+
assert.deepEqual(seen("{}"), []);
|
|
129
|
+
assert.deepEqual(seen("-1..2"), [-1, 0, 1, 2]);
|
|
130
|
+
assert.deepEqual(seen('[ok |-> TRUE, msg |-> "say \\"hi\\""]'), {
|
|
131
|
+
ok: true,
|
|
132
|
+
msg: 'say "hi"',
|
|
133
|
+
});
|
|
134
|
+
assert.deepEqual(seen("[]"), {});
|
|
135
|
+
assert.deepEqual(seen('(r1 :> "working" @@ r2 :> "aborted")'), {
|
|
136
|
+
r1: "working",
|
|
137
|
+
r2: "aborted",
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("a value outside the grammar TLC prints is an error, never a guess", () => {
|
|
142
|
+
for (const text of [
|
|
143
|
+
"<<1, 2",
|
|
144
|
+
"<<1 2>>",
|
|
145
|
+
"{1,}",
|
|
146
|
+
"[1 |-> 2]",
|
|
147
|
+
"[a |-> 1,]",
|
|
148
|
+
"[,]",
|
|
149
|
+
"(1 :> 2",
|
|
150
|
+
"1..",
|
|
151
|
+
"1..x",
|
|
152
|
+
'"\\q"',
|
|
153
|
+
"x y",
|
|
154
|
+
"",
|
|
155
|
+
"SUBSET {1}",
|
|
156
|
+
"[S -> T]",
|
|
157
|
+
])
|
|
158
|
+
assert.throws(() => parseValue(text), /cannot read TLA\+ value/, text);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("a label prints each value in TLA+, so values that TLC tells apart look apart", () => {
|
|
162
|
+
const shown = (text: string) => show(parseValue(text));
|
|
163
|
+
for (const text of [
|
|
164
|
+
'"A"',
|
|
165
|
+
"A",
|
|
166
|
+
"<<0>>",
|
|
167
|
+
'("1" :> 0)',
|
|
168
|
+
"[a |-> 1]",
|
|
169
|
+
"[]",
|
|
170
|
+
"1..3",
|
|
171
|
+
"{1, 2, 3}",
|
|
172
|
+
"<<>>",
|
|
173
|
+
"{}",
|
|
174
|
+
"TRUE",
|
|
175
|
+
'"TRUE"',
|
|
176
|
+
'"a\\nb\\tc\\"d\\\\e"',
|
|
177
|
+
'(<<1, 2>> :> {A, "A"} @@ 0 :> -1)',
|
|
178
|
+
])
|
|
179
|
+
assert.equal(shown(text), text);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
test("equal TLA+ values share one key and unequal ones do not, as TLC compares them", () => {
|
|
183
|
+
const same = [
|
|
184
|
+
["1..3", "{1, 2, 3}"],
|
|
185
|
+
["1..3", "{3, 1, 2, 2}"],
|
|
186
|
+
["{1..2, {1, 2}}", "{{1, 2}}"],
|
|
187
|
+
["{}", "1..0"],
|
|
188
|
+
["{5}", "5..5"],
|
|
189
|
+
["{0, 1, 2, 4, 5, 7}", "{7, 4, 5, 2, 1, 0}"],
|
|
190
|
+
["<<0>>", "(1 :> 0)"],
|
|
191
|
+
["<<4, 5>>", "(2 :> 5 @@ 1 :> 4)"],
|
|
192
|
+
["[a |-> 1, b |-> 2]", '("b" :> 2 @@ "a" :> 1)'],
|
|
193
|
+
["[]", "<< >>"],
|
|
194
|
+
["{A, B}", "{B, A}"],
|
|
195
|
+
['{"b", "a"}', '{"a", "b"}'],
|
|
196
|
+
];
|
|
197
|
+
for (const [a, b] of same) assert.equal(key(parseValue(a)), key(parseValue(b)), `${a} = ${b}`);
|
|
198
|
+
const apart = [
|
|
199
|
+
['"A"', "A"],
|
|
200
|
+
["<<0>>", '("1" :> 0)'],
|
|
201
|
+
["<<>>", "{}"],
|
|
202
|
+
["1..3", "{1, 2}"],
|
|
203
|
+
["1..3", "{1, 2, 3, 4}"],
|
|
204
|
+
["{1, 3}", "1..3"],
|
|
205
|
+
["TRUE", '"TRUE"'],
|
|
206
|
+
["1", '"1"'],
|
|
207
|
+
["<<1, 2>>", '"<<1, 2>>"'],
|
|
208
|
+
["(2 :> 0)", "<<0>>"],
|
|
209
|
+
["(0 :> 1 @@ 1 :> 2)", "<<1, 2>>"],
|
|
210
|
+
["[a |-> 1]", "[a |-> 2]"],
|
|
211
|
+
["{<<1>>}", "{<<2>>}"],
|
|
212
|
+
];
|
|
213
|
+
for (const [a, b] of apart)
|
|
214
|
+
assert.notEqual(key(parseValue(a)), key(parseValue(b)), `${a} # ${b}`);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
function replay(name: string, graph: Graph) {
|
|
218
|
+
const spec = corpusSpec(name);
|
|
219
|
+
const names = spec.variables;
|
|
220
|
+
const rules = stateRules(spec);
|
|
221
|
+
const find = finder(graph, names);
|
|
222
|
+
const marks = readMarks(readMessages(fileLines(corpus(name, "ChartRun.out"))), "chart");
|
|
223
|
+
const past = mark(graph, marks, names, rules, find);
|
|
224
|
+
const drawn = !fs.existsSync(corpus(name, "ChartRun.exit"));
|
|
225
|
+
for (const f of fs.readdirSync(path.join(here, "corpus", name)).sort()) {
|
|
226
|
+
if (!/^verdict-\d+\.out$/.test(f)) continue;
|
|
227
|
+
const messages = [...readMessages(fileLines(corpus(name, f)))];
|
|
228
|
+
const { broke } = readVerdict(messages);
|
|
229
|
+
if (!broke) continue;
|
|
230
|
+
let rule: Rule | undefined;
|
|
231
|
+
for (const r of rules)
|
|
232
|
+
if (r.kind === broke.kind && (broke.kind === "deadlock" || r.name === broke.name)) rule = r;
|
|
233
|
+
if (!rule) continue;
|
|
234
|
+
if (rule.kind === "deadlock" && drawn && !hasSection(spec, "CONSTRAINT", "ACTION_CONSTRAINT"))
|
|
235
|
+
deadEnds(graph, rule);
|
|
236
|
+
const counterexample = readCounterexample(messages);
|
|
237
|
+
if (drawn || lasso(graph, { seq: counterexample, loop: undefined }, names, find))
|
|
238
|
+
addPast(
|
|
239
|
+
graph,
|
|
240
|
+
counterexample,
|
|
241
|
+
names,
|
|
242
|
+
rule,
|
|
243
|
+
past,
|
|
244
|
+
hasSection(spec, "ACTION_CONSTRAINT"),
|
|
245
|
+
find,
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
test("each corpus bug path is the shortest way to its rule", () => {
|
|
251
|
+
const paths: { [rule: string]: string[] } = {};
|
|
252
|
+
for (const name of ["DieHard", "MediaPlayer", "LoginParallel", "TwoPhase", "FirstRule"]) {
|
|
253
|
+
const graph = parseDot(fileLines(corpus(name, "graph.dot")));
|
|
254
|
+
replay(name, graph);
|
|
255
|
+
for (const bug of bugs(graph)) {
|
|
256
|
+
paths[bug.rule.name] = [];
|
|
257
|
+
for (const p of bug.path) paths[bug.rule.name].push(p.action);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
assert.deepEqual(paths.NotSolved, [
|
|
261
|
+
"FillBig",
|
|
262
|
+
"BigToSmall",
|
|
263
|
+
"EmptySmall",
|
|
264
|
+
"BigToSmall",
|
|
265
|
+
"FillBig",
|
|
266
|
+
"BigToSmall",
|
|
267
|
+
]);
|
|
268
|
+
assert.deepEqual(paths.LoudWhenStopped, ["YouTurnItUp"]);
|
|
269
|
+
assert.equal(paths.SignedInWhileLocked.length, 5);
|
|
270
|
+
assert.equal(paths.TCConsistent.length, 5);
|
|
271
|
+
assert.equal(paths.TCConsistent.at(-1), "RMRcvCommitMsg");
|
|
272
|
+
assert.deepEqual(paths.NotOne, ["Next"]);
|
|
273
|
+
assert.deepEqual(paths.NotOneOrThree, ["Next"]);
|
|
274
|
+
assert.deepEqual(paths.AlsoNotOne, ["Next"]);
|
|
275
|
+
assert.deepEqual(paths.NoDeadlock, ["Next", "Next", "Next"]);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
test("a chart of only the bug paths words each one with the view, asked once for each state and step", () => {
|
|
279
|
+
const spec = corpusSpec("FirstRule");
|
|
280
|
+
const rules = stateRules(spec);
|
|
281
|
+
const drawn = pathGraph(spec.variables);
|
|
282
|
+
const paths: Bug[] = [];
|
|
283
|
+
for (const f of fs.readdirSync(path.join(here, "corpus", "FirstRule")).sort()) {
|
|
284
|
+
if (!/^verdict-\d+\.out$/.test(f)) continue;
|
|
285
|
+
const messages = [...readMessages(fileLines(corpus("FirstRule", f)))];
|
|
286
|
+
const { broke } = readVerdict(messages);
|
|
287
|
+
for (const rule of rules)
|
|
288
|
+
if (broke?.kind === rule.kind && (broke.kind === "deadlock" || rule.name === broke.name))
|
|
289
|
+
paths.push(drawn.bug(rule, readCounterexample(messages)));
|
|
290
|
+
}
|
|
291
|
+
const asked: { [question: string]: number } = {};
|
|
292
|
+
const count = (question: string) => (asked[question] = (asked[question] ?? 0) + 1);
|
|
293
|
+
const view: View = {
|
|
294
|
+
state: (v) => {
|
|
295
|
+
count(`state ${v.x}`);
|
|
296
|
+
return `x is ${v.x}`;
|
|
297
|
+
},
|
|
298
|
+
step: (action, from, to) => {
|
|
299
|
+
count(`step ${from.x} to ${to.x}`);
|
|
300
|
+
return `${action} adds one`;
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
const { report: text, files } = compile(
|
|
304
|
+
{
|
|
305
|
+
spec: { ...spec, folder: "" },
|
|
306
|
+
graph: drawn.graph,
|
|
307
|
+
paths,
|
|
308
|
+
rules: [],
|
|
309
|
+
properties: [],
|
|
310
|
+
exit: 1,
|
|
311
|
+
stop: undefined,
|
|
312
|
+
drawing: undefined,
|
|
313
|
+
states: { distinct: 1234, initial: 1, complete: true, cut: false },
|
|
314
|
+
messages: [],
|
|
315
|
+
},
|
|
316
|
+
checkView(view, inspect),
|
|
317
|
+
);
|
|
318
|
+
assert.match(
|
|
319
|
+
text,
|
|
320
|
+
/^TLC reached 1,234 states, more than the chart budget of 500, so the chart draws only the bug paths: 4 states and 3 arrows\.$/m,
|
|
321
|
+
);
|
|
322
|
+
assert.ok(files.has("chart.mmd"));
|
|
323
|
+
for (const rule of ["NotOne", "NotOneOrThree", "AlsoNotOne"])
|
|
324
|
+
assert.match(
|
|
325
|
+
text,
|
|
326
|
+
new RegExp(`^## ${rule} breaks\\n.*\\n0\\. x is 0\\n1\\. Next adds one: x is 1$`, "m"),
|
|
327
|
+
);
|
|
328
|
+
assert.deepEqual(asked, {
|
|
329
|
+
"state 0": 1,
|
|
330
|
+
"step 0 to 1": 1,
|
|
331
|
+
"state 1": 1,
|
|
332
|
+
"step 1 to 2": 1,
|
|
333
|
+
"state 2": 1,
|
|
334
|
+
"step 2 to 3": 1,
|
|
335
|
+
"state 3": 1,
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
test("the graph that parseDot returns keeps none of the text it read", () => {
|
|
340
|
+
v8.setFlagsFromString("--expose-gc");
|
|
341
|
+
const gc: () => void = vm.runInNewContext("gc");
|
|
342
|
+
const heapUsed = () => {
|
|
343
|
+
gc();
|
|
344
|
+
gc();
|
|
345
|
+
return process.memoryUsage().heapUsed;
|
|
346
|
+
};
|
|
347
|
+
const MiB = 1 << 20;
|
|
348
|
+
const pieces = 16;
|
|
349
|
+
function* dot() {
|
|
350
|
+
for (let i = 0; i < pieces; i++) {
|
|
351
|
+
const id = `-${String(i).padStart(18, "7")}`;
|
|
352
|
+
const lines = [
|
|
353
|
+
`${id} [label="n = ${i}"];`,
|
|
354
|
+
`${id} -> ${id} [label="StayAtStateNumber${i}"];`,
|
|
355
|
+
];
|
|
356
|
+
while (lines.length < 1024) lines.push(`// ${"x".repeat(1020)}`);
|
|
357
|
+
yield* `${lines.join("\n")}\n`.split("\n");
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const before = heapUsed();
|
|
361
|
+
const graph = parseDot(dot());
|
|
362
|
+
const kept = heapUsed() - before;
|
|
363
|
+
assert.equal(graph.states.size, pieces);
|
|
364
|
+
assert.ok(kept < 4 * MiB, `the graph keeps ${(kept / MiB).toFixed(1)} MiB of ${pieces} MiB read`);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
test("TLC's marks place on their states even when TLC wraps them over lines", () => {
|
|
368
|
+
const spec = corpusSpec("TwoPhase");
|
|
369
|
+
const out = fs.readFileSync(corpus("TwoPhase", "ChartRun.out"), "utf8");
|
|
370
|
+
const graph = parseDot(fs.readFileSync(corpus("TwoPhase", "graph.dot"), "utf8"));
|
|
371
|
+
assert.equal(
|
|
372
|
+
mark(graph, readMarks(readMessages(out), "chart"), spec.variables, stateRules(spec)).size,
|
|
373
|
+
0,
|
|
374
|
+
);
|
|
375
|
+
const bad: Value[][] = [];
|
|
376
|
+
for (const s of graph.states.values())
|
|
377
|
+
if (s.breaks.length)
|
|
378
|
+
bad.push([field(s.vars.rmState, "r1"), field(s.vars.rmState, "r2")].sort());
|
|
379
|
+
assert.deepEqual(bad, [
|
|
380
|
+
["aborted", "committed"],
|
|
381
|
+
["aborted", "committed"],
|
|
382
|
+
]);
|
|
383
|
+
const cut = out.slice(0, out.indexOf("{r1},"));
|
|
384
|
+
assert.throws(
|
|
385
|
+
() =>
|
|
386
|
+
mark(
|
|
387
|
+
parseDot(fs.readFileSync(corpus("TwoPhase", "graph.dot"), "utf8")),
|
|
388
|
+
readMarks(readMessages(cut), "chart"),
|
|
389
|
+
spec.variables,
|
|
390
|
+
stateRules(spec),
|
|
391
|
+
),
|
|
392
|
+
{
|
|
393
|
+
message: `TLC's output ends inside a marked state, so the command cannot tell which rules it breaks:\n${cut.slice(cut.lastIndexOf('<< "chart",'))}\n`,
|
|
394
|
+
},
|
|
395
|
+
);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
test("a chart tuple that TLC prints inside one of its messages is not a mark", () => {
|
|
399
|
+
const chart = '<<"chart", <<2>>, {"Bad"}>>';
|
|
400
|
+
const out = [
|
|
401
|
+
chart,
|
|
402
|
+
"@!@!@STARTMSG 2132:1 @!@!@",
|
|
403
|
+
"The first argument of Assert evaluated to FALSE; the second argument was:",
|
|
404
|
+
chart,
|
|
405
|
+
"@!@!@ENDMSG 2132 @!@!@",
|
|
406
|
+
"",
|
|
407
|
+
].join("\n");
|
|
408
|
+
const marks = [...readMarks(readMessages(out), "chart")];
|
|
409
|
+
assert.equal(marks.length, 1);
|
|
410
|
+
assert.deepEqual(marks, [...readMarks(readMessages(`${chart}\n`), "chart")]);
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
test("a line that the spec prints in the shape of a mark is spec output, not a mark", () => {
|
|
414
|
+
const out = [
|
|
415
|
+
'<<"chart", <<2>>, {"Bad"}>>',
|
|
416
|
+
'<< "chart-01234",',
|
|
417
|
+
' <<2>>, {"Bad"}>>',
|
|
418
|
+
'<<"chart-012", 1>>',
|
|
419
|
+
'x <<"chart-0123", <<2>>, {"Bad"}>>',
|
|
420
|
+
'<< "chart-0123",',
|
|
421
|
+
" <<3>>,",
|
|
422
|
+
' {"Bad"} >>',
|
|
423
|
+
"",
|
|
424
|
+
].join("\n");
|
|
425
|
+
assert.deepEqual(
|
|
426
|
+
[...readMarks(readMessages(out), "chart-0123")],
|
|
427
|
+
[{ values: [3], broken: ["Bad"] }],
|
|
428
|
+
);
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
const inv: Rule = { kind: "invariant", name: "Inv" };
|
|
432
|
+
|
|
433
|
+
test("a wrapped mark with a model value named constructor places on its state", () => {
|
|
434
|
+
const graph = graphOf([["s0", { x: parseValue("constructor") }, true]], []);
|
|
435
|
+
assert.equal(
|
|
436
|
+
mark(
|
|
437
|
+
graph,
|
|
438
|
+
readMarks(readMessages('<<"chart",\n<<constructor>>,\n{"Inv"}>>\n'), "chart"),
|
|
439
|
+
["x"],
|
|
440
|
+
[inv],
|
|
441
|
+
).size,
|
|
442
|
+
0,
|
|
443
|
+
);
|
|
444
|
+
assert.deepEqual(graph.states.get("s0")?.breaks, [inv]);
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
test("a tagged line in the wrong shape is an error, not spec output", () => {
|
|
448
|
+
for (const line of [
|
|
449
|
+
'<<"chart", [x |-> 1, y |-> 2], {"Inv"}>>',
|
|
450
|
+
'<<"chart", 1>>',
|
|
451
|
+
'<<"chart", <<1>>, <<"Inv">>>>',
|
|
452
|
+
'<<"chart", <<1>>, {1}>>',
|
|
453
|
+
'<<"chart", <<1>>, {"Inv"}, 2>>',
|
|
454
|
+
])
|
|
455
|
+
assert.throws(
|
|
456
|
+
() => [...readMarks(readMessages(`${line}\n`), "chart")],
|
|
457
|
+
/TLC printed a mark that the command cannot read/,
|
|
458
|
+
line,
|
|
459
|
+
);
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
const ab: View = { state: (v) => ({ A: `a${v.a}`, B: `b${v.b}` }) };
|
|
463
|
+
const bit = (v: Vars) => `${v.a}${v.b}${v.c}`;
|
|
464
|
+
const xorStates: StateRow[] = [];
|
|
465
|
+
const xorSteps: StepRow[] = [];
|
|
466
|
+
for (const a of [0, 1])
|
|
467
|
+
for (const b of [0, 1])
|
|
468
|
+
for (const c of [0, 1]) {
|
|
469
|
+
const v = { a, b, c };
|
|
470
|
+
xorStates.push([bit(v), v, a === 0]);
|
|
471
|
+
if (a === 0 && b !== c) xorSteps.push([bit(v), bit({ ...v, a: 1 }), "Go"]);
|
|
472
|
+
if (b === 0) xorSteps.push([bit(v), bit({ ...v, b: 1 }), "FlipB"]);
|
|
473
|
+
if (c === 0) xorSteps.push([bit(v), bit({ ...v, c: 1 }), "FlipC"]);
|
|
474
|
+
}
|
|
475
|
+
const truthGraphs: { [name: string]: [Graph, View] } = {
|
|
476
|
+
starts: [
|
|
477
|
+
graphOf(
|
|
478
|
+
[
|
|
479
|
+
["x0y0", { x: 0, y: 0 }, true],
|
|
480
|
+
["x1y1", { x: 1, y: 1 }, true],
|
|
481
|
+
["x1y0", { x: 1, y: 0 }],
|
|
482
|
+
],
|
|
483
|
+
[["x0y0", "x1y0", "Step"]],
|
|
484
|
+
),
|
|
485
|
+
{ state: (v) => ({ X: `x${v.x}`, Y: `y${v.y}` }) },
|
|
486
|
+
],
|
|
487
|
+
xor: [
|
|
488
|
+
graphOf(xorStates, xorSteps),
|
|
489
|
+
{ state: (v) => ({ A: `a${v.a}`, B: `b${v.b}`, C: `c${v.c}` }) },
|
|
490
|
+
],
|
|
491
|
+
fork: [
|
|
492
|
+
graphOf(
|
|
493
|
+
[
|
|
494
|
+
["a0b0", { a: 0, b: 0 }, true],
|
|
495
|
+
["a1b1", { a: 1, b: 1 }],
|
|
496
|
+
["a2b2", { a: 2, b: 2 }],
|
|
497
|
+
],
|
|
498
|
+
[
|
|
499
|
+
["a0b0", "a1b1", "Sync"],
|
|
500
|
+
["a0b0", "a2b2", "Sync"],
|
|
501
|
+
],
|
|
502
|
+
),
|
|
503
|
+
ab,
|
|
504
|
+
],
|
|
505
|
+
partial: [
|
|
506
|
+
graphOf(
|
|
507
|
+
[
|
|
508
|
+
["a0b0", { a: 0, b: 0 }, true],
|
|
509
|
+
["a1b1", { a: 1, b: 1 }],
|
|
510
|
+
["a1b0", { a: 1, b: 0 }],
|
|
511
|
+
],
|
|
512
|
+
[
|
|
513
|
+
["a0b0", "a1b1", "Act"],
|
|
514
|
+
["a0b0", "a1b0", "Act"],
|
|
515
|
+
],
|
|
516
|
+
),
|
|
517
|
+
ab,
|
|
518
|
+
],
|
|
519
|
+
lockstep: [
|
|
520
|
+
graphOf(
|
|
521
|
+
[
|
|
522
|
+
["a0b0", { a: 0, b: 0 }, true],
|
|
523
|
+
["a1b1", { a: 1, b: 1 }],
|
|
524
|
+
],
|
|
525
|
+
[["a0b0", "a1b1", "Act"]],
|
|
526
|
+
),
|
|
527
|
+
ab,
|
|
528
|
+
],
|
|
529
|
+
interleaved: [
|
|
530
|
+
graphOf(
|
|
531
|
+
[
|
|
532
|
+
["a0b0", { a: 0, b: 0 }, true],
|
|
533
|
+
["a1b0", { a: 1, b: 0 }],
|
|
534
|
+
["a0b1", { a: 0, b: 1 }],
|
|
535
|
+
["a1b1", { a: 1, b: 1 }],
|
|
536
|
+
],
|
|
537
|
+
[
|
|
538
|
+
["a0b0", "a1b0", "Act"],
|
|
539
|
+
["a0b0", "a0b1", "Act"],
|
|
540
|
+
["a1b0", "a1b1", "Act"],
|
|
541
|
+
["a0b1", "a1b1", "Act"],
|
|
542
|
+
],
|
|
543
|
+
),
|
|
544
|
+
ab,
|
|
545
|
+
],
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
for (const [name, regions] of [
|
|
549
|
+
["starts", false],
|
|
550
|
+
["xor", false],
|
|
551
|
+
["fork", false],
|
|
552
|
+
["partial", false],
|
|
553
|
+
["lockstep", true],
|
|
554
|
+
["interleaved", true],
|
|
555
|
+
] satisfies [string, boolean][]) {
|
|
556
|
+
test(`${name}: the chart uses regions only when they show the model's moves exactly`, () => {
|
|
557
|
+
const { chart, report: text } = draw(...truthGraphs[name]);
|
|
558
|
+
assert.equal(chart.includes('state "At the same time"'), regions);
|
|
559
|
+
assert.equal(/So the chart draws parent states in place of regions\.$/m.test(text), !regions);
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
test("the report says why regions cannot show a shared step that forks", () => {
|
|
564
|
+
assert.match(
|
|
565
|
+
draw(...truthGraphs.fork).report,
|
|
566
|
+
/^The regions chart lets A a0, B b0 go to A a1, B b2 by Sync, which the model never does\./m,
|
|
567
|
+
);
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
const forkToBug = graphOf(
|
|
571
|
+
[
|
|
572
|
+
["a0b0", { a: 0, b: 0 }, true],
|
|
573
|
+
["a1b1", { a: 1, b: 1 }],
|
|
574
|
+
["a2b2", { a: 2, b: 2 }, false, ["Safe"]],
|
|
575
|
+
],
|
|
576
|
+
[
|
|
577
|
+
["a0b0", "a1b1", "Sync"],
|
|
578
|
+
["a0b0", "a2b2", "Sync"],
|
|
579
|
+
],
|
|
580
|
+
);
|
|
581
|
+
|
|
582
|
+
test("a chart that draws parent states in place of regions still names each region in a bug path", () => {
|
|
583
|
+
const { chart, report: text } = draw(forkToBug, ab);
|
|
584
|
+
assert.match(chart, /^ {2}state "A a2" as s\d+ \{$/m);
|
|
585
|
+
assert.match(text, /^0\. A a0, B b0\n1\. Sync: A a2, B b2$/m);
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
test("the view answers once for each state and step, so a chart of parent states agrees with its report", () => {
|
|
589
|
+
const asked: { [question: string]: number } = {};
|
|
590
|
+
const answer = (question: string) => {
|
|
591
|
+
asked[question] = (asked[question] ?? 0) + 1;
|
|
592
|
+
return asked[question] === 1 ? "first" : "later";
|
|
593
|
+
};
|
|
594
|
+
const { chart, report: text } = draw(forkToBug, {
|
|
595
|
+
state: (v) => {
|
|
596
|
+
const word = answer(`state ${v.a}`);
|
|
597
|
+
return { A: `a${v.a} ${word}`, B: `b${v.b}` };
|
|
598
|
+
},
|
|
599
|
+
step: (action, from, to) => `${action} ${answer(`step ${from.a} to ${to.a}`)}`,
|
|
600
|
+
group: (v) => (answer(`group ${v.a}`) === "first" ? "Calm" : "Busy"),
|
|
601
|
+
colors: { Calm: "blue", Busy: "orange" },
|
|
602
|
+
});
|
|
603
|
+
assert.match(chart, /^ {2}state "A a2 first" as s\d+ \{$/m);
|
|
604
|
+
assert.doesNotMatch(chart, /later|orange/);
|
|
605
|
+
assert.match(text, /^0\. A a0 first, B b0\n1\. Sync first: A a2 first, B b2$/m);
|
|
606
|
+
assert.deepEqual(asked, {
|
|
607
|
+
"state 0": 1,
|
|
608
|
+
"state 1": 1,
|
|
609
|
+
"state 2": 1,
|
|
610
|
+
"step 0 to 1": 1,
|
|
611
|
+
"step 0 to 2": 1,
|
|
612
|
+
"group 0": 1,
|
|
613
|
+
"group 1": 1,
|
|
614
|
+
"group 2": 1,
|
|
615
|
+
});
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
test("a region state is marked when every combination with it can break a rule", () => {
|
|
619
|
+
const graph = graphOf(
|
|
620
|
+
[
|
|
621
|
+
["a0b0", { a: 0, b: 0 }, true],
|
|
622
|
+
["a1b0", { a: 1, b: 0 }],
|
|
623
|
+
["a2b0", { a: 2, b: 0 }, false, ["Safe"]],
|
|
624
|
+
["a2b1", { a: 2, b: 1 }, false, ["Safe"]],
|
|
625
|
+
["a0b1", { a: 0, b: 1 }],
|
|
626
|
+
],
|
|
627
|
+
[
|
|
628
|
+
["a0b0", "a1b0", "Go"],
|
|
629
|
+
["a1b0", "a2b0", "Go"],
|
|
630
|
+
["a2b0", "a2b1", "Flip"],
|
|
631
|
+
["a0b0", "a0b1", "Flip"],
|
|
632
|
+
],
|
|
633
|
+
);
|
|
634
|
+
assert.deepEqual(marked(draw(graph, ab).chart), { a2: "breaks" });
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
test("a combination that breaks a rule marks its states when no state of it has a mark", () => {
|
|
638
|
+
const graph = graphOf(
|
|
639
|
+
[
|
|
640
|
+
["a0b0", { a: 0, b: 0 }, true],
|
|
641
|
+
["a1b0", { a: 1, b: 0 }],
|
|
642
|
+
["a0b1", { a: 0, b: 1 }],
|
|
643
|
+
["a1b1", { a: 1, b: 1 }, false, ["Safe"]],
|
|
644
|
+
],
|
|
645
|
+
[
|
|
646
|
+
["a0b0", "a1b0", "GoA"],
|
|
647
|
+
["a0b0", "a0b1", "GoB"],
|
|
648
|
+
["a1b0", "a1b1", "GoB"],
|
|
649
|
+
["a0b1", "a1b1", "GoA"],
|
|
650
|
+
],
|
|
651
|
+
);
|
|
652
|
+
assert.deepEqual(marked(draw(graph, ab).chart), { a1: "mayBreak", b1: "mayBreak" });
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
test("a bug-path step that stays in one state is a loop in a flat chart only", () => {
|
|
656
|
+
const graph = graphOf(
|
|
657
|
+
[
|
|
658
|
+
["s0", { x: 0, y: 0 }, true],
|
|
659
|
+
["s1", { x: 0, y: 1 }, false, ["Safe"]],
|
|
660
|
+
["s2", { x: 1, y: 0 }],
|
|
661
|
+
],
|
|
662
|
+
[
|
|
663
|
+
["s0", "s1", "Tick"],
|
|
664
|
+
["s0", "s2", "Move"],
|
|
665
|
+
],
|
|
666
|
+
);
|
|
667
|
+
const flat = draw(graph, { state: (v) => `x${v.x}` });
|
|
668
|
+
assert.match(flat.chart, /^ {2}(s\d+) --> \1: Tick$/m);
|
|
669
|
+
assert.doesNotMatch(flat.report, /does not draw/);
|
|
670
|
+
const regions = draw(graph, { state: (v) => ({ X: `x${v.x}`, Z: "z" }) });
|
|
671
|
+
assert.doesNotMatch(regions.chart, /Tick/);
|
|
672
|
+
assert.match(regions.report, /^The chart does not draw 1 steps that stay in one chart state\.$/m);
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
test("a step that leaves every child of a parent the same way is one arrow from the parent", () => {
|
|
676
|
+
const graph = graphOf(
|
|
677
|
+
[
|
|
678
|
+
["x", { at: "Open.x" }, true],
|
|
679
|
+
["y", { at: "Open.y" }],
|
|
680
|
+
["done", { at: "Closed" }],
|
|
681
|
+
],
|
|
682
|
+
[
|
|
683
|
+
["x", "y", "Next"],
|
|
684
|
+
["x", "done", "Quit"],
|
|
685
|
+
["y", "done", "Quit"],
|
|
686
|
+
],
|
|
687
|
+
);
|
|
688
|
+
const { chart } = draw(graph, { state: (v) => String(v.at).split(".") });
|
|
689
|
+
const open = chart.match(/^ {2}state "Open" as (s\d+) \{$/m)?.[1];
|
|
690
|
+
const closed = chart.match(/^ {2}(s\d+): Closed$/m)?.[1];
|
|
691
|
+
const quits = [];
|
|
692
|
+
for (const m of chart.matchAll(/^ {2}(s\d+) --> (s\d+): Quit$/gm)) quits.push([m[1], m[2]]);
|
|
693
|
+
assert.deepEqual(quits, [[open, closed]]);
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
test("a label codes only the characters that Mermaid reads as syntax, so TLA+ values stay as TLC prints them", () => {
|
|
697
|
+
const graph = graphOf(
|
|
698
|
+
[
|
|
699
|
+
["s0", { n: 0 }, true],
|
|
700
|
+
["s1", { n: 1 }],
|
|
701
|
+
],
|
|
702
|
+
[["s0", "s1", "Go"]],
|
|
703
|
+
);
|
|
704
|
+
const { chart } = draw(graph, {
|
|
705
|
+
state: (v) => (v.n ? 'x: "1";\nnext' : "a <b> #2"),
|
|
706
|
+
step: () => 'say: <<1, "a">> :> [k |-> {}] @@ 2..3',
|
|
707
|
+
});
|
|
708
|
+
assert.match(chart, /^ {2}s\d+: a #60;b> #35;2$/m);
|
|
709
|
+
assert.match(chart, /^ {2}s\d+: x: "1"#59; next$/m);
|
|
710
|
+
assert.match(chart, /^ {2}s\d+ --> s\d+: say: <<1, "a">> :> \[k \|-> \{\}\] @@ 2\.\.3$/m);
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
test("a label with %% stays text and cannot open a Mermaid directive", () => {
|
|
714
|
+
const graph = graphOf(
|
|
715
|
+
[
|
|
716
|
+
["s0", { n: 0 }, true],
|
|
717
|
+
["s1", { n: 1 }],
|
|
718
|
+
],
|
|
719
|
+
[["s0", "s1", "Go"]],
|
|
720
|
+
);
|
|
721
|
+
const { chart } = draw(graph, {
|
|
722
|
+
state: (v) => (v.n ? "%%{init: {}}%%" : "a %%{ b"),
|
|
723
|
+
step: () => "%% go",
|
|
724
|
+
});
|
|
725
|
+
assert.doesNotMatch(chart, /%%/);
|
|
726
|
+
assert.match(chart, /^ {2}s\d+: a #37;%\{ b$/m);
|
|
727
|
+
assert.match(chart, /^ {2}s\d+: #37;%\{init: \{\}\}#37;%$/m);
|
|
728
|
+
assert.match(chart, /^ {2}s\d+ --> s\d+: #37;% go$/m);
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
test("each line break in a label or a colors key is a space, so it cannot start a chart line", () => {
|
|
732
|
+
const graph = graphOf(
|
|
733
|
+
[
|
|
734
|
+
["s0", { n: 0 }, true],
|
|
735
|
+
["s1", { n: 1 }],
|
|
736
|
+
],
|
|
737
|
+
[["s0", "s1", "Go"]],
|
|
738
|
+
);
|
|
739
|
+
const { chart } = draw(graph, {
|
|
740
|
+
state: (v) => (v.n ? "b\r\n\r\v\f\u0085\u2028\u2029\tc" : "a"),
|
|
741
|
+
step: () => "go\r s9: Ghost",
|
|
742
|
+
group: (v) => (v.n ? "Shut\r s99: Ghost state" : "Open"),
|
|
743
|
+
colors: { Open: "blue", "Shut\r s99: Ghost state": "pink" },
|
|
744
|
+
});
|
|
745
|
+
assert.doesNotMatch(chart, /[\r\v\f\u0085\u2028\u2029\t]/);
|
|
746
|
+
assert.match(chart, /^ {2}s\d+: b {9}c$/m);
|
|
747
|
+
assert.match(chart, /^ {2}s\d+ --> s\d+: go {3}s9: Ghost$/m);
|
|
748
|
+
assert.match(chart, /^ {4}lg1: Shut {3}s99: Ghost state$/m);
|
|
749
|
+
assert.doesNotMatch(chart, /^\s*s9{1,2}:/m);
|
|
750
|
+
});
|
|
751
|
+
|
|
752
|
+
test("a label of only white space or with a lone surrogate still has text in the chart", () => {
|
|
753
|
+
const graph = graphOf(
|
|
754
|
+
[
|
|
755
|
+
["s0", { n: 0 }, true],
|
|
756
|
+
["s1", { n: 1 }],
|
|
757
|
+
],
|
|
758
|
+
[["s0", "s1", "Go"]],
|
|
759
|
+
);
|
|
760
|
+
const { chart } = draw(graph, {
|
|
761
|
+
state: (v) => (v.n ? "a\ud800b" : "\t"),
|
|
762
|
+
step: () => " ",
|
|
763
|
+
});
|
|
764
|
+
assert.match(chart, /^ {2}s\d+: #32;$/m);
|
|
765
|
+
assert.match(chart, /^ {2}s\d+: a#65533;b$/m);
|
|
766
|
+
assert.match(chart, /^ {2}s\d+ --> s\d+: #32;$/m);
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
test("NUL and C1 controls in a label are left out, since a browser draws their character references as other characters", () => {
|
|
770
|
+
const graph = graphOf(
|
|
771
|
+
[
|
|
772
|
+
["s0", { n: 0 }, true],
|
|
773
|
+
["s1", { n: 1 }],
|
|
774
|
+
],
|
|
775
|
+
[["s0", "s1", "Go"]],
|
|
776
|
+
);
|
|
777
|
+
const { chart } = draw(graph, {
|
|
778
|
+
state: (v) => (v.n ? ["P\0\x80", "C\u00004Dynamic"] : "\0\x9f"),
|
|
779
|
+
step: () => "a\0\x80b\x85c\x9fd",
|
|
780
|
+
});
|
|
781
|
+
assert.doesNotMatch(chart, /[\0\x80-\x9f]|#0;|#1[2-5]\d;/);
|
|
782
|
+
assert.match(chart, /^ {2}s\d+: #32;$/m);
|
|
783
|
+
assert.match(chart, /^ {2}state "P" as s\d+ \{$/m);
|
|
784
|
+
assert.match(chart, /^ {4}s\d+: C#52;Dynamic$/m);
|
|
785
|
+
assert.match(chart, /^ {2}s\d+ --> s\d+: ab cd$/m);
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
test("a label puts a word joiner inside fl° and ¶ß, since Mermaid decodes a label's text a second time", () => {
|
|
789
|
+
const graph = graphOf(
|
|
790
|
+
[
|
|
791
|
+
["s0", { n: 0 }, true],
|
|
792
|
+
["s1", { n: 1 }],
|
|
793
|
+
],
|
|
794
|
+
[["s0", "s1", "Go"]],
|
|
795
|
+
);
|
|
796
|
+
const { chart } = draw(graph, {
|
|
797
|
+
state: (v) => (v.n ? ["fl\0°lt¶ß", "x"] : "fl°°65¶ßstateß"),
|
|
798
|
+
step: () => "fl ° ¶ ß",
|
|
799
|
+
});
|
|
800
|
+
assert.match(chart, /^ {2}s\d+: fl#8288;#176;#176;65#182;#8288;ßstateß$/m);
|
|
801
|
+
assert.match(chart, /^ {2}state "fl#8288;#176;lt#182;#8288;ß" as s\d+ \{$/m);
|
|
802
|
+
assert.match(chart, /^ {2}s\d+ --> s\d+: fl #176; #182; ß$/m);
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
test('a label puts a word joiner inside marker-end=", since Mermaid rewrites marker-end="url(…# in the drawn SVG', () => {
|
|
806
|
+
const graph = graphOf(
|
|
807
|
+
[
|
|
808
|
+
["s0", { n: 0 }, true],
|
|
809
|
+
["s1", { n: 1 }],
|
|
810
|
+
],
|
|
811
|
+
[["s0", "s1", "Go"]],
|
|
812
|
+
);
|
|
813
|
+
const { chart } = draw(graph, {
|
|
814
|
+
title: 'marker-end="url(a#b',
|
|
815
|
+
state: (v) => (v.n ? ['marker-end="url(p#q', "x"] : 'marker-end="url(a#b'),
|
|
816
|
+
step: () => 'a="b" = "c"',
|
|
817
|
+
});
|
|
818
|
+
assert.match(chart, /^title: "marker-end=fl°°8288¶ß\\"url\(afl°°35¶ßb"$/m);
|
|
819
|
+
assert.match(chart, /^ {2}s\d+: marker-end=#8288;"url\(a#35;b$/m);
|
|
820
|
+
assert.match(chart, /^ {2}state "marker-end=#8288;#34;url\(p#35;q" as s\d+ \{$/m);
|
|
821
|
+
assert.match(chart, /^ {2}s\d+ --> s\d+: a="b" = "c"$/m);
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
test("a parent or region name with [[fork]], [[join]], or [[choice]] stays text", () => {
|
|
825
|
+
const nested = graphOf(
|
|
826
|
+
[
|
|
827
|
+
["x", { n: 0 }, true],
|
|
828
|
+
["y", { n: 1 }],
|
|
829
|
+
],
|
|
830
|
+
[["x", "y", "Go"]],
|
|
831
|
+
);
|
|
832
|
+
const parents = draw(nested, {
|
|
833
|
+
state: (v) => [["a [[fork]]", "[[JOIN]]"][Number(v.n)], "In"],
|
|
834
|
+
}).chart;
|
|
835
|
+
assert.match(parents, /^ {2}state "a #91;\[fork\]\]" as s\d+ \{$/m);
|
|
836
|
+
assert.match(parents, /^ {2}state "#91;\[JOIN\]\]" as s\d+ \{$/m);
|
|
837
|
+
const parallel = graphOf(
|
|
838
|
+
[
|
|
839
|
+
["s0", { x: 0, y: 0 }, true],
|
|
840
|
+
["s1", { x: 1, y: 0 }],
|
|
841
|
+
],
|
|
842
|
+
[["s0", "s1", "GoX"]],
|
|
843
|
+
);
|
|
844
|
+
const regions = draw(parallel, {
|
|
845
|
+
state: (v) => ({ "[[choice]]": `X${v.x}`, Other: `Y${v.y}` }),
|
|
846
|
+
}).chart;
|
|
847
|
+
assert.match(regions, /^ {4}state "#91;\[choice\]\]" as r0 \{$/m);
|
|
848
|
+
assert.doesNotMatch(parents + regions, /\[\[/);
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
test("a label with C4Container, C4Component, C4Dynamic, or C4Deployment keeps the chart a state diagram", () => {
|
|
852
|
+
const graph = graphOf(
|
|
853
|
+
[
|
|
854
|
+
["s0", { n: 0 }, true],
|
|
855
|
+
["s1", { n: 1 }],
|
|
856
|
+
],
|
|
857
|
+
[["s0", "s1", "Go"]],
|
|
858
|
+
);
|
|
859
|
+
const { chart } = draw(graph, {
|
|
860
|
+
state: (v) => (v.n ? ["C4Component", "C4Deployment"] : "aC4Dynamic"),
|
|
861
|
+
step: () => "C4Container C4Context",
|
|
862
|
+
});
|
|
863
|
+
assert.doesNotMatch(chart, /C4(?:Container|Component|Dynamic|Deployment)/);
|
|
864
|
+
assert.match(chart, /^ {2}s\d+: aC#52;Dynamic$/m);
|
|
865
|
+
assert.match(chart, /^ {2}state "C#52;Component" as s\d+ \{$/m);
|
|
866
|
+
assert.match(chart, /^ {4}s\d+: C#52;Deployment$/m);
|
|
867
|
+
assert.match(chart, /^ {2}s\d+ --> s\d+: C#52;Container C4Context$/m);
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
test("a title with < cannot open an HTML tag that rewrites the chart's quotes", () => {
|
|
871
|
+
const graph = graphOf(
|
|
872
|
+
[
|
|
873
|
+
["s0", { n: 0 }, true],
|
|
874
|
+
["s1", { n: 1 }],
|
|
875
|
+
],
|
|
876
|
+
[["s0", "s1", "Go"]],
|
|
877
|
+
);
|
|
878
|
+
const { chart } = draw(graph, { title: "<a=", state: (v) => ["P", `S${v.n}`] });
|
|
879
|
+
assert.doesNotMatch(chart, /</);
|
|
880
|
+
assert.match(chart, /^title: "fl°°60¶ßa="$/m);
|
|
881
|
+
assert.match(chart, /^ {2}state "P" as s\d+ \{$/m);
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
test("the title writes each character outside the allow list in the form Mermaid decodes in a title", () => {
|
|
885
|
+
const graph = graphOf(
|
|
886
|
+
[
|
|
887
|
+
["s0", { n: 0 }, true],
|
|
888
|
+
["s1", { n: 1 }],
|
|
889
|
+
],
|
|
890
|
+
[["s0", "s1", "Go"]],
|
|
891
|
+
);
|
|
892
|
+
const state = (v: Vars) => `S${v.n}`;
|
|
893
|
+
const title = (t: string) =>
|
|
894
|
+
draw(graph, { title: t, state }).chart.match(/^---\ntitle: (.*)\n---\n/)?.[1];
|
|
895
|
+
assert.equal(title("Queue<T> for AT&T"), '"Queuefl°°60¶ßT> for ATfl°°38¶ßT"');
|
|
896
|
+
assert.equal(title("fl°°65¶ß"), '"flfl°°8288¶ßfl°°176¶ßfl°°176¶ß65fl°°182¶ßfl°°8288¶ßß"');
|
|
897
|
+
assert.equal(title('a\0b\x80\n"c"'), '"ab \\"c\\""');
|
|
898
|
+
const blank = draw(graph, { title: "\0\0", state }).chart;
|
|
899
|
+
assert.doesNotMatch(blank, /\0|^---$|^title:/m);
|
|
900
|
+
assert.match(blank, /^stateDiagram-v2$/m);
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
test("labels write the space between direction and LR, RL, TB, or BT as #32;", () => {
|
|
904
|
+
const graph = graphOf(
|
|
905
|
+
[
|
|
906
|
+
["s0", { n: 0 }, true],
|
|
907
|
+
["s1", { n: 1 }],
|
|
908
|
+
["s2", { n: 2 }],
|
|
909
|
+
["s3", { n: 3 }],
|
|
910
|
+
],
|
|
911
|
+
[
|
|
912
|
+
["s0", "s1", "Turn"],
|
|
913
|
+
["s1", "s2", "Back"],
|
|
914
|
+
["s2", "s3", "Go"],
|
|
915
|
+
],
|
|
916
|
+
);
|
|
917
|
+
const steps: { [action: string]: string } = {
|
|
918
|
+
Turn: "turn direction LR",
|
|
919
|
+
Back: "back direction rl",
|
|
920
|
+
Go: "go",
|
|
921
|
+
};
|
|
922
|
+
const { chart } = draw(graph, {
|
|
923
|
+
state: (v) =>
|
|
924
|
+
["Idle", "Facing direction TB", "Redirection\tlrx", "Up DIRECTION BT"][Number(v.n)],
|
|
925
|
+
step: (a) => steps[a],
|
|
926
|
+
});
|
|
927
|
+
assert.doesNotMatch(chart, /direction\s+(?:LR|RL|TB|BT)/i);
|
|
928
|
+
assert.match(chart, /^ {2}s\d+: Facing direction#32;TB$/m);
|
|
929
|
+
assert.match(chart, /^ {2}s\d+: Redirection#32;lrx$/m);
|
|
930
|
+
assert.match(chart, /^ {2}s\d+: Up DIRECTION#32;BT$/m);
|
|
931
|
+
assert.match(chart, /^ {2}s\d+ --> s\d+: turn direction#32;LR$/m);
|
|
932
|
+
assert.match(chart, /^ {2}s\d+ --> s\d+: back direction#32;rl$/m);
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
test("a view that cannot give a chart says what to change", () => {
|
|
936
|
+
const graph = graphOf(
|
|
937
|
+
[
|
|
938
|
+
["p", { x: "A" }, true],
|
|
939
|
+
["q", { x: "A.B" }],
|
|
940
|
+
],
|
|
941
|
+
[["p", "q", "Go"]],
|
|
942
|
+
);
|
|
943
|
+
assert.throws(
|
|
944
|
+
() => draw(graph, { state: (v) => String(v.x).split(".") }),
|
|
945
|
+
/both as a state and as a parent state/,
|
|
946
|
+
);
|
|
947
|
+
assert.throws(
|
|
948
|
+
() => draw(graph, { state: (v) => (v.x === "A" ? { R: "x" } : { S: "y" }) }),
|
|
949
|
+
/Return the same regions for every state/,
|
|
950
|
+
);
|
|
951
|
+
assert.throws(() => draw(graph, { state: () => [] }), /Return a string, an array of strings/);
|
|
952
|
+
});
|
|
953
|
+
|
|
954
|
+
const keyGraph = () =>
|
|
955
|
+
graphOf(
|
|
956
|
+
[
|
|
957
|
+
["idle", { pos: "idle", key: parseValue("[on |-> FALSE, at |-> 0]") }, true],
|
|
958
|
+
["waitKeyOff", { pos: "wait", key: parseValue("[on |-> FALSE, at |-> 0]") }],
|
|
959
|
+
["waitKeyOn", { pos: "wait", key: parseValue("[on |-> TRUE, at |-> 0]") }],
|
|
960
|
+
["done", { pos: "done", key: parseValue("[on |-> TRUE, at |-> 0]") }],
|
|
961
|
+
],
|
|
962
|
+
[
|
|
963
|
+
["idle", "waitKeyOff", "Go"],
|
|
964
|
+
["idle", "waitKeyOn", "GoKey"],
|
|
965
|
+
["waitKeyOff", "waitKeyOff", "Tick"],
|
|
966
|
+
["waitKeyOff", "idle", "Back"],
|
|
967
|
+
["waitKeyOn", "done", "Open"],
|
|
968
|
+
],
|
|
969
|
+
);
|
|
970
|
+
const keyState = (header: string, pos: string) => ({
|
|
971
|
+
code: EC.TLC_STATE_PRINT2,
|
|
972
|
+
level: LEVEL.STATE,
|
|
973
|
+
body: [header, `/\\ pos = "${pos}"`, "/\\ key = [at |-> 0, on |-> FALSE]", ""],
|
|
974
|
+
});
|
|
975
|
+
const keyTrace = () =>
|
|
976
|
+
readTrace([
|
|
977
|
+
keyState("1: <Initial predicate>", "idle"),
|
|
978
|
+
keyState("2: <Go line 9, col 3 to line 9, col 20 of module Key>", "wait"),
|
|
979
|
+
{ code: EC.TLC_STATE_PRINT3, level: LEVEL.STATE, body: ["3: Stuttering"] },
|
|
980
|
+
]);
|
|
981
|
+
|
|
982
|
+
test("a loop's trace finds its states when TLC prints record fields in another order", () => {
|
|
983
|
+
const graph = keyGraph();
|
|
984
|
+
const bug = lasso(graph, keyTrace(), ["pos", "key"]);
|
|
985
|
+
assert.ok(bug);
|
|
986
|
+
assert.equal(bug.start, "idle");
|
|
987
|
+
const moves = [];
|
|
988
|
+
for (const p of bug.path) moves.push([p.action, p.state]);
|
|
989
|
+
assert.deepEqual(moves, [["Go", "waitKeyOff"]]);
|
|
990
|
+
assert.equal(bug.loop, 1);
|
|
991
|
+
assert.equal(bug.stutters, true);
|
|
992
|
+
});
|
|
993
|
+
|
|
994
|
+
test("a view may hide a step inside a loop, but not a step out of it", () => {
|
|
995
|
+
const graph = keyGraph();
|
|
996
|
+
const found = lasso(graph, keyTrace(), ["pos", "key"]);
|
|
997
|
+
assert.ok(found);
|
|
998
|
+
const loop: Bug = { rule: { kind: "property", name: "Opens" }, ...found };
|
|
999
|
+
const state = (v: Vars) => `${v.pos}, key ${field(v.key, "on") ? "on" : "off"}`;
|
|
1000
|
+
const { report } = draw(graph, { state, step: (a) => (a === "Tick" ? null : a) }, [loop]);
|
|
1001
|
+
assert.match(report, /^The run stops in "wait, key off" forever\.$/m);
|
|
1002
|
+
assert.throws(
|
|
1003
|
+
() => draw(graph, { state, step: (a) => (a === "Back" ? null : a) }, [loop]),
|
|
1004
|
+
/the step Back that changes pos\. It is on the path to the Opens bug or leaves its loop/,
|
|
1005
|
+
);
|
|
1006
|
+
});
|
|
1007
|
+
|
|
1008
|
+
test("a loop that passes one state twice names it once", () => {
|
|
1009
|
+
const graph = graphOf(
|
|
1010
|
+
[
|
|
1011
|
+
["a", { pos: "a" }, true],
|
|
1012
|
+
["b", { pos: "b" }],
|
|
1013
|
+
["c", { pos: "c" }],
|
|
1014
|
+
],
|
|
1015
|
+
[
|
|
1016
|
+
["a", "b", "Up"],
|
|
1017
|
+
["b", "a", "Down"],
|
|
1018
|
+
["a", "c", "Side"],
|
|
1019
|
+
["c", "a", "Back"],
|
|
1020
|
+
],
|
|
1021
|
+
);
|
|
1022
|
+
const path: PathStep[] = [];
|
|
1023
|
+
for (const [from, to] of ["ab", "ba", "ac", "ca"]) {
|
|
1024
|
+
let step: Step | undefined;
|
|
1025
|
+
for (const t of graph.steps)
|
|
1026
|
+
if (t.from === from && t.to === to) {
|
|
1027
|
+
step = t;
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
1030
|
+
assert.ok(step);
|
|
1031
|
+
path.push({ action: step.action, state: to, step });
|
|
1032
|
+
}
|
|
1033
|
+
const loop: Bug = {
|
|
1034
|
+
rule: { kind: "property", name: "Settles" },
|
|
1035
|
+
start: "a",
|
|
1036
|
+
path,
|
|
1037
|
+
loop: 0,
|
|
1038
|
+
stutters: false,
|
|
1039
|
+
};
|
|
1040
|
+
const { report } = draw(graph, { state: (v) => v.pos }, [loop]);
|
|
1041
|
+
assert.match(report, /^The run loops through "a", "b" and "c" forever\.$/m);
|
|
1042
|
+
});
|
|
1043
|
+
|
|
1044
|
+
test("a chart that draws a way out of a loop that the loop cannot take stops the command", () => {
|
|
1045
|
+
const graph = keyGraph();
|
|
1046
|
+
const found = lasso(graph, keyTrace(), ["pos", "key"]);
|
|
1047
|
+
assert.ok(found);
|
|
1048
|
+
const loop: Bug = { rule: { kind: "property", name: "Opens" }, ...found };
|
|
1049
|
+
assert.throws(
|
|
1050
|
+
() => draw(graph, { state: (v) => v.pos }, [loop]),
|
|
1051
|
+
/draws the step Open out of wait, but the Opens loop cannot take it there/,
|
|
1052
|
+
);
|
|
1053
|
+
const { chart } = draw(
|
|
1054
|
+
graph,
|
|
1055
|
+
{ state: (v) => `${v.pos}, key ${field(v.key, "on") ? "on" : "off"}` },
|
|
1056
|
+
[loop],
|
|
1057
|
+
);
|
|
1058
|
+
const wait = chart.match(/^ {2}(s\d+): wait, key off$/m)?.[1];
|
|
1059
|
+
assert.match(chart, new RegExp(`^ {2}class ${wait} repeats$`, "m"));
|
|
1060
|
+
});
|
|
1061
|
+
|
|
1062
|
+
test("a region named __proto__ is a region like any other", () => {
|
|
1063
|
+
const graph = graphOf(
|
|
1064
|
+
[
|
|
1065
|
+
["s0", { x: 0, y: 0 }, true],
|
|
1066
|
+
["s1", { x: 1, y: 0 }],
|
|
1067
|
+
["s2", { x: 0, y: 1 }],
|
|
1068
|
+
],
|
|
1069
|
+
[
|
|
1070
|
+
["s0", "s1", "GoX"],
|
|
1071
|
+
["s0", "s2", "GoY"],
|
|
1072
|
+
],
|
|
1073
|
+
);
|
|
1074
|
+
const { chart } = draw(graph, {
|
|
1075
|
+
state: (v): unknown => JSON.parse(`{"__proto__": "X${v.x}", "Other": "Y${v.y}"}`),
|
|
1076
|
+
});
|
|
1077
|
+
assert.match(chart, /^ {4}state "#95;#95;proto#95;#95;" as r0 \{$/m);
|
|
1078
|
+
assert.match(chart, /^ {6}s0 --> s1: GoX \[when Y0\]$/m);
|
|
1079
|
+
assert.match(chart, /^ {4}state "Other" as r1 \{$/m);
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
test("checkView takes a full view and refuses each wrong kind and every bad color", () => {
|
|
1083
|
+
checkView({}, inspect);
|
|
1084
|
+
checkView(
|
|
1085
|
+
{
|
|
1086
|
+
state: (v: Vars) => v.x,
|
|
1087
|
+
step: (a: string) => a,
|
|
1088
|
+
group: () => "Busy",
|
|
1089
|
+
colors: { Busy: "blue" },
|
|
1090
|
+
title: "T",
|
|
1091
|
+
},
|
|
1092
|
+
inspect,
|
|
1093
|
+
);
|
|
1094
|
+
assert.throws(() => checkView({ colors: null }, inspect), /\bcolors\b[\s\S]*\bobject\b/);
|
|
1095
|
+
assert.throws(() => checkView({ colors: ["blue"] }, inspect), /\bcolors\b[\s\S]*\bobject\b/);
|
|
1096
|
+
assert.throws(() => checkView({ state: "Busy" }, inspect), /\bstate\b[\s\S]*\bfunction\b/);
|
|
1097
|
+
assert.throws(
|
|
1098
|
+
() => checkView({ colors: { Busy: "red", Idle: "repeats", Done: "tan" } }, inspect),
|
|
1099
|
+
(error: unknown) =>
|
|
1100
|
+
error instanceof Error &&
|
|
1101
|
+
/\bBusy\b[\s\S]*"red"/.test(error.message) &&
|
|
1102
|
+
/\bIdle\b[\s\S]*"repeats"/.test(error.message) &&
|
|
1103
|
+
!/\bDone\b/.test(error.message),
|
|
1104
|
+
);
|
|
1105
|
+
});
|
|
1106
|
+
|
|
1107
|
+
test("a group named like an Object method still needs its own color", () => {
|
|
1108
|
+
const graph = graphOf([["s0", { x: 0 }, true]], []);
|
|
1109
|
+
assert.throws(
|
|
1110
|
+
() => draw(graph, checkView({ group: () => "toString", colors: {} }, inspect)),
|
|
1111
|
+
/group\(\) returned "toString"/,
|
|
1112
|
+
);
|
|
1113
|
+
});
|
|
1114
|
+
|
|
1115
|
+
test("a message writes each value the way JavaScript shows it", () => {
|
|
1116
|
+
const loop: { self?: unknown } = {};
|
|
1117
|
+
loop.self = loop;
|
|
1118
|
+
assert.throws(
|
|
1119
|
+
() =>
|
|
1120
|
+
checkView(
|
|
1121
|
+
{ colors: { Lost: NaN, Far: Infinity, Big: 7n, Boxed: new String("blue"), Loop: loop } },
|
|
1122
|
+
inspect,
|
|
1123
|
+
),
|
|
1124
|
+
/"Lost" the color NaN, "Far" the color Infinity, "Big" the color 7n, "Boxed" the color \[String: 'blue'\] and "Loop" the color <ref \*1> \{ self: \[Circular \*1\] \}\./,
|
|
1125
|
+
);
|
|
1126
|
+
const graph = graphOf([["s0", { x: 0 }, true]], []);
|
|
1127
|
+
assert.throws(
|
|
1128
|
+
() => draw(graph, checkView({ group: () => NaN, colors: {} }, inspect)),
|
|
1129
|
+
/group\(\) returned NaN,/,
|
|
1130
|
+
);
|
|
1131
|
+
});
|
|
1132
|
+
|
|
1133
|
+
test("checkView takes colors only as a plain object", () => {
|
|
1134
|
+
const bare: object = Object.create(null);
|
|
1135
|
+
checkView({ colors: Object.assign(bare, { Busy: "blue" }) }, inspect);
|
|
1136
|
+
const inherited: object = Object.create({ Busy: "blue" });
|
|
1137
|
+
for (const colors of [new Map([["Busy", "blue"]]), inherited, new String("blue")])
|
|
1138
|
+
assert.throws(() => checkView({ colors }, inspect), {
|
|
1139
|
+
message: "The view's colors must be a plain object.",
|
|
1140
|
+
});
|
|
1141
|
+
});
|
|
1142
|
+
|
|
1143
|
+
test("the chart uses the colors that checkView read once from the view's own keys", () => {
|
|
1144
|
+
const graph = graphOf([["s0", { x: 0 }, true]], []);
|
|
1145
|
+
let reads = 0;
|
|
1146
|
+
const flips = {
|
|
1147
|
+
get Busy() {
|
|
1148
|
+
reads += 1;
|
|
1149
|
+
return reads === 1 ? "blue" : "breaks";
|
|
1150
|
+
},
|
|
1151
|
+
};
|
|
1152
|
+
const changed = { Busy: "blue" };
|
|
1153
|
+
const changes = () => {
|
|
1154
|
+
changed.Busy = "breaks";
|
|
1155
|
+
return "Busy";
|
|
1156
|
+
};
|
|
1157
|
+
for (const view of [
|
|
1158
|
+
{ group: () => "Busy", colors: flips },
|
|
1159
|
+
{ group: changes, colors: changed },
|
|
1160
|
+
]) {
|
|
1161
|
+
const { chart } = draw(graph, checkView(view, inspect));
|
|
1162
|
+
assert.match(chart, /^ {2}class s\d+ blue$/m);
|
|
1163
|
+
assert.doesNotMatch(chart, /\bbreaks\b/);
|
|
1164
|
+
}
|
|
1165
|
+
const hidden = Object.defineProperty({}, "Busy", { value: "breaks" });
|
|
1166
|
+
assert.throws(
|
|
1167
|
+
() => draw(graph, checkView({ group: () => "Busy", colors: hidden }, inspect)),
|
|
1168
|
+
/group\(\) returned "Busy", which colors does not name/,
|
|
1169
|
+
);
|
|
1170
|
+
const key = Symbol("Busy");
|
|
1171
|
+
assert.throws(
|
|
1172
|
+
() => draw(graph, checkView({ group: () => key, colors: { [key]: "breaks" } }, inspect)),
|
|
1173
|
+
/group\(\) returned Symbol\(Busy\), which colors does not name/,
|
|
1174
|
+
);
|
|
1175
|
+
});
|
|
1176
|
+
|
|
1177
|
+
test("a chart state with mixed groups gets no color, even when colors names undefined", () => {
|
|
1178
|
+
const graph = graphOf(
|
|
1179
|
+
[
|
|
1180
|
+
["s0", { x: 0 }, true],
|
|
1181
|
+
["s1", { x: 1 }],
|
|
1182
|
+
],
|
|
1183
|
+
[["s0", "s1", "Go"]],
|
|
1184
|
+
);
|
|
1185
|
+
const view: View = {
|
|
1186
|
+
state: () => "Same",
|
|
1187
|
+
group: (v) => (v.x ? "B" : "A"),
|
|
1188
|
+
colors: { A: "blue", B: "teal", undefined: "pink" },
|
|
1189
|
+
};
|
|
1190
|
+
assert.doesNotMatch(draw(graph, view).chart, /^ {2}class /m);
|
|
1191
|
+
});
|
|
1192
|
+
|
|
1193
|
+
test("a graph of 10,000 states draws in seconds with no view", () => {
|
|
1194
|
+
const n = 100;
|
|
1195
|
+
const states: StateRow[] = [];
|
|
1196
|
+
const steps: StepRow[] = [];
|
|
1197
|
+
for (let x = 0; x < n; x++)
|
|
1198
|
+
for (let y = 0; y < n; y++) {
|
|
1199
|
+
const far = x === n - 1 && y === n - 1;
|
|
1200
|
+
states.push([`${x},${y}`, { x, y }, x + y === 0, far ? ["Safe"] : []]);
|
|
1201
|
+
if (x + 1 < n) steps.push([`${x},${y}`, `${x + 1},${y}`, "Right"]);
|
|
1202
|
+
if (y + 1 < n) steps.push([`${x},${y}`, `${x},${y + 1}`, "Down"]);
|
|
1203
|
+
}
|
|
1204
|
+
const start = performance.now();
|
|
1205
|
+
const { chart, report: text } = draw(graphOf(states, steps), {});
|
|
1206
|
+
const seconds = (performance.now() - start) / 1000;
|
|
1207
|
+
assert.match(text, /^The shortest path has 198 steps:$/m);
|
|
1208
|
+
assert.equal(chart.match(/^ {2}s\d+: /gm)?.length, n * n);
|
|
1209
|
+
assert.ok(seconds < 5, `drawing took ${seconds.toFixed(1)} s`);
|
|
1210
|
+
});
|