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,1023 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChecksUnavailable,
|
|
3
|
+
WatcherQueryError,
|
|
4
|
+
resolveChecks,
|
|
5
|
+
resolveReviewThreads,
|
|
6
|
+
} from "./github.ts";
|
|
7
|
+
import { reviewSettler, waitReason, type ReviewSettler } from "./settle.ts";
|
|
8
|
+
import type * as T from "./types.ts";
|
|
9
|
+
import { nonEmpty } from "./types.ts";
|
|
10
|
+
export function assessGitHubMerge(args: {
|
|
11
|
+
readonly mergeStateStatus: T.MergeStateStatus;
|
|
12
|
+
readonly headRollupState: null;
|
|
13
|
+
}): T.GitHubMergeAllowed;
|
|
14
|
+
export function assessGitHubMerge(args: {
|
|
15
|
+
readonly mergeStateStatus: T.MergeStateStatus;
|
|
16
|
+
readonly headRollupState: T.RollupState;
|
|
17
|
+
}): T.GitHubMergeAssessment;
|
|
18
|
+
export function assessGitHubMerge(args: {
|
|
19
|
+
readonly mergeStateStatus: T.MergeStateStatus;
|
|
20
|
+
readonly headRollupState: T.RollupState;
|
|
21
|
+
}): T.GitHubMergeAssessment {
|
|
22
|
+
if (args.mergeStateStatus === "BLOCKED") {
|
|
23
|
+
if (args.headRollupState === "ERROR" || args.headRollupState === "FAILURE")
|
|
24
|
+
return {
|
|
25
|
+
kind: "refused",
|
|
26
|
+
mergeStateStatus: args.mergeStateStatus,
|
|
27
|
+
headRollupState: args.headRollupState,
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
kind: "allowed",
|
|
31
|
+
basis: "rollup",
|
|
32
|
+
mergeStateStatus: args.mergeStateStatus,
|
|
33
|
+
headRollupState: args.headRollupState,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
kind: "allowed",
|
|
38
|
+
basis: "merge-state",
|
|
39
|
+
mergeStateStatus: args.mergeStateStatus,
|
|
40
|
+
headRollupState: args.headRollupState,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async function mergeAssessment(
|
|
44
|
+
reader: T.GitHubReader,
|
|
45
|
+
facts: T.PullRequestFacts
|
|
46
|
+
) {
|
|
47
|
+
const commits = await reader.commitRollups(facts.context);
|
|
48
|
+
const headRollupState =
|
|
49
|
+
facts.headRefOid === null
|
|
50
|
+
? null
|
|
51
|
+
: (commits.find((commit) => commit.oid === facts.headRefOid)?.state ??
|
|
52
|
+
null);
|
|
53
|
+
return {
|
|
54
|
+
hadPreviousPassingCi: commits.some(
|
|
55
|
+
(commit) => commit.oid !== facts.headRefOid && commit.state === "SUCCESS"
|
|
56
|
+
),
|
|
57
|
+
github: assessGitHubMerge({
|
|
58
|
+
mergeStateStatus: facts.mergeStateStatus,
|
|
59
|
+
headRollupState,
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// GitHub reads BLOCKED for a moment while it computes mergeability, while a
|
|
64
|
+
// queued PR changes state, and until a required check on a new head registers.
|
|
65
|
+
// A BLOCKED read stops the watcher only once the same head has read BLOCKED,
|
|
66
|
+
// with no check pending, across this many seconds.
|
|
67
|
+
const BLOCKED_CONFIRM_SECONDS = 60;
|
|
68
|
+
class BlockUnconfirmed extends Error {
|
|
69
|
+
readonly pr: T.PrContext;
|
|
70
|
+
constructor(pr: T.PrContext) {
|
|
71
|
+
super(`#${pr.number} reads BLOCKED; confirming the merge block`);
|
|
72
|
+
this.name = "BlockUnconfirmed";
|
|
73
|
+
this.pr = pr;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
interface BlockClock {
|
|
77
|
+
observe(facts: T.PullRequestFacts, ci: T.CiState): void;
|
|
78
|
+
held(facts: T.PullRequestFacts): boolean;
|
|
79
|
+
}
|
|
80
|
+
function blockClock(clock: Pick<WatchClock, "now">): BlockClock {
|
|
81
|
+
const reads = new Map<
|
|
82
|
+
T.PrNumber,
|
|
83
|
+
{
|
|
84
|
+
readonly headRefOid: string | null;
|
|
85
|
+
readonly since: number;
|
|
86
|
+
readonly last: number;
|
|
87
|
+
}
|
|
88
|
+
>();
|
|
89
|
+
return {
|
|
90
|
+
observe({ context, headRefOid, mergeStateStatus }, ci) {
|
|
91
|
+
if (mergeStateStatus !== "BLOCKED" || ci.kind === "ci-pending") {
|
|
92
|
+
reads.delete(context.number);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const prior = reads.get(context.number);
|
|
96
|
+
const since =
|
|
97
|
+
prior?.headRefOid === headRefOid ? prior.since : clock.now();
|
|
98
|
+
reads.set(context.number, { headRefOid, since, last: clock.now() });
|
|
99
|
+
},
|
|
100
|
+
held({ context, headRefOid }) {
|
|
101
|
+
const read = reads.get(context.number);
|
|
102
|
+
return (
|
|
103
|
+
read?.headRefOid === headRefOid &&
|
|
104
|
+
read.last - read.since >= BLOCKED_CONFIRM_SECONDS
|
|
105
|
+
);
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// gateReason gives these two reasons only to the frontier.
|
|
110
|
+
function confirmGate(
|
|
111
|
+
blocker: T.MergeBlocker,
|
|
112
|
+
row: T.PrSnapshot | undefined,
|
|
113
|
+
blocks: BlockClock | undefined
|
|
114
|
+
): void {
|
|
115
|
+
if (
|
|
116
|
+
blocker.kind === "merge-gate" &&
|
|
117
|
+
(blocker.reason === "merge-blocked" ||
|
|
118
|
+
blocker.reason === "review-required") &&
|
|
119
|
+
row?.kind === "open" &&
|
|
120
|
+
row.facts.mergeStateStatus === "BLOCKED" &&
|
|
121
|
+
blocks !== undefined &&
|
|
122
|
+
!blocks.held(row.facts)
|
|
123
|
+
)
|
|
124
|
+
throw new BlockUnconfirmed(blocker.pr);
|
|
125
|
+
}
|
|
126
|
+
// Right after a push the head rollup is null until the first check registers.
|
|
127
|
+
// An earlier commit that reported checks, or mergeability GitHub is still
|
|
128
|
+
// computing, means the head has not reported yet.
|
|
129
|
+
async function noChecksCi(
|
|
130
|
+
reader: T.GitHubReader,
|
|
131
|
+
facts: T.PullRequestFacts
|
|
132
|
+
): Promise<T.CiNone> {
|
|
133
|
+
const commits = await reader.commitRollups(facts.context);
|
|
134
|
+
if (commits.some((commit) => commit.state !== null))
|
|
135
|
+
throw new ChecksUnavailable(
|
|
136
|
+
`no checks reported on head ${facts.headRefOid}, but a commit on this PR has reported checks`
|
|
137
|
+
);
|
|
138
|
+
if (facts.mergeable === "UNKNOWN")
|
|
139
|
+
throw new ChecksUnavailable(
|
|
140
|
+
`no checks reported on head ${facts.headRefOid}, and GitHub has not computed mergeability yet`
|
|
141
|
+
);
|
|
142
|
+
return {
|
|
143
|
+
kind: "ci-none",
|
|
144
|
+
failed: [],
|
|
145
|
+
pending: [],
|
|
146
|
+
hadPreviousPassingCi: false,
|
|
147
|
+
github: assessGitHubMerge({
|
|
148
|
+
mergeStateStatus: facts.mergeStateStatus,
|
|
149
|
+
headRollupState: null,
|
|
150
|
+
}),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
const AUTOMATION_TOKENS = [
|
|
154
|
+
"bugbot",
|
|
155
|
+
"security review",
|
|
156
|
+
"pr review automation",
|
|
157
|
+
"review automation",
|
|
158
|
+
] as const;
|
|
159
|
+
export async function readSnapshot(args: {
|
|
160
|
+
readonly reader: T.GitHubReader;
|
|
161
|
+
readonly context: T.PrContext;
|
|
162
|
+
readonly pendingHistory: "include" | "omit";
|
|
163
|
+
readonly allowDraft: boolean;
|
|
164
|
+
readonly settler?: ReviewSettler;
|
|
165
|
+
readonly blockClock?: BlockClock;
|
|
166
|
+
}): Promise<T.PrSnapshot> {
|
|
167
|
+
const facts = await args.reader.pullRequest(args.context);
|
|
168
|
+
if (facts.state === "MERGED" || facts.mergedAt !== null)
|
|
169
|
+
return { kind: "merged", context: args.context, facts };
|
|
170
|
+
if (facts.state === "CLOSED")
|
|
171
|
+
return { kind: "closed", context: args.context, facts };
|
|
172
|
+
const threads = await resolveReviewThreads(args.reader, args.context);
|
|
173
|
+
const checks = await resolveChecks(args.reader, args.context);
|
|
174
|
+
const reported: readonly T.Check[] = checks.checks;
|
|
175
|
+
const failed = nonEmpty(
|
|
176
|
+
reported.filter((check): check is T.FailedCheck => check.kind === "failed")
|
|
177
|
+
);
|
|
178
|
+
const pending = nonEmpty(
|
|
179
|
+
reported.filter(
|
|
180
|
+
(check): check is T.PendingCheck => check.kind === "pending"
|
|
181
|
+
)
|
|
182
|
+
);
|
|
183
|
+
let ci: T.CiState;
|
|
184
|
+
if (checks.source === "none") ci = await noChecksCi(args.reader, facts);
|
|
185
|
+
else if (
|
|
186
|
+
failed === null &&
|
|
187
|
+
pending !== null &&
|
|
188
|
+
args.pendingHistory === "omit"
|
|
189
|
+
)
|
|
190
|
+
ci = {
|
|
191
|
+
kind: "ci-pending",
|
|
192
|
+
source: checks.source,
|
|
193
|
+
all: checks.checks,
|
|
194
|
+
failed: [],
|
|
195
|
+
pending,
|
|
196
|
+
hadPreviousPassingCi: false,
|
|
197
|
+
};
|
|
198
|
+
else {
|
|
199
|
+
const merge = await mergeAssessment(args.reader, facts);
|
|
200
|
+
const base = {
|
|
201
|
+
source: checks.source,
|
|
202
|
+
all: checks.checks,
|
|
203
|
+
hadPreviousPassingCi: merge.hadPreviousPassingCi,
|
|
204
|
+
};
|
|
205
|
+
if (failed !== null)
|
|
206
|
+
ci = {
|
|
207
|
+
...base,
|
|
208
|
+
kind: "ci-failing",
|
|
209
|
+
failed,
|
|
210
|
+
pending: pending ?? [],
|
|
211
|
+
github: merge.github,
|
|
212
|
+
};
|
|
213
|
+
else if (merge.github.kind === "refused")
|
|
214
|
+
ci = {
|
|
215
|
+
...base,
|
|
216
|
+
kind: "ci-github-rejected",
|
|
217
|
+
failed: [],
|
|
218
|
+
pending: pending ?? [],
|
|
219
|
+
github: merge.github,
|
|
220
|
+
};
|
|
221
|
+
else if (pending !== null)
|
|
222
|
+
ci = { ...base, kind: "ci-pending", failed: [], pending };
|
|
223
|
+
else
|
|
224
|
+
ci = {
|
|
225
|
+
...base,
|
|
226
|
+
kind: "ci-clean",
|
|
227
|
+
failed: [],
|
|
228
|
+
pending: [],
|
|
229
|
+
github: merge.github,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
// A no-checks head may read BLOCKED for a required check that has not
|
|
233
|
+
// registered yet, so it waits on any row, not only at the frontier gate.
|
|
234
|
+
args.blockClock?.observe(facts, ci);
|
|
235
|
+
if (
|
|
236
|
+
ci.kind === "ci-none" &&
|
|
237
|
+
facts.mergeStateStatus === "BLOCKED" &&
|
|
238
|
+
args.blockClock !== undefined &&
|
|
239
|
+
!args.blockClock.held(facts)
|
|
240
|
+
)
|
|
241
|
+
throw new BlockUnconfirmed(args.context);
|
|
242
|
+
return {
|
|
243
|
+
kind: "open",
|
|
244
|
+
context: args.context,
|
|
245
|
+
facts,
|
|
246
|
+
threads,
|
|
247
|
+
ci,
|
|
248
|
+
reviewAutomationRunning: checks.checks.some(
|
|
249
|
+
(check) =>
|
|
250
|
+
check.kind === "pending" &&
|
|
251
|
+
AUTOMATION_TOKENS.some((token) =>
|
|
252
|
+
check.name.toLowerCase().includes(token)
|
|
253
|
+
)
|
|
254
|
+
),
|
|
255
|
+
settle: (await args.settler?.(facts)) ?? { kind: "off" },
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const conflictBlocker = (row: T.PrSnapshot): T.MergeBlocker | null =>
|
|
259
|
+
row.kind === "open" &&
|
|
260
|
+
(row.facts.mergeable === "CONFLICTING" ||
|
|
261
|
+
row.facts.mergeStateStatus === "DIRTY" ||
|
|
262
|
+
row.facts.mergeStateStatus === "CONFLICTING")
|
|
263
|
+
? { kind: "merge-conflicts", pr: row.context, facts: row.facts }
|
|
264
|
+
: null;
|
|
265
|
+
function threadBlocker(row: T.PrSnapshot): T.MergeBlocker | null {
|
|
266
|
+
if (row.kind !== "open") return null;
|
|
267
|
+
const threads = nonEmpty(row.threads);
|
|
268
|
+
return threads === null
|
|
269
|
+
? null
|
|
270
|
+
: { kind: "review-threads", pr: row.context, threads };
|
|
271
|
+
}
|
|
272
|
+
const ciBlocker = (row: T.PrSnapshot): T.MergeBlocker | null =>
|
|
273
|
+
row.kind === "open" &&
|
|
274
|
+
(row.ci.kind === "ci-failing" || row.ci.kind === "ci-github-rejected")
|
|
275
|
+
? { kind: "failing-checks", pr: row.context, ci: row.ci }
|
|
276
|
+
: null;
|
|
277
|
+
function gateReason(
|
|
278
|
+
row: T.PrSnapshot,
|
|
279
|
+
allowDraft: boolean,
|
|
280
|
+
frontier: boolean
|
|
281
|
+
): T.MergeGateReason | null {
|
|
282
|
+
if (row.kind === "merged") return null;
|
|
283
|
+
if (row.kind === "closed") return "closed-without-merge";
|
|
284
|
+
if (row.facts.isDraft && !allowDraft) return "draft-pr";
|
|
285
|
+
if (row.facts.reviewDecision === "CHANGES_REQUESTED")
|
|
286
|
+
return "changes-requested";
|
|
287
|
+
// These two wait for a person, and a PR needs one only once it is the next
|
|
288
|
+
// to merge. Every PR above the frontier becomes the frontier first.
|
|
289
|
+
if (!frontier) return null;
|
|
290
|
+
if (row.facts.reviewDecision === "REVIEW_REQUIRED") return "review-required";
|
|
291
|
+
// BLOCKED with clean CI is some other branch protection rule, such as signed
|
|
292
|
+
// commits or a required check that never reported. GitHub will not merge it.
|
|
293
|
+
return row.facts.mergeStateStatus === "BLOCKED" ? "merge-blocked" : null;
|
|
294
|
+
}
|
|
295
|
+
// Gates that pending checks or a settling review can still explain wait first.
|
|
296
|
+
const DEFERRED_WHILE_WAITING: ReadonlySet<T.MergeGateReason> = new Set([
|
|
297
|
+
"draft-pr",
|
|
298
|
+
"review-required",
|
|
299
|
+
"merge-blocked",
|
|
300
|
+
]);
|
|
301
|
+
function gateBlocker(
|
|
302
|
+
row: T.PrSnapshot,
|
|
303
|
+
allowDraft: boolean,
|
|
304
|
+
frontier: boolean
|
|
305
|
+
): T.MergeBlocker | null {
|
|
306
|
+
const reason = gateReason(row, allowDraft, frontier);
|
|
307
|
+
return reason === null ||
|
|
308
|
+
(DEFERRED_WHILE_WAITING.has(reason) &&
|
|
309
|
+
row.kind === "open" &&
|
|
310
|
+
(row.ci.kind === "ci-pending" || row.settle.kind === "settling"))
|
|
311
|
+
? null
|
|
312
|
+
: { kind: "merge-gate", pr: row.context, reason };
|
|
313
|
+
}
|
|
314
|
+
function readyContribution(
|
|
315
|
+
row: T.PrSnapshot,
|
|
316
|
+
allowDraft: boolean,
|
|
317
|
+
frontier: boolean
|
|
318
|
+
): T.ReadyPr | T.MergedPr | null {
|
|
319
|
+
if (row.kind === "merged")
|
|
320
|
+
return {
|
|
321
|
+
kind: "merged-pr",
|
|
322
|
+
context: row.context,
|
|
323
|
+
mergedAt: row.facts.mergedAt,
|
|
324
|
+
};
|
|
325
|
+
if (
|
|
326
|
+
row.kind !== "open" ||
|
|
327
|
+
(row.ci.kind !== "ci-clean" && row.ci.kind !== "ci-none") ||
|
|
328
|
+
row.threads.length !== 0 ||
|
|
329
|
+
conflictBlocker(row) !== null ||
|
|
330
|
+
gateReason(row, allowDraft, frontier) !== null
|
|
331
|
+
)
|
|
332
|
+
return null;
|
|
333
|
+
const reviewDecision = row.facts.reviewDecision;
|
|
334
|
+
if (reviewDecision === "CHANGES_REQUESTED") return null;
|
|
335
|
+
return {
|
|
336
|
+
kind: "ready-pr",
|
|
337
|
+
context: row.context,
|
|
338
|
+
proof: {
|
|
339
|
+
mergeability: "clear",
|
|
340
|
+
threads: [],
|
|
341
|
+
ci: row.ci,
|
|
342
|
+
gate: {
|
|
343
|
+
state: "OPEN",
|
|
344
|
+
reviewDecision,
|
|
345
|
+
draft: row.facts.isDraft ? "draft-allowed" : "not-draft",
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
export function classifyPr(
|
|
351
|
+
row: T.PrSnapshot,
|
|
352
|
+
allowDraft = false
|
|
353
|
+
): T.PrDecision {
|
|
354
|
+
for (const blocker of [
|
|
355
|
+
conflictBlocker(row),
|
|
356
|
+
threadBlocker(row),
|
|
357
|
+
ciBlocker(row),
|
|
358
|
+
gateBlocker(row, allowDraft, true),
|
|
359
|
+
])
|
|
360
|
+
if (blocker !== null) return { kind: "blocker", blocker };
|
|
361
|
+
if (row.kind === "open" && row.ci.kind === "ci-pending")
|
|
362
|
+
return { kind: "waiting", frontier: row.context, pending: row.ci.pending };
|
|
363
|
+
if (row.kind === "open" && row.settle.kind === "settling")
|
|
364
|
+
return { kind: "settling", frontier: row.context, settle: row.settle };
|
|
365
|
+
const ready = readyContribution(row, allowDraft, true);
|
|
366
|
+
if (ready === null) throw new Error("snapshot has no classified decision");
|
|
367
|
+
return ready.kind === "merged-pr"
|
|
368
|
+
? { kind: "merged", pr: ready }
|
|
369
|
+
: { kind: "ready", pr: ready };
|
|
370
|
+
}
|
|
371
|
+
export function selectTierMajorStackDecision(
|
|
372
|
+
rows: T.NonEmpty<T.PrSnapshot>,
|
|
373
|
+
allowDraft = false
|
|
374
|
+
): T.StackDecision {
|
|
375
|
+
for (const tier of [conflictBlocker, threadBlocker, ciBlocker])
|
|
376
|
+
for (const row of rows) {
|
|
377
|
+
const blocker = tier(row);
|
|
378
|
+
if (blocker !== null) return { kind: "blocker", blocker };
|
|
379
|
+
}
|
|
380
|
+
const frontier = rows.find((row) => row.kind !== "merged");
|
|
381
|
+
for (const row of rows) {
|
|
382
|
+
const blocker = gateBlocker(row, allowDraft, row === frontier);
|
|
383
|
+
if (blocker !== null) return { kind: "blocker", blocker };
|
|
384
|
+
}
|
|
385
|
+
for (const row of rows)
|
|
386
|
+
if (row.kind === "open" && row.ci.kind === "ci-pending")
|
|
387
|
+
return {
|
|
388
|
+
kind: "waiting",
|
|
389
|
+
frontier: row.context,
|
|
390
|
+
pending: row.ci.pending,
|
|
391
|
+
};
|
|
392
|
+
else if (row.kind === "open" && row.settle.kind === "settling")
|
|
393
|
+
return { kind: "settling", frontier: row.context, settle: row.settle };
|
|
394
|
+
const prs = nonEmpty(
|
|
395
|
+
rows
|
|
396
|
+
.map((row) => readyContribution(row, allowDraft, row === frontier))
|
|
397
|
+
.filter((row): row is T.ReadyPr | T.MergedPr => row !== null)
|
|
398
|
+
);
|
|
399
|
+
if (prs === null || prs.length !== rows.length)
|
|
400
|
+
throw new Error("stack has no classified decision");
|
|
401
|
+
return { kind: "clear", prs };
|
|
402
|
+
}
|
|
403
|
+
export const queryBackoffSeconds = (
|
|
404
|
+
interval: number,
|
|
405
|
+
failures: number
|
|
406
|
+
): number => Math.min(Math.max(interval, 60) * 2 ** (failures - 1), 300);
|
|
407
|
+
interface Envelope<M extends T.WatchMode> {
|
|
408
|
+
readonly schemaVersion: 1;
|
|
409
|
+
readonly sequence: number;
|
|
410
|
+
readonly observedAt: string;
|
|
411
|
+
readonly mode: M;
|
|
412
|
+
}
|
|
413
|
+
type Payload<V> = V extends unknown
|
|
414
|
+
? Omit<V, keyof Envelope<T.WatchMode>>
|
|
415
|
+
: never;
|
|
416
|
+
type VerdictPayload = Payload<T.WatcherVerdict>;
|
|
417
|
+
export interface VerdictStamp<M extends T.WatchMode = T.WatchMode> {
|
|
418
|
+
<const P extends VerdictPayload>(payload: P): Envelope<M> & P;
|
|
419
|
+
<const P extends VerdictPayload, M2 extends T.WatchMode>(
|
|
420
|
+
payload: P,
|
|
421
|
+
mode: M2
|
|
422
|
+
): Envelope<M2> & P;
|
|
423
|
+
}
|
|
424
|
+
export function verdictFactory<M extends T.WatchMode>(
|
|
425
|
+
clock: WatchClock,
|
|
426
|
+
mode: M
|
|
427
|
+
): VerdictStamp<M> {
|
|
428
|
+
let sequence = 0;
|
|
429
|
+
function stamp<const P extends VerdictPayload>(payload: P): Envelope<M> & P;
|
|
430
|
+
function stamp<const P extends VerdictPayload, M2 extends T.WatchMode>(
|
|
431
|
+
payload: P,
|
|
432
|
+
mode: M2
|
|
433
|
+
): Envelope<M2> & P;
|
|
434
|
+
function stamp<const P extends VerdictPayload>(
|
|
435
|
+
payload: P,
|
|
436
|
+
override?: T.WatchMode
|
|
437
|
+
): Envelope<T.WatchMode> & P {
|
|
438
|
+
return {
|
|
439
|
+
schemaVersion: 1,
|
|
440
|
+
sequence: (sequence += 1),
|
|
441
|
+
observedAt: clock.observedAt(),
|
|
442
|
+
mode: override ?? mode,
|
|
443
|
+
...payload,
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
return stamp;
|
|
447
|
+
}
|
|
448
|
+
function blockerVerdict(
|
|
449
|
+
stamp: VerdictStamp,
|
|
450
|
+
blocker: T.MergeBlocker
|
|
451
|
+
): T.BlockerVerdict {
|
|
452
|
+
switch (blocker.kind) {
|
|
453
|
+
case "merge-conflicts":
|
|
454
|
+
return stamp({ kind: "BLOCKER", terminal: true, exitCode: 2, blocker });
|
|
455
|
+
case "review-threads":
|
|
456
|
+
return stamp({ kind: "BLOCKER", terminal: true, exitCode: 3, blocker });
|
|
457
|
+
case "failing-checks":
|
|
458
|
+
return stamp({ kind: "BLOCKER", terminal: true, exitCode: 4, blocker });
|
|
459
|
+
case "merge-gate":
|
|
460
|
+
return stamp({ kind: "BLOCKER", terminal: true, exitCode: 6, blocker });
|
|
461
|
+
default: {
|
|
462
|
+
const exhaustive: never = blocker;
|
|
463
|
+
return exhaustive;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
export function statusQueryVerdict(
|
|
468
|
+
stamp: VerdictStamp,
|
|
469
|
+
failures: number,
|
|
470
|
+
failure: T.QueryFailure
|
|
471
|
+
): T.BlockerVerdict {
|
|
472
|
+
return stamp({
|
|
473
|
+
kind: "BLOCKER",
|
|
474
|
+
terminal: true,
|
|
475
|
+
exitCode: 7,
|
|
476
|
+
blocker: { kind: "status-query", failures, failure },
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
export interface WatchClock {
|
|
480
|
+
now(): number;
|
|
481
|
+
observedAt(): string;
|
|
482
|
+
sleep(seconds: number): Promise<void>;
|
|
483
|
+
}
|
|
484
|
+
export interface RunDependencies {
|
|
485
|
+
readonly reader: T.GitHubReader;
|
|
486
|
+
readonly clock: WatchClock;
|
|
487
|
+
readonly emit: (verdict: T.ProgressVerdict) => void;
|
|
488
|
+
}
|
|
489
|
+
const deadlinePassed = (
|
|
490
|
+
started: number,
|
|
491
|
+
options: T.PollingOptions,
|
|
492
|
+
now: number
|
|
493
|
+
): boolean => options.timeout > 0 && now - started >= options.timeout;
|
|
494
|
+
type StepResult<V> =
|
|
495
|
+
| { readonly kind: "terminal"; readonly verdict: V }
|
|
496
|
+
| {
|
|
497
|
+
readonly kind: "sleep";
|
|
498
|
+
readonly seconds: number;
|
|
499
|
+
readonly onDeadline?: () => V;
|
|
500
|
+
}
|
|
501
|
+
| { readonly kind: "continue" };
|
|
502
|
+
async function pollUntilTerminal<V>(args: {
|
|
503
|
+
readonly dependencies: RunDependencies;
|
|
504
|
+
readonly options: T.PollingOptions;
|
|
505
|
+
readonly stamp: VerdictStamp;
|
|
506
|
+
readonly step: () => Promise<StepResult<V>>;
|
|
507
|
+
}): Promise<V | T.BlockerVerdict | T.TimeoutVerdict> {
|
|
508
|
+
let failures = 0;
|
|
509
|
+
const started = args.dependencies.clock.now();
|
|
510
|
+
const sleep = async (seconds: number): Promise<void> => {
|
|
511
|
+
const remaining = args.options.timeout > 0
|
|
512
|
+
? Math.max(0, args.options.timeout - (args.dependencies.clock.now() - started))
|
|
513
|
+
: seconds;
|
|
514
|
+
await args.dependencies.clock.sleep(Math.min(seconds, remaining));
|
|
515
|
+
};
|
|
516
|
+
while (true) {
|
|
517
|
+
let result: StepResult<V>;
|
|
518
|
+
try {
|
|
519
|
+
result = await args.step();
|
|
520
|
+
failures = 0;
|
|
521
|
+
} catch (error) {
|
|
522
|
+
if (error instanceof BlockUnconfirmed) {
|
|
523
|
+
failures = 0;
|
|
524
|
+
const reason = { kind: "confirming-block" } as const;
|
|
525
|
+
args.dependencies.emit(
|
|
526
|
+
args.stamp({
|
|
527
|
+
kind: "WAITING",
|
|
528
|
+
terminal: false,
|
|
529
|
+
frontier: error.pr,
|
|
530
|
+
reason,
|
|
531
|
+
})
|
|
532
|
+
);
|
|
533
|
+
if (
|
|
534
|
+
deadlinePassed(started, args.options, args.dependencies.clock.now())
|
|
535
|
+
)
|
|
536
|
+
return args.stamp({
|
|
537
|
+
kind: "TIMEOUT",
|
|
538
|
+
terminal: true,
|
|
539
|
+
exitCode: 5,
|
|
540
|
+
reason,
|
|
541
|
+
});
|
|
542
|
+
await sleep(args.options.interval);
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
if (!(error instanceof WatcherQueryError)) throw error;
|
|
546
|
+
failures += 1;
|
|
547
|
+
if (!error.failure.retryable || failures >= args.options.maxQueryErrors)
|
|
548
|
+
return statusQueryVerdict(args.stamp, failures, error.failure);
|
|
549
|
+
const retryInSeconds = queryBackoffSeconds(
|
|
550
|
+
args.options.interval,
|
|
551
|
+
failures
|
|
552
|
+
);
|
|
553
|
+
args.dependencies.emit(
|
|
554
|
+
args.stamp({
|
|
555
|
+
kind: "RETRY",
|
|
556
|
+
terminal: false,
|
|
557
|
+
failure: error.failure,
|
|
558
|
+
consecutiveFailures: failures,
|
|
559
|
+
retryInSeconds,
|
|
560
|
+
})
|
|
561
|
+
);
|
|
562
|
+
if (deadlinePassed(started, args.options, args.dependencies.clock.now()))
|
|
563
|
+
return args.stamp({
|
|
564
|
+
kind: "TIMEOUT",
|
|
565
|
+
terminal: true,
|
|
566
|
+
exitCode: 5,
|
|
567
|
+
reason: { kind: "status-unavailable", failure: error.failure },
|
|
568
|
+
});
|
|
569
|
+
await sleep(retryInSeconds);
|
|
570
|
+
continue;
|
|
571
|
+
}
|
|
572
|
+
if (result.kind === "terminal") return result.verdict;
|
|
573
|
+
if (result.kind === "sleep") {
|
|
574
|
+
if (
|
|
575
|
+
result.onDeadline !== undefined &&
|
|
576
|
+
deadlinePassed(started, args.options, args.dependencies.clock.now())
|
|
577
|
+
)
|
|
578
|
+
return result.onDeadline();
|
|
579
|
+
await sleep(result.seconds);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
export async function runSimple(args: {
|
|
584
|
+
readonly dependencies: RunDependencies;
|
|
585
|
+
readonly contexts: T.NonEmpty<T.PrContext>;
|
|
586
|
+
readonly mode: T.WatchMode;
|
|
587
|
+
readonly statusOnly: boolean;
|
|
588
|
+
readonly options: T.PollingOptions;
|
|
589
|
+
}): Promise<T.TerminalVerdict> {
|
|
590
|
+
const stamp = verdictFactory(args.dependencies.clock, args.mode);
|
|
591
|
+
const settler = reviewSettler(args);
|
|
592
|
+
const blocks = args.statusOnly
|
|
593
|
+
? undefined
|
|
594
|
+
: blockClock(args.dependencies.clock);
|
|
595
|
+
const step = async (): Promise<StepResult<T.TerminalVerdict>> => {
|
|
596
|
+
const rows: T.PrSnapshot[] = [];
|
|
597
|
+
for (const context of args.contexts)
|
|
598
|
+
rows.push(
|
|
599
|
+
await readSnapshot({
|
|
600
|
+
reader: args.dependencies.reader,
|
|
601
|
+
context,
|
|
602
|
+
pendingHistory: "include",
|
|
603
|
+
allowDraft: args.options.allowDraft,
|
|
604
|
+
settler,
|
|
605
|
+
blockClock: blocks,
|
|
606
|
+
})
|
|
607
|
+
);
|
|
608
|
+
const complete = nonEmpty(rows);
|
|
609
|
+
if (complete === null) throw new Error("watch context cannot be empty");
|
|
610
|
+
if (args.statusOnly)
|
|
611
|
+
return {
|
|
612
|
+
kind: "terminal",
|
|
613
|
+
verdict: stamp({
|
|
614
|
+
kind: "STATUS",
|
|
615
|
+
terminal: true,
|
|
616
|
+
exitCode: 0,
|
|
617
|
+
reason: "status-only",
|
|
618
|
+
rows: complete,
|
|
619
|
+
}),
|
|
620
|
+
};
|
|
621
|
+
if (args.mode === "queued-stack")
|
|
622
|
+
throw new Error("queued-stack requires status-only in the simple runner");
|
|
623
|
+
if (args.mode === "stack")
|
|
624
|
+
args.dependencies.emit(
|
|
625
|
+
stamp(
|
|
626
|
+
{ kind: "STATUS", terminal: false, reason: "poll", rows: complete },
|
|
627
|
+
args.mode
|
|
628
|
+
)
|
|
629
|
+
);
|
|
630
|
+
const decision =
|
|
631
|
+
args.mode === "single"
|
|
632
|
+
? classifyPr(complete[0], args.options.allowDraft)
|
|
633
|
+
: selectTierMajorStackDecision(complete, args.options.allowDraft);
|
|
634
|
+
if (decision.kind === "blocker") {
|
|
635
|
+
confirmGate(
|
|
636
|
+
decision.blocker,
|
|
637
|
+
complete.find(
|
|
638
|
+
(row) => row.context.number === decision.blocker.pr.number
|
|
639
|
+
),
|
|
640
|
+
blocks
|
|
641
|
+
);
|
|
642
|
+
return {
|
|
643
|
+
kind: "terminal",
|
|
644
|
+
verdict: blockerVerdict(stamp, decision.blocker),
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
if (decision.kind === "ready" || decision.kind === "merged")
|
|
648
|
+
return {
|
|
649
|
+
kind: "terminal",
|
|
650
|
+
verdict: stamp(
|
|
651
|
+
{
|
|
652
|
+
kind: "READY",
|
|
653
|
+
terminal: true,
|
|
654
|
+
exitCode: 0,
|
|
655
|
+
scope: { kind: "single", pr: decision.pr },
|
|
656
|
+
},
|
|
657
|
+
args.mode
|
|
658
|
+
),
|
|
659
|
+
};
|
|
660
|
+
if (decision.kind === "clear")
|
|
661
|
+
return {
|
|
662
|
+
kind: "terminal",
|
|
663
|
+
verdict: stamp(
|
|
664
|
+
{
|
|
665
|
+
kind: "READY",
|
|
666
|
+
terminal: true,
|
|
667
|
+
exitCode: 0,
|
|
668
|
+
scope: { kind: "stack", prs: decision.prs },
|
|
669
|
+
},
|
|
670
|
+
args.mode
|
|
671
|
+
),
|
|
672
|
+
};
|
|
673
|
+
args.dependencies.emit(
|
|
674
|
+
stamp({
|
|
675
|
+
kind: "WAITING",
|
|
676
|
+
terminal: false,
|
|
677
|
+
frontier: decision.frontier,
|
|
678
|
+
reason: waitReason(decision),
|
|
679
|
+
})
|
|
680
|
+
);
|
|
681
|
+
return {
|
|
682
|
+
kind: "sleep",
|
|
683
|
+
seconds: args.options.interval,
|
|
684
|
+
onDeadline: () =>
|
|
685
|
+
stamp({
|
|
686
|
+
kind: "TIMEOUT",
|
|
687
|
+
terminal: true,
|
|
688
|
+
exitCode: 5,
|
|
689
|
+
reason: waitReason(decision),
|
|
690
|
+
}),
|
|
691
|
+
};
|
|
692
|
+
};
|
|
693
|
+
return pollUntilTerminal({
|
|
694
|
+
dependencies: args.dependencies,
|
|
695
|
+
options: args.options,
|
|
696
|
+
stamp,
|
|
697
|
+
step,
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
export type QueueWork =
|
|
701
|
+
| {
|
|
702
|
+
readonly kind: "whole-stack-sweep";
|
|
703
|
+
readonly remaining: T.NonEmpty<T.PrContext>;
|
|
704
|
+
}
|
|
705
|
+
| { readonly kind: "frontier-poll"; readonly frontier: T.PrContext };
|
|
706
|
+
export interface QueueState {
|
|
707
|
+
readonly queue: T.NonEmpty<T.PrContext>;
|
|
708
|
+
readonly snapshots: ReadonlyMap<T.PrNumber, T.PrSnapshot>;
|
|
709
|
+
readonly work: QueueWork | null;
|
|
710
|
+
readonly nextSweepAt: number;
|
|
711
|
+
readonly frontier: T.PrContext | null;
|
|
712
|
+
readonly lastWaitKey: string | null;
|
|
713
|
+
readonly startedAt: number;
|
|
714
|
+
}
|
|
715
|
+
export const createQueueState = (
|
|
716
|
+
queue: T.NonEmpty<T.PrContext>,
|
|
717
|
+
now: number
|
|
718
|
+
): QueueState => ({
|
|
719
|
+
queue,
|
|
720
|
+
snapshots: new Map(),
|
|
721
|
+
work: { kind: "whole-stack-sweep", remaining: queue },
|
|
722
|
+
nextSweepAt: now,
|
|
723
|
+
frontier: null,
|
|
724
|
+
lastWaitKey: null,
|
|
725
|
+
startedAt: now,
|
|
726
|
+
});
|
|
727
|
+
const orderedRows = (state: QueueState): T.PrSnapshot[] =>
|
|
728
|
+
state.queue.flatMap((context) => {
|
|
729
|
+
const row = state.snapshots.get(context.number);
|
|
730
|
+
return row === undefined ? [] : [row];
|
|
731
|
+
});
|
|
732
|
+
const activeRows = (state: QueueState): T.PrSnapshot[] =>
|
|
733
|
+
orderedRows(state).filter((row) => row.kind !== "merged");
|
|
734
|
+
export function planQueue(state: QueueState, now: number): QueueState {
|
|
735
|
+
if (state.work !== null) return state;
|
|
736
|
+
if (state.snapshots.size === 0 || now >= state.nextSweepAt) {
|
|
737
|
+
const remaining = nonEmpty(
|
|
738
|
+
state.queue.filter(
|
|
739
|
+
(context) => state.snapshots.get(context.number)?.kind !== "merged"
|
|
740
|
+
)
|
|
741
|
+
);
|
|
742
|
+
if (remaining !== null)
|
|
743
|
+
return { ...state, work: { kind: "whole-stack-sweep", remaining } };
|
|
744
|
+
}
|
|
745
|
+
const frontier = activeRows(state)[0]?.context;
|
|
746
|
+
return frontier === undefined
|
|
747
|
+
? state
|
|
748
|
+
: { ...state, work: { kind: "frontier-poll", frontier } };
|
|
749
|
+
}
|
|
750
|
+
export interface QueueSnapshotResult {
|
|
751
|
+
readonly state: QueueState;
|
|
752
|
+
readonly completedSweepRows: T.NonEmpty<T.PrSnapshot> | null;
|
|
753
|
+
}
|
|
754
|
+
export function applyQueueSnapshot(
|
|
755
|
+
state: QueueState,
|
|
756
|
+
snapshot: T.PrSnapshot,
|
|
757
|
+
now: number,
|
|
758
|
+
options: T.PollingOptions
|
|
759
|
+
): QueueSnapshotResult {
|
|
760
|
+
if (state.work === null) throw new Error("queue has no read in flight");
|
|
761
|
+
const snapshots = new Map(state.snapshots);
|
|
762
|
+
snapshots.set(snapshot.context.number, snapshot);
|
|
763
|
+
const base = { ...state, snapshots };
|
|
764
|
+
if (state.work.kind === "frontier-poll")
|
|
765
|
+
return { state: { ...base, work: null }, completedSweepRows: null };
|
|
766
|
+
const [head, ...tail] = state.work.remaining;
|
|
767
|
+
if (head.number !== snapshot.context.number)
|
|
768
|
+
throw new Error("snapshot does not match sweep head");
|
|
769
|
+
const remaining = nonEmpty(tail);
|
|
770
|
+
if (remaining !== null)
|
|
771
|
+
return {
|
|
772
|
+
state: { ...base, work: { kind: "whole-stack-sweep", remaining } },
|
|
773
|
+
completedSweepRows: null,
|
|
774
|
+
};
|
|
775
|
+
const rows = nonEmpty(
|
|
776
|
+
state.queue.flatMap((context) => {
|
|
777
|
+
const row = snapshots.get(context.number);
|
|
778
|
+
return row === undefined ? [] : [row];
|
|
779
|
+
})
|
|
780
|
+
);
|
|
781
|
+
if (rows === null || rows.length !== state.queue.length)
|
|
782
|
+
throw new Error("sweep completed without every snapshot");
|
|
783
|
+
return {
|
|
784
|
+
state: { ...base, work: null, nextSweepAt: now + options.sweepInterval },
|
|
785
|
+
completedSweepRows: rows,
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
export type QueueEvaluation =
|
|
789
|
+
| {
|
|
790
|
+
readonly kind: "complete";
|
|
791
|
+
readonly state: QueueState;
|
|
792
|
+
readonly merged: T.NonEmpty<T.MergedPr>;
|
|
793
|
+
}
|
|
794
|
+
| {
|
|
795
|
+
readonly kind: "blocker";
|
|
796
|
+
readonly state: QueueState;
|
|
797
|
+
readonly blocker: T.MergeBlocker;
|
|
798
|
+
}
|
|
799
|
+
| {
|
|
800
|
+
readonly kind: "advance";
|
|
801
|
+
readonly state: QueueState;
|
|
802
|
+
readonly merged: T.PrContext;
|
|
803
|
+
readonly frontier: T.PrContext;
|
|
804
|
+
readonly remaining: number;
|
|
805
|
+
}
|
|
806
|
+
| {
|
|
807
|
+
readonly kind: "timeout";
|
|
808
|
+
readonly state: QueueState;
|
|
809
|
+
readonly frontier: T.PrContext;
|
|
810
|
+
readonly unmergedCount: number;
|
|
811
|
+
}
|
|
812
|
+
| {
|
|
813
|
+
readonly kind: "waiting";
|
|
814
|
+
readonly state: QueueState;
|
|
815
|
+
readonly frontier: T.PrContext;
|
|
816
|
+
readonly reason:
|
|
817
|
+
| {
|
|
818
|
+
readonly kind: "pending-checks";
|
|
819
|
+
readonly pending: T.NonEmpty<T.PendingCheck>;
|
|
820
|
+
}
|
|
821
|
+
| { readonly kind: "merge-queue"; readonly unmergedCount: number };
|
|
822
|
+
readonly emit: boolean;
|
|
823
|
+
};
|
|
824
|
+
export function evaluateQueue(
|
|
825
|
+
state: QueueState,
|
|
826
|
+
now: number,
|
|
827
|
+
options: T.PollingOptions
|
|
828
|
+
): QueueEvaluation {
|
|
829
|
+
const active = activeRows(state);
|
|
830
|
+
if (active.length === 0) {
|
|
831
|
+
const merged = nonEmpty(
|
|
832
|
+
orderedRows(state).flatMap((row) =>
|
|
833
|
+
row.kind === "merged"
|
|
834
|
+
? [
|
|
835
|
+
{
|
|
836
|
+
kind: "merged-pr" as const,
|
|
837
|
+
context: row.context,
|
|
838
|
+
mergedAt: row.facts.mergedAt,
|
|
839
|
+
},
|
|
840
|
+
]
|
|
841
|
+
: []
|
|
842
|
+
)
|
|
843
|
+
);
|
|
844
|
+
if (merged === null) throw new Error("empty queue cannot complete");
|
|
845
|
+
return { kind: "complete", state, merged };
|
|
846
|
+
}
|
|
847
|
+
const rows = nonEmpty(active);
|
|
848
|
+
if (rows === null) throw new Error("active queue cannot be empty");
|
|
849
|
+
const decision = selectTierMajorStackDecision(rows, options.allowDraft);
|
|
850
|
+
if (decision.kind === "blocker")
|
|
851
|
+
return { kind: "blocker", state, blocker: decision.blocker };
|
|
852
|
+
const frontier = rows[0].context;
|
|
853
|
+
if (state.frontier !== null && state.frontier.number !== frontier.number)
|
|
854
|
+
return {
|
|
855
|
+
kind: "advance",
|
|
856
|
+
state: { ...state, frontier, lastWaitKey: null },
|
|
857
|
+
merged: state.frontier,
|
|
858
|
+
frontier,
|
|
859
|
+
remaining: active.length,
|
|
860
|
+
};
|
|
861
|
+
if (deadlinePassed(state.startedAt, options, now))
|
|
862
|
+
return {
|
|
863
|
+
kind: "timeout",
|
|
864
|
+
state: { ...state, frontier },
|
|
865
|
+
frontier,
|
|
866
|
+
unmergedCount: active.length,
|
|
867
|
+
};
|
|
868
|
+
const row = rows[0];
|
|
869
|
+
const pending =
|
|
870
|
+
row.kind === "open" && row.ci.kind === "ci-pending" ? row.ci.pending : null;
|
|
871
|
+
const reason =
|
|
872
|
+
pending === null
|
|
873
|
+
? ({ kind: "merge-queue", unmergedCount: active.length } as const)
|
|
874
|
+
: ({ kind: "pending-checks", pending } as const);
|
|
875
|
+
const key =
|
|
876
|
+
reason.kind === "pending-checks"
|
|
877
|
+
? `pending:${frontier.number}:${reason.pending.length}`
|
|
878
|
+
: `queue:${frontier.number}:${reason.unmergedCount}`;
|
|
879
|
+
return {
|
|
880
|
+
kind: "waiting",
|
|
881
|
+
state: { ...state, frontier, lastWaitKey: key },
|
|
882
|
+
frontier,
|
|
883
|
+
reason,
|
|
884
|
+
emit: state.lastWaitKey !== key,
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
export async function runQueued(args: {
|
|
888
|
+
readonly dependencies: RunDependencies;
|
|
889
|
+
readonly contexts: T.NonEmpty<T.PrContext>;
|
|
890
|
+
readonly options: T.PollingOptions;
|
|
891
|
+
}): Promise<T.QueueTerminalVerdict> {
|
|
892
|
+
let state = createQueueState(args.contexts, args.dependencies.clock.now());
|
|
893
|
+
const stamp = verdictFactory(args.dependencies.clock, "queued-stack");
|
|
894
|
+
const blocks = blockClock(args.dependencies.clock);
|
|
895
|
+
args.dependencies.emit(
|
|
896
|
+
stamp({ kind: "QUEUE", terminal: false, queue: args.contexts })
|
|
897
|
+
);
|
|
898
|
+
const step = async (): Promise<StepResult<T.QueueTerminalVerdict>> => {
|
|
899
|
+
state = planQueue(state, args.dependencies.clock.now());
|
|
900
|
+
if (state.work === null) {
|
|
901
|
+
const complete = evaluateQueue(
|
|
902
|
+
state,
|
|
903
|
+
args.dependencies.clock.now(),
|
|
904
|
+
args.options
|
|
905
|
+
);
|
|
906
|
+
if (complete.kind !== "complete")
|
|
907
|
+
throw new Error("queue has no work while active");
|
|
908
|
+
return {
|
|
909
|
+
kind: "terminal",
|
|
910
|
+
verdict: stamp({
|
|
911
|
+
kind: "COMPLETE",
|
|
912
|
+
terminal: true,
|
|
913
|
+
exitCode: 0,
|
|
914
|
+
queue: state.queue,
|
|
915
|
+
merged: complete.merged,
|
|
916
|
+
}),
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
const context =
|
|
920
|
+
state.work.kind === "whole-stack-sweep"
|
|
921
|
+
? state.work.remaining[0]
|
|
922
|
+
: state.work.frontier;
|
|
923
|
+
const snapshot = await readSnapshot({
|
|
924
|
+
reader: args.dependencies.reader,
|
|
925
|
+
context,
|
|
926
|
+
pendingHistory: "omit",
|
|
927
|
+
allowDraft: args.options.allowDraft,
|
|
928
|
+
blockClock: blocks,
|
|
929
|
+
});
|
|
930
|
+
const applied = applyQueueSnapshot(
|
|
931
|
+
state,
|
|
932
|
+
snapshot,
|
|
933
|
+
args.dependencies.clock.now(),
|
|
934
|
+
args.options
|
|
935
|
+
);
|
|
936
|
+
state = applied.state;
|
|
937
|
+
if (applied.completedSweepRows !== null)
|
|
938
|
+
args.dependencies.emit(
|
|
939
|
+
stamp({
|
|
940
|
+
kind: "STATUS",
|
|
941
|
+
terminal: false,
|
|
942
|
+
reason: "whole-stack-sweep",
|
|
943
|
+
rows: applied.completedSweepRows,
|
|
944
|
+
})
|
|
945
|
+
);
|
|
946
|
+
if (state.work !== null) return { kind: "continue" };
|
|
947
|
+
const evaluation = evaluateQueue(
|
|
948
|
+
state,
|
|
949
|
+
args.dependencies.clock.now(),
|
|
950
|
+
args.options
|
|
951
|
+
);
|
|
952
|
+
state = evaluation.state;
|
|
953
|
+
switch (evaluation.kind) {
|
|
954
|
+
case "complete":
|
|
955
|
+
return {
|
|
956
|
+
kind: "terminal",
|
|
957
|
+
verdict: stamp({
|
|
958
|
+
kind: "COMPLETE",
|
|
959
|
+
terminal: true,
|
|
960
|
+
exitCode: 0,
|
|
961
|
+
queue: state.queue,
|
|
962
|
+
merged: evaluation.merged,
|
|
963
|
+
}),
|
|
964
|
+
};
|
|
965
|
+
case "blocker":
|
|
966
|
+
confirmGate(
|
|
967
|
+
evaluation.blocker,
|
|
968
|
+
state.snapshots.get(evaluation.blocker.pr.number),
|
|
969
|
+
blocks
|
|
970
|
+
);
|
|
971
|
+
return {
|
|
972
|
+
kind: "terminal",
|
|
973
|
+
verdict: blockerVerdict(stamp, evaluation.blocker),
|
|
974
|
+
};
|
|
975
|
+
case "advance":
|
|
976
|
+
args.dependencies.emit(
|
|
977
|
+
stamp({
|
|
978
|
+
kind: "ADVANCE",
|
|
979
|
+
terminal: false,
|
|
980
|
+
merged: evaluation.merged,
|
|
981
|
+
frontier: evaluation.frontier,
|
|
982
|
+
remaining: evaluation.remaining,
|
|
983
|
+
})
|
|
984
|
+
);
|
|
985
|
+
return { kind: "continue" };
|
|
986
|
+
case "timeout":
|
|
987
|
+
return {
|
|
988
|
+
kind: "terminal",
|
|
989
|
+
verdict: stamp({
|
|
990
|
+
kind: "TIMEOUT",
|
|
991
|
+
terminal: true,
|
|
992
|
+
exitCode: 5,
|
|
993
|
+
reason: {
|
|
994
|
+
kind: "queued-stack",
|
|
995
|
+
frontier: evaluation.frontier,
|
|
996
|
+
unmergedCount: evaluation.unmergedCount,
|
|
997
|
+
},
|
|
998
|
+
}),
|
|
999
|
+
};
|
|
1000
|
+
case "waiting":
|
|
1001
|
+
if (evaluation.emit)
|
|
1002
|
+
args.dependencies.emit(
|
|
1003
|
+
stamp({
|
|
1004
|
+
kind: "WAITING",
|
|
1005
|
+
terminal: false,
|
|
1006
|
+
frontier: evaluation.frontier,
|
|
1007
|
+
reason: evaluation.reason,
|
|
1008
|
+
})
|
|
1009
|
+
);
|
|
1010
|
+
return { kind: "sleep", seconds: args.options.interval };
|
|
1011
|
+
default: {
|
|
1012
|
+
const exhaustive: never = evaluation;
|
|
1013
|
+
return exhaustive;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
return pollUntilTerminal({
|
|
1018
|
+
dependencies: args.dependencies,
|
|
1019
|
+
options: args.options,
|
|
1020
|
+
stamp,
|
|
1021
|
+
step,
|
|
1022
|
+
});
|
|
1023
|
+
}
|