Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
6fae929
test: run the serial backend group beside the other suites
Phototonic Nov 18, 2026
fed0c86
ci: install the ZIP tools only when the runner lacks them
Phototonic Nov 18, 2026
68b055b
docs(openspec): record the faster test suites work in the 1.5.2 tasks
Phototonic Nov 18, 2026
de6b50c
test: run the lane beside the serial backend group at lower priority
Phototonic Nov 18, 2026
d4ea6b0
test: keep the priority check independent of the Actions log format
Phototonic Nov 18, 2026
6bc4230
ci: run the two native Windows test files side by side
Phototonic Nov 18, 2026
fa38feb
docs: describe the side-by-side Windows test files
Phototonic Nov 18, 2026
81953ce
test: share Node's compile cache across the test steps
Phototonic Nov 18, 2026
a14b472
test: stop the lanes on a signal and start each compile cache empty
Phototonic Nov 18, 2026
f732de9
Merge remote-tracking branch 'origin/dev' into test/faster-suites
Phototonic Nov 18, 2026
11a9a55
test: harden the lane runner and fence the built-service cleanup test
Phototonic Nov 18, 2026
3c73f89
ci: retry a refused simultaneous start of the two Windows test processes
Phototonic Nov 18, 2026
4ada204
test: stop every recorded group when the runner returns, passing or not
Phototonic Nov 18, 2026
985805e
test: retire process groups when empty and guard every pid the runner…
Phototonic Nov 18, 2026
05f89c6
test: survive a failed lookup of the harness process group
Phototonic Nov 18, 2026
8a5b617
test: keep the mocked cleanup calls off the host's real kill and task…
Phototonic Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 53 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ jobs:
with:
bun-version: 1.3.14
- name: Install ZIP tools
run: sudo apt-get update && sudo apt-get install -y zip unzip
# Hosted images already carry both tools; install only if one is missing.
run: command -v zip >/dev/null && command -v unzip >/dev/null || (sudo apt-get update && sudo apt-get install -y zip unzip)
- name: Install project dependencies
run: bun install --frozen-lockfile --ignore-scripts
- name: Run Linux tests, builds and package checks
Expand Down Expand Up @@ -172,7 +173,8 @@ jobs:
with:
bun-version: 1.3.14
- name: Install ZIP tools
run: sudo apt-get update && sudo apt-get install -y zip unzip
# Hosted images already carry both tools; install only if one is missing.
run: command -v zip >/dev/null && command -v unzip >/dev/null || (sudo apt-get update && sudo apt-get install -y zip unzip)
- name: Install project dependencies
run: bun install --frozen-lockfile --ignore-scripts
- name: Run Linux tests, builds and package checks
Expand Down Expand Up @@ -216,9 +218,23 @@ jobs:
# ownership semantics without relaxing the product's SID policy.
$name = 'progress' + [Guid]::NewGuid().ToString('N').Substring(0, 10)
$password = ConvertTo-SecureString ('Aa1!' + [Guid]::NewGuid().ToString('N')) -AsPlainText -Force
$output = Join-Path $env:RUNNER_TEMP ($name + '.stdout')
$errors = Join-Path $env:RUNNER_TEMP ($name + '.stderr')
$trace = Join-Path $env:RUNNER_TEMP 'windows-migration-trace.jsonl'
# The two native files run side by side, each in its own serial test
# runner. Only the service file starts a server and request workers,
# which are what take Setup coordination ports; the platform file
# drives the setup controller directly. Each runs under Start-Process
# -Wait inside a thread job, so it is waited for with everything it
# started, exactly as when they ran one after the other. Starting the
# two at the same instant can be refused once, so the start is retried.
$runs = @('windows-platform', 'windows-service') | ForEach-Object {
[pscustomobject]@{
File = $_
Output = Join-Path $env:RUNNER_TEMP ($name + '.' + $_ + '.stdout')
Errors = Join-Path $env:RUNNER_TEMP ($name + '.' + $_ + '.stderr')
Job = $null
ExitCode = $null
}
}
# Leave a fixed diagnostic even if principal/process creation fails.
'{"request":"runner-start","completed":false}' | Set-Content -LiteralPath $trace -Encoding utf8
$created = $false
Expand All @@ -227,23 +243,45 @@ jobs:
$created = $true
Add-LocalGroupMember -SID 'S-1-5-32-545' -Member $user
$credential = [PSCredential]::new(($env:COMPUTERNAME + '\' + $name), $password)
$process = Start-Process -FilePath (Get-Command node).Source -ArgumentList '--experimental-strip-types --test --test-concurrency=1 tests/backend/windows-platform.test.ts tests/backend/windows-service.test.ts' -WorkingDirectory $env:GITHUB_WORKSPACE -Credential $credential -LoadUserProfile -WindowStyle Hidden -Wait -PassThru -RedirectStandardOutput $output -RedirectStandardError $errors
if (Test-Path $output) {
Get-Content -LiteralPath $output
foreach ($run in $runs) {
$run.Job = Start-ThreadJob -ArgumentList $run, $credential, $env:GITHUB_WORKSPACE, (Get-Command node).Source -ScriptBlock {
param($run, $credential, $workspace, $node)
# The secondary logon service creates one process at a time and
# refuses a second request while it is busy; retry only that refusal.
$process = $null
for ($attempt = 1; -not $process; $attempt++) {
try {
$process = Start-Process -FilePath $node -ArgumentList "--experimental-strip-types --test --test-concurrency=1 tests/backend/$($run.File).test.ts" -WorkingDirectory $workspace -Credential $credential -LoadUserProfile -WindowStyle Hidden -Wait -PassThru -RedirectStandardOutput $run.Output -RedirectStandardError $run.Errors -ErrorAction Stop
} catch {
if ($attempt -ge 30 -or $_.Exception.Message -notmatch 'already running') { throw }
Start-Sleep -Seconds 1
}
}
$process.ExitCode
}
}
$null = $runs.Job | Wait-Job
foreach ($run in $runs) { $run.ExitCode = @(Receive-Job -Job $run.Job -ErrorAction Stop)[-1] }
foreach ($run in $runs) {
if (Test-Path $run.Output) {
Get-Content -LiteralPath $run.Output
}
if (Test-Path $run.Errors) { Get-Content -LiteralPath $run.Errors }
}
if (Test-Path $errors) { Get-Content -LiteralPath $errors }
if ($process.ExitCode -ne 0) { throw 'Native Windows tests failed.' }
if (@($runs | Where-Object { $_.ExitCode -ne 0 }).Count -gt 0) { throw 'Native Windows tests failed.' }
} finally {
# Preserve per-request evidence even on an assertion/process failure.
# Never upload raw stdout/stderr, local principal names or paths.
if (Test-Path $output) {
$traces = @(Get-Content -LiteralPath $output | ForEach-Object {
if ($_ -match '^\s*(?:#\s*)?WINDOWS_MIGRATION_TRACE (.+)$') { $Matches[1] }
})
if ($traces.Count -gt 0) { $traces | Add-Content -LiteralPath $trace -Encoding utf8 }
foreach ($run in $runs) {
if (Test-Path $run.Output) {
$traces = @(Get-Content -LiteralPath $run.Output | ForEach-Object {
if ($_ -match '^\s*(?:#\s*)?WINDOWS_MIGRATION_TRACE (.+)$') { $Matches[1] }
})
if ($traces.Count -gt 0) { $traces | Add-Content -LiteralPath $trace -Encoding utf8 }
}
}
if ($created) { Remove-LocalUser -Name $name }
Remove-Item -LiteralPath $output, $errors -Force -ErrorAction SilentlyContinue
Remove-Item -LiteralPath @($runs | ForEach-Object { $_.Output; $_.Errors }) -Force -ErrorAction SilentlyContinue
}
$requests = @(Get-Content -LiteralPath $trace | ForEach-Object { $_ | ConvertFrom-Json } | Where-Object { $_.request -and $_.request -notin @('runner-start','summary') })
if ($requests.Count -eq 0) { throw 'Native Windows request trace is missing.' }
Expand Down
71 changes: 70 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ Released-writer delegation fixtures require the local `v1.3.0` tag. Run
skip with a prerequisite diagnostic when the tag is unavailable. Full portable
CI requires full history and tags, so these cases run there.

Two scripts run the portable groups side by side after building every entry, and print each step's duration at the end:

```sh
# Edit-and-check loop: both typechecks, the parallel backend group, browser-model
# and automation tests. It skips the serial Setup-port backend group (below),
# which holds most of the full run's time, so it is not what CI runs.
bun run test:fast

# Everything portable CI tests, minus packaging and the rebuild comparison
bun run test:all
```

Both leave out the five native-only backend tests (see [Portable CI](#portable-ci--fresh-disposable-checkout-only)) and say so. Run `bun run test:all` or the commands below before a pull request when you touched backend, setup or service code; `test:fast` can pass where the serial group would fail. They are not replacements for `node --experimental-strip-types scripts/ci.ts` in a fresh checkout.

Run the checks relevant to your change:

```sh
Expand Down Expand Up @@ -89,6 +103,56 @@ concurrent writer. Keep new fenced HTTP/worker test files in the list in
This isolates tests, not product requests; no port override or relaxed refusal
is used.

That serial group is the longest part of the run. It is one request after another,
each starting a worker thread, plus a few deliberate deadline waits, so it is bound by
latency rather than by cores; no other group acquires Setup ports (checked with a probe
on the acquisition call). `scripts/ci.ts`
and `bun run test:all` therefore run it in one lane beside a second lane that
holds both typechecks, the parallel backend group and the browser-model and
automation tests (`scripts/test-plan.ts`, `scripts/test-lanes.ts`). The second
lane is capped at the machine's cores minus two and runs under `nice`, so the
timing assertions in the serial group keep their headroom (the cap never goes below
one worker, so on one to three cores the lane runs one worker at a time). A file that takes
a Setup port belongs in the serial group; never add one to the other lane. A listen probe
(a preload on `net.Server.prototype.listen`, covering worker threads, child processes and the
bundled `build/service/main.js`) found that no file in the parallel group or the browser and
automation tests takes one in the CI configuration. One file does in one configuration CI does
not use: `plan-cleanup-service.test.ts` runs the built service when `CP_BUILT_SERVICE=1`, and the
plan then moves it into the serial group (`fencedWhenSet` in `scripts/ci-backend.ts`).

The runner (`scripts/test-lanes.ts`) is POSIX-first: it prints each step's output whole under its
own heading (the last 2 MB if a step is noisier, saying what was dropped), names the steps still
running about every minute, and ends with a per-step duration list. The first failure, SIGINT,
SIGTERM, SIGHUP or a closed output pipe (`test:all | head`) stops both lanes and prints what the
running steps had written. Each step runs in its own process group, so the runner stops the groups
itself: a repeated signal, or a step that has not stopped ten seconds after the first, is killed
outright and abandoned even if a leftover process still holds its output pipes, and every group
the runner started is swept as soon as its leader has exited and its pipes have closed (SIGTERM, a short
bound, SIGKILL, a short bound, then a probe that finds the group empty), whether the step passed or not,
because a leader that exits 0 can leave descendants holding a port. A group leaves the record the moment a
probe finds it empty and is never signalled afterwards, since its id may then belong to an unrelated
process; every signal is preceded by a fresh probe, and the closing sweep and the exit hook touch only
groups not yet confirmed empty. Group ids are checked before use (a whole number above 1 that is neither
the runner nor its parent), and a crash of the runner kills what is still recorded. On Windows `taskkill`
goes only to a child whose `exit` has not fired. An
interrupted run exits 128 plus the signal number (130, 143, 129, 141), a failed one 1. A step
the runner stopped is reported as stopped; one that fails on its own is reported as failed with
its output, whenever it does so. On Windows steps are not detached and are stopped with
`taskkill /T /F`; that path is covered by a unit test of the stop command but has not been run on
Windows, and the typecheck step's `./node_modules/.bin/tsc` is a POSIX path, so on Windows run the
individual commands listed under Local development by hand. The process-group and signal cases of
`tests/automation/test-lanes.test.ts` are skipped on Windows (its stop-command case runs), and every case
stops the processes it started even when it fails.

Both runners also turn on Node's compile cache for every step they start
(`NODE_COMPILE_CACHE`, a folder under the ignored `node_modules/.cache/`). It keeps
V8's compiled code per source file and checks it against the source's hash, so a changed
file is recompiled rather than served stale, and each test process and each request
worker the managed-step tests start compiles a shared module once. It changes no test
input and is emptied at the start of every run (fixtures run from fresh temporary folders, so a
kept cache only grows); a standalone `node --test` run does not use it unless you export the
variable yourself.

This is **not native GUI/OpenCode or host-installer certification**. The external host-installer gate is separate, as described below. Full `bun run check` retains the native backend prerequisites; it is not the portable CI command.

The [workflow](.github/workflows/ci.yml) runs on pushes to `main` and `dev`, on every pull request whatever branch it targets, weekly on Tuesday at 04:17 UTC, and on manual dispatch. A PR stacked on another feature branch gets the same selection as one targeting `dev`. It retains the Linux portable checks on exactly Node 24.19.0, repeats them on the newest Node 24 release, and adds a targeted Windows native-filesystem suite. A newer push to a pull request cancels that pull request's earlier run. Versioned publication also waits for the full Windows job on its `main` push. Neither job substitutes for actual OpenCode/OpenChamber integration acceptance.
Expand All @@ -114,7 +178,12 @@ dispatch run the full set, even for UI/docs-only changes. The workflow sets
`AP_WINDOWS_FULL=1` only for those full runs and fetches `v1.1.1` only then.
Without that opt-in, the three journeys explicitly skip; no per-request
assertion, budget or deadline is relaxed. Local full native runs must also set
`AP_WINDOWS_FULL=1`. Weekly and manual CI runs target Windows only; the Linux
`AP_WINDOWS_FULL=1`. The Windows job starts the platform file and the service file
as two processes at once, each in its own serial test runner and as the same
unprivileged principal, each started with `Start-Process -Wait` inside a PowerShell thread job so
it is waited for together with everything it started, and reads both exit codes after both end; only the
service file starts a server and request workers, which take the Setup coordination
ports. Weekly and manual CI runs target Windows only; the Linux
jobs retain their PR/push coverage. See [native Windows verification](docs/compatibility.md#native-windows-verification).

Only `main` pushes can publish releases. A `dev` push runs portable checks but is never release-eligible; its publish job may appear as skipped. Accept the source on `dev` first, then prepare a promotion commit containing that source and its built outputs. Run the required host gates on the promotion checkout before its PR into `main` merges.
Expand Down
3 changes: 2 additions & 1 deletion docs/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ permits cleanup/permission repair. See

The `Windows setup, storage and capture` CI job runs the native platform suite
and `tests/backend/windows-service.test.ts` in the same provisioned non-admin
account. Ordinary PRs run it when backend/build/test inputs change (unknown
account, as two processes at once, each in its own serial test runner and each waited for
with everything it started (`Start-Process -Wait` inside a thread job). Ordinary PRs run it when backend/build/test inputs change (unknown
paths conservatively run it); UI, documentation, OpenSpec and browser-test-only
PRs skip it, as do duplicate same-repository main/dev heads outside promotion.
Every `dev` push runs the fast set. This retains every native test except three
Expand Down
Loading