Skip to content

refactor(pstack): delete statechart comments that repeat the code, and rename helpers - #779

Merged
poteto merged 1 commit into
mainfrom
lauren/statechart-comment-pass-port-bf8f
Oct 22, 2026
Merged

poteto merged 1 commit into
mainfrom
lauren/statechart-comment-pass-port-bf8f

Conversation

@poteto

@poteto poteto commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Why

Many comments in the statechart scripts say what a name or the next line already says. This change deletes them. Where a comment held a fact that the code did not show, a name or a shared constant now holds that fact. Behavior does not change.

What changed

  • 14 comments change: 11 are deleted whole, and 3 lose a sentence. They are in lib.mjs (7), statechart.mjs (5), and tlc-to-chart.mjs (2).
  • Names that carry the deleted comments' point:
    • splitComments is splitCommentsKeepingOffsets.
    • checkTlcOutput is tlcOutputWarning. Its callers and tests change with it.
    • quote is escapeMermaidQuotes.
    • luminance is wcagRelativeLuminance.
    • The local declared in parseMermaid is declaredInRegion.
    • cited(from, to, above) takes { above }. It has one call site.
  • PRIMES_OR_UNCHANGED in lib.mjs replaces two copies of one regex: one in uncitedConditions, one in the label map scaffold. It has no g flag, so .test() keeps no state.
  • The scaffold keeps one note: it lists a definition that only another action calls, though TLC names no step after it. On TLC 1.7.4, a spec where Go calls Bump labels steps Go and never Bump, while the scaffold lists Bump.
  • harness/pstack/claude-code/skills/statechart/ is the generated copy.

Differences from the source copy

A recursive diff of this copy against the source skill at the commit that landed this pass shows only the differences that #741 and #776 already have:

  • lib.mjs: findTlc finds TLC only through TLA2TOOLS and JAVA. The source also installs a repo-pinned TLC on demand. The source pass deleted two comments inside that install code, which this copy does not have.
  • statechart.mjs: the TLC help says where to download tla2tools.jar.
  • test/statechart.test.mjs: the "no TLC" message and environment, the node helper, and no tests for the repo-pinned install.
  • SKILL.md: one sentence does not name the source repo's spec folder.

No hunk of this pass differs. The other eight files are byte-identical.

Blast radius

Only pstack/skills/statechart/scripts/ and its generated copy change. The renamed functions have no callers outside the skill. The pstack version stays at 0.15.30. A separate PR bumps it.

Verification

  • With TLC 1.7.4, all 67 skill tests pass and none skip. Without TLC, as in CI, 29 pass and 38 skip.
  • An earlier full run with TLC 1.7.4, with other checks running beside it, failed one timing test: "a run whose spec changes while it reads it". The test rewrites the spec 500 ms after TLC starts, so a slow first read sees the new spec. Alone, the test passes 5 of 5 times on this branch and 5 of 5 on main. The full suite then passed 67 of 67 with nothing beside it.
  • validate-plugins.mjs, check-pstack-docs.mjs, and generate-pstack-harness-trees.mjs --check pass.
  • A scan for internal paths, names, and model ids finds 0 hits in the patch and in the whole skill folder.
Open in Web Open in Cursor 

…d rename helpers

Deletes comments in the statechart scripts that say what a name or the code
already says. Where a comment held a fact, a name or a shared constant holds
it now:

- splitComments is splitCommentsKeepingOffsets.
- checkTlcOutput is tlcOutputWarning.
- quote is escapeMermaidQuotes.
- luminance is wcagRelativeLuminance.
- declared in parseMermaid is declaredInRegion.
- cited(from, to, above) takes { above }.
- PRIMES_OR_UNCHANGED replaces two copies of one regex, in uncitedConditions
  and in the label map scaffold.

The scaffold keeps the note that it lists a definition that only another
action calls, though TLC names no step after it. Behavior does not change.

Co-authored-by: lauren <poteto@users.noreply.github.com>
@poteto
poteto merged commit 4ec7ffa into main Oct 22, 2026
2 checks passed
@poteto
poteto deleted the lauren/statechart-comment-pass-port-bf8f branch October 22, 2026 18:27
caelaxie added a commit to pstack-ports/devin-pstack that referenced this pull request Oct 23, 2026
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
synced to
[`4ec7ffa`](cursor/plugins@4ec7ffa).
compared `88d4751..4ec7ffa` for `pstack/`. later commits on upstream
`main` through
[`9b93e81`](cursor/plugins@9b93e81)
do not touch `pstack/`. version is `0.15.30` in `plugin.json`,
`.devin-plugin/plugin.json`, and the readme marker.

ported:
-
[`eb4db2b`](cursor/plugins@eb4db2b)
([#741](cursor/plugins#741)) add the statechart
skill. guide page 6, poteto-help, and the readme skill table match.
slash commands keep the `/pstack:` prefix. `disable-model-invocation:
true` stays `triggers: [user]`.
-
[`7698375`](cursor/plugins@7698375)
([#776](cursor/plugins#776)) six fixes to the
statechart skill. scripts copied verbatim.
-
[`4ec7ffa`](cursor/plugins@4ec7ffa)
([#779](cursor/plugins#779)) delete statechart
comments that repeat the code, and rename helpers. the version bumps to
`0.15.30`. the same bump is in `.devin-plugin/plugin.json` and the
readme marker, which is where this repo records the version.

skipped:
- `harness/pstack/claude-code/` copies in
[#741](cursor/plugins#741),
[#776](cursor/plugins#776), and
[#779](cursor/plugins#779). this port does not
carry the generated claude code tree.
- [#741](cursor/plugins#741)
`pstack/.cursor-plugin/plugin.json`. cursor packaging. the version bump
lands in `.devin-plugin/plugin.json` instead.
- [#741](cursor/plugins#741)
`.github/workflows/validate-plugins.yml` test step. that workflow
belongs to the cursor/plugins monorepo and also checks generated harness
trees. this repo's ci is separate, so the step was not copied. `node
--test skills/statechart/scripts/test/*.test.mjs` passed locally (67
tests, with tlc).

harness proof (install, `devin plugins list`, exercising
`/pstack:statechart` and `/pstack:poteto-mode`) will follow as a
comment. the devin cli can't log in from this cloud environment.

<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-00f3aebc-53ad-54ad-9327-63073f2102cb?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-00f3aebc-53ad-54ad-9327-63073f2102cb&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Kaitian Xie <caelaxie@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants