Skip to content

Commit 2819114

Browse files
authored
Merge pull request #10 from Zoo-Code-Org/fix-intelliJ-compatibility
Fix intelli j compatibility
2 parents c1b3bc8 + b62429e commit 2819114

28 files changed

Lines changed: 1662 additions & 269 deletions

‎.github/workflows/pr.yml‎

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ jobs:
9696
run: >
9797
./gradlew test
9898
--tests "org.zoocode.jetbrains.terminal.RawOutputTtyConnectorTest"
99+
--tests "org.zoocode.jetbrains.util.JcefSupportTest"
100+
--tests "org.zoocode.jetbrains.descriptor.PluginDescriptorTest"
101+
--tests "org.zoocode.jetbrains.terminal.TerminalPtyBuilderTest"
102+
--tests "org.zoocode.jetbrains.terminal.ShellIntegrationOutputStateTest"
103+
--tests "org.zoocode.jetbrains.terminal.TerminalShellReadinessTest"
99104
--no-configuration-cache
100105
101106
- name: Build the plugin
@@ -123,3 +128,116 @@ jobs:
123128
./gradlew smoke263Dispatch
124129
-PsmokeLocalIde="build/ideaIC-${IDEA_263_BUILD}"
125130
--no-configuration-cache
131+
132+
windows-verify:
133+
name: Windows terminal tests and PowerShell 5.1 smoke
134+
runs-on: windows-latest
135+
timeout-minutes: 60
136+
137+
steps:
138+
- name: Check out the JetBrains plugin
139+
uses: actions/checkout@v5
140+
with:
141+
persist-credentials: false
142+
143+
# git rev-parse reports the exact checkout that ran. A pull_request event
144+
# can test a merge commit, so the recorded value, not the branch head, is
145+
# the validated one.
146+
- name: Record the run identity
147+
shell: powershell
148+
run: |
149+
$identity = @"
150+
Validation: GitHub Actions Windows runner
151+
Checkout: $env:GITHUB_WORKSPACE
152+
Tested commit: $(git rev-parse HEAD)
153+
OS: windows-latest
154+
JDK: temurin 17
155+
Run: $env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID
156+
"@
157+
Write-Output $identity
158+
Set-Content -Path windows-run-identity.txt -Value $identity
159+
160+
- name: Set up Java 17
161+
uses: actions/setup-java@v5
162+
with:
163+
distribution: temurin
164+
java-version: "17"
165+
cache: gradle
166+
167+
# The same build-only fixtures the Linux job creates: the Gradle build
168+
# reads these paths while it configures prepareSandbox, and the pull
169+
# request tests never package the real extension payload.
170+
- name: Create the sandbox input paths the Gradle build needs
171+
shell: powershell
172+
run: |
173+
New-Item -ItemType Directory -Force -Path jetbrains_plugin/plugins/zoo-code/extension | Out-Null
174+
New-Item -ItemType File -Force -Path jetbrains_plugin/plugins/zoo-code/extension/.keep | Out-Null
175+
New-Item -ItemType File -Force -Path jetbrains_plugin/prodDep.txt | Out-Null
176+
177+
# RawOutputTtyConnectorTest runs its stub connector tests and skips the
178+
# Linux-only real-PTY test. WindowsConPtyProcessTest holds the real
179+
# ConPTY process tests and is skipped on any non-Windows runner.
180+
#
181+
# The runner wraps `powershell` scripts in $ErrorActionPreference =
182+
# 'stop'. In Windows PowerShell 5.1, `2>&1` on a native command turns
183+
# every stderr line into an ErrorRecord, and under 'stop' the first
184+
# Gradle stderr line would abort the step before the exit-code line
185+
# runs. The 2>&1 merge therefore happens inside cmd.exe, before
186+
# PowerShell sees any bytes, so the pipeline carries plain strings.
187+
# cmd /c propagates the Gradle wrapper exit code into $LASTEXITCODE.
188+
# A missing or empty log means the upload step would publish no
189+
# evidence, so that failure is surfaced explicitly.
190+
- name: Run the Windows terminal tests
191+
working-directory: jetbrains_plugin
192+
shell: powershell
193+
run: |
194+
$taskList = @(
195+
'test'
196+
'--tests org.zoocode.jetbrains.terminal.RawOutputTtyConnectorTest'
197+
'--tests org.zoocode.jetbrains.terminal.TerminalPtyBuilderTest'
198+
'--tests org.zoocode.jetbrains.terminal.ShellIntegrationOutputStateTest'
199+
'--tests org.zoocode.jetbrains.terminal.TerminalShellReadinessTest'
200+
'--tests org.zoocode.jetbrains.terminal.WindowsConPtyProcessTest'
201+
'--no-configuration-cache'
202+
)
203+
cmd /c "gradlew.bat $($taskList -join ' ') 2>&1" | Tee-Object -FilePath ..\windows-test-log.txt
204+
$gradleExit = $LASTEXITCODE
205+
$testLog = Get-Item -LiteralPath ..\windows-test-log.txt -ErrorAction SilentlyContinue
206+
if ($null -eq $testLog -or $testLog.Length -eq 0) {
207+
Write-Output '::error::the Gradle test log is missing or empty, so the artifact step would publish no evidence'
208+
exit 1
209+
}
210+
exit $gradleExit
211+
212+
# The "powershell" shell is Windows PowerShell 5.1; "pwsh" would run
213+
# PowerShell 7 and would not validate the 5.1 parser path. The script
214+
# signals failure with a terminating error, so a catch decides the step
215+
# outcome; $LASTEXITCODE is stale here because the script's last native
216+
# command is cmd.exe. The smoke is independent of the Gradle test step,
217+
# so it still runs when that step failed; !cancelled() skips it only
218+
# when the job itself is cancelled. A failed test step keeps failing the
219+
# job, and this step keeps its own exit-code checks.
220+
- name: Smoke check the PowerShell integration profile on Windows PowerShell 5.1
221+
if: ${{ !cancelled() }}
222+
shell: powershell
223+
run: |
224+
try {
225+
& .\jetbrains_plugin\smoke\PowerShellIntegrationCheck.ps1 2>&1 | Tee-Object -FilePath windows-smoke-log.txt
226+
} catch {
227+
$_ | Out-String | Tee-Object -FilePath windows-smoke-log.txt -Append
228+
exit 1
229+
}
230+
exit 0
231+
232+
- name: Store the test results, logs, and run identity
233+
if: always()
234+
uses: actions/upload-artifact@v4
235+
with:
236+
name: windows-pr-results-${{ github.sha }}-windows-latest-jdk17
237+
path: |
238+
jetbrains_plugin/build/test-results/test/*.xml
239+
jetbrains_plugin/build/reports/tests/test/**
240+
windows-test-log.txt
241+
windows-smoke-log.txt
242+
windows-run-identity.txt
243+
if-no-files-found: warn

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ deps/vscode/*
5252
jetbrains_plugin/plugins
5353
jetbrains_plugin/build
5454
.gradle
55+
/.gradle-user-home/
5556
deps/vsix/package/*
5657
deps/vsix/plugin/*
5758
-e
5859
# Roo build artifacts
5960
.zoo-build/
6061
dist-with-roo/
61-
plans/
62+
plans/

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
## Unreleased
4+
5+
### Terminal on Windows
6+
7+
- The plugin requests ConPTY explicitly through the public pty4j setter. The JetBrains registry key `terminal.use.conpty.on.windows` is no longer read.
8+
- If the ConPTY native library fails to load, the process falls back to winpty and the session continues.
9+
- Other process start failures propagate to the terminal error handling.

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ The plugin targets IntelliJ Platform build **233** (JetBrains 2023.3) or newer.
8282
- Android Studio 2026.1.4 or newer when using Android Studio; install a preview build until this version reaches the stable channel
8383
- A JCEF-enabled IDE runtime, which Zoo Code requires to render its interface
8484

85+
Where JCEF support comes from depends on the IDE version. From IntelliJ Platform 2026.2 (build 262), JCEF ships as a separate bundled plugin. If that plugin is missing or disabled, Zoo Code shows a warning notification and the Zoo Code tool window cannot render. Enable the bundled JCEF plugin under **Settings → Plugins → Installed** and restart the IDE. On IDEs older than 2026.2, JCEF comes from the IDE runtime; see [Known Issues](docs/KNOWN_ISSUES.md).
86+
8587
On first launch the plugin automatically downloads a pinned, platform-specific Node.js runtime from [nodejs.org](https://nodejs.org) (checksum-verified) and uses it to run the extension host, so no local Node.js installation is required. If the download is unavailable, the plugin falls back to a bundled Node.js or a Node.js **20.6.0 or newer** found on your `PATH`.
8688

8789
### Building from source

‎docs/KNOWN_ISSUES.md‎

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ Android Studio's default startup runtime does not include JCEF capabilities, req
2020
1. **Download a JCEF-Compatible JetBrains Runtime**
2121

2222
Download a JetBrains Runtime (JBR) with JCEF support:
23-
23+
2424
👉 https://github.com/JetBrains/JetBrainsRuntime/releases
25-
25+
2626
Choose a release with:
2727
- `jbr_jcef` in the name
2828
- Correct architecture (osx-aarch64, linux-x64, or windows-x64)
29-
29+
3030
Example:
3131
```
3232
jbr_jcef-17.0.11-osx-aarch64-b1063.2.tar.gz
3333
```
34-
34+
3535
Unpack it somewhere, e.g.:
3636
```
3737
~/jbr/jbr_jcef
@@ -47,15 +47,15 @@ Android Studio's default startup runtime does not include JCEF capabilities, req
4747
4. Select it and choose the folder where you extracted the JBR (e.g., ~/jbr/jbr_jcef).
4848
4949
3. **Restart Android Studio**
50-
50+
5151
After selecting the new runtime, Android Studio will prompt you to restart. Confirm, and it will relaunch with the new runtime.
5252
5353
4. **Verify the Runtime**
54-
54+
5555
Go to Help → About to confirm the IDE is now running with the new JBR. The version should indicate JCEF support (e.g., JetBrains Runtime jbr-17.0.11+7-b1238.56-jcef).
5656
5757
5. **Revert if Needed**
58-
58+
5959
You can always use the same "Choose Boot Java Runtime for the IDE" action to switch back to the default runtime if needed.
6060
6161
##### Method 2: Using Edit Custom VM Options
@@ -91,6 +91,27 @@ On Linux ARM platforms, JCEF may fail to initialize native processes properly, l
9191
#### Solutions
9292
No solution available at this time.
9393
94+
### 1.3 JCEF Is Not Available on IDE 2026.2 or Newer
95+
96+
#### Problem Description
97+
98+
From IntelliJ Platform 2026.2 (build 262), JetBrains packages JCEF as a separate bundled plugin with the id `com.intellij.modules.jcef`. JCEF is no longer part of the IDE platform. When this bundled plugin is not present, the Zoo Code view cannot render.
99+
100+
#### Behavior
101+
102+
The plugin does not crash. It logs the reason and shows a warning notification. The Zoo Code tool window stays empty. The IDE log shows the state in the startup line `JCEF: CLASSES_MISSING`.
103+
104+
#### Affected Platforms
105+
- IDEs based on IntelliJ Platform build 262 or newer without the bundled JCEF plugin
106+
107+
#### Solutions
108+
109+
1. Open **Settings → Plugins → Installed** and search for **JCEF**.
110+
2. Enable the bundled JCEF plugin if it is disabled.
111+
3. Restart the IDE.
112+
113+
If the bundled JCEF plugin is not in the list, this IDE build does not ship JCEF, and the Zoo Code view cannot run in it. IDEs older than 2026.2 get JCEF from the runtime; see section 1.1.
114+
94115
---
95116
96117
## 2. Node Related Issues

‎docs/windows-validation.md‎

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Windows validation status
2+
3+
This document records the Windows validation state of the `fix-intelliJ-compatibility`
4+
branch. It separates evidence from automated GitHub runner coverage and evidence from
5+
real IDE sessions. It records only evidence that was reported; it does not store logs
6+
that do not exist in this repository.
7+
8+
## Recorded manual evidence (external Windows agent)
9+
10+
Commit `05dea49` on `fix-intelliJ-compatibility` was validated on an external Windows
11+
machine. The requester reported the following results. The logs live on that agent and
12+
are not locally accessible, so this repository cannot reproduce them.
13+
14+
- The two new Kotlin test classes passed: `ShellIntegrationOutputStateTest` and
15+
`TerminalShellReadinessTest`, 4 tests in total.
16+
- [`smoke/PowerShellIntegrationCheck.ps1`](../jetbrains_plugin/smoke/PowerShellIntegrationCheck.ps1)
17+
passed under Windows PowerShell 5.1.
18+
- A real IDE session passed: plugin execution, Unicode output, exact exit codes,
19+
connector reuse, and five repeated terminal startups.
20+
21+
Status: the Windows requirement is **partially validated** by this manual evidence.
22+
The agent checkout path is not recorded in this repository.
23+
24+
Scope note: the reported "connector reuse" is real IDE session reuse. The CI
25+
coverage is narrower: several commands inside one live process session, and
26+
repeated fresh sessions. The CI job never reuses a terminal session inside the
27+
IDE, so the two reuse claims are not interchangeable.
28+
29+
## Windows CI validation (passed 2026-10-09)
30+
31+
The `windows-verify` job in [`.github/workflows/pr.yml`](../.github/workflows/pr.yml)
32+
runs on every pull request. Hosted run logs and artifacts expire, so this
33+
document records the result and not a run link. The job is the living evidence.
34+
35+
- Date: 2026-10-09
36+
- Branch head: `97070c9` on `fix-intelliJ-compatibility` (pull request #10)
37+
- Runner: `windows-latest`, JDK temurin 17
38+
- Result: 6 of 6 `WindowsConPtyProcessTest` tests passed on the ConPTY
39+
backend. None were skipped. Unicode execution, exact exit code, resize,
40+
Ctrl+C/ETX interrupt, five repeated fresh startups, and bounded close all
41+
passed.
42+
- The PowerShell 5.1 smoke script passed.
43+
44+
History: an earlier run failed the interrupt test. The test sent the next
45+
command right after the ETX byte, and no prompt returned. The test now installs
46+
a counted prompt (`zp<N>`) and waits for a new prompt before the next command.
47+
The interrupt then passed, so the ETX byte does reach the shell in this harness.
48+
49+
Each run records its own identity and uploads it as an artifact:
50+
51+
- `Checkout: $env:GITHUB_WORKSPACE`
52+
- `Tested commit: $(git rev-parse HEAD)`; a pull request job can test a merge
53+
commit, so this value can differ from the branch head
54+
- `Run: $env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID`
55+
56+
## Automated runner coverage
57+
58+
The `windows-verify` job runs on `windows-latest` with JDK 17:
59+
60+
- `RawOutputTtyConnectorTest`: connector stub tests; the Linux-only real-PTY test
61+
skips on Windows.
62+
- `TerminalPtyBuilderTest`: the explicit ConPTY selection and builder values.
63+
- `ShellIntegrationOutputStateTest` and `TerminalShellReadinessTest`: marker parsing
64+
and readiness.
65+
- `WindowsConPtyProcessTest`: real ConPTY process tests that start through the
66+
production `TerminalPtyBuilder` and assert the live process is the ConPTY
67+
backend, so a silent winpty fallback fails. Teardown runs through one bounded
68+
cleanup with a force-destroy watchdog, and cleanup problems are reported as
69+
suppressed failures without masking the original assertion. Coverage: input
70+
execution with Unicode, exact exit codes, resize through the connector with
71+
executed width and height, the Ctrl+C/ETX pipeline interrupt with a documented
72+
pipeline-interruption scope, five repeated fresh startups, and bounded close
73+
with separate completion, process exit, and reader termination assertions.
74+
All of it is process-level: several commands inside one live session and
75+
repeated fresh sessions. The CI job never reuses a connector the way a real
76+
IDE session does.
77+
- [`smoke/PowerShellIntegrationCheck.ps1`](../jetbrains_plugin/smoke/PowerShellIntegrationCheck.ps1)
78+
runs through `powershell.exe`, which is Windows PowerShell 5.1, not `pwsh`.
79+
The step carries `if: ${{ !cancelled() }}`: it also runs after a failed
80+
Gradle test step, and only a cancelled job skips it. A failed test step
81+
still fails the job, and the smoke keeps its own exit-code checks.
82+
- Test XML, HTML reports, logs, and the run identity upload with `if: always()`.
83+
84+
## Real IDE coverage (manual only)
85+
86+
The CI job never starts the IDE. Real IDE execution, interactive rendering,
87+
connector reuse inside one IDE session, and workspace-close behavior need a
88+
human session. The native PTY tests above prove process behavior only; they are
89+
not real IDE workspace-close tests.
90+
91+
## Remaining gaps
92+
93+
| Item | Runner coverage | Real IDE evidence |
94+
| --- | --- | --- |
95+
| Input execution, Unicode, exact exit codes, five fresh startups | Passed 2026-10-09 | Reported for `05dea49` |
96+
| Multi-command execution inside one live process session | Passed 2026-10-09 | None |
97+
| Connector reuse in a real IDE session | None; out of CI scope | Reported for `05dea49` |
98+
| Resize | Passed 2026-10-09 | None |
99+
| Ctrl+C / ETX pipeline interrupt | Passed 2026-10-09: the shell returns to a new prompt after ETX | None |
100+
| Interactive input | Process-level input only | None |
101+
| Workspace-close cleanup | None | None |
102+
| 263 JCEF matching native bundle | None | None; known gap |
103+
104+
## Local validation
105+
106+
No Windows executor exists in the local Linux workspace. Windows results come
107+
from the hosted job only. The Linux job runs the same test classes, and the
108+
Windows-only tests skip there.

‎jetbrains_plugin/build.gradle.kts‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fun Sync.prepareSandbox() {
154154
}
155155
depfile.readLines().let {
156156
it.forEach { line ->
157-
depPatterns.add(line.substringAfterLast("node_modules/") + "/**")
157+
depPatterns.add(line.replace('\\', '/').substringAfterLast("node_modules/") + "/**")
158158
}
159159
}
160160

@@ -363,17 +363,29 @@ tasks {
363363
// linked against the 233 platform jars already on the compile classpath; this task
364364
// never needs the 2026.3 IDE. The scan target is the instrumented jar in the
365365
// sandbox, the exact bytes that the Plugin Verifier checks and that the published
366-
// zip packages. The marker output makes the task up-to-date when the sandbox and
367-
// the checker are unchanged.
366+
// zip packages. The task first runs the checker --self-test, which feeds it
367+
// synthetic clean and banned jars, so a scanner regression fails this task. The
368+
// marker output makes the task up-to-date when the sandbox and the checker are
369+
// unchanged.
368370
register("verifyPackagedBytecode") {
369371
group = "verification"
370-
description = "Reject packaged references to terminal APIs removed in IntelliJ 2026.3"
372+
description =
373+
"Reject packaged references to terminal APIs removed in IntelliJ 2026.3 and to internal LocalPtyOptions API"
371374
val checker = layout.projectDirectory.file("smoke/Smoke263DispatchCheck.java")
372375
inputs.files(prepareSandbox.map { it.destinationDir })
373376
inputs.file(checker)
374377
outputs.file(layout.buildDirectory.file("verification/packaged-bytecode.ok"))
375378
dependsOn(prepareSandbox)
376379
doLast {
380+
project.exec {
381+
commandLine(
382+
verificationJavaLauncher.get().executablePath.asFile.absolutePath,
383+
"-cp",
384+
configurations.getByName("compileClasspath").asPath,
385+
checker.asFile.absolutePath,
386+
"--self-test",
387+
)
388+
}
377389
val pluginJar = packagedPluginJar()
378390
project.exec {
379391
commandLine(

0 commit comments

Comments
 (0)