Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f865cb4
ci: decouple unit tests from interactive startup and classify E2E fai…
mark-e-deyoung Nov 6, 2026
66ddadc
fix(startup): emit bounded, nonsecret stage on early entrypoint exit
mark-e-deyoung Nov 6, 2026
586b4a5
security(api): stop leaking generated API credential to container logs
mark-e-deyoung Nov 6, 2026
f98ee8c
test(ci): guard unit independence, startup stage and token-log boundary
mark-e-deyoung Nov 6, 2026
f5958d5
ci: qualify unit/E2E separation on public-only source contract
mark-e-deyoung Nov 6, 2026
6cfdbec
test(ci): include startup/unit boundary regression in standard unit s…
mark-e-deyoung Nov 6, 2026
391c626
ci(test): execute full unit suite independently on free public runner
mark-e-deyoung Nov 6, 2026
717b5aa
test(rdte): independently qualify real Wine startup with bounded nons…
mark-e-deyoung Nov 6, 2026
258afa7
fix(ci): validate both Compose profiles while isolating runner with n…
mark-e-deyoung Nov 6, 2026
655bd82
fix(ci): validate both Compose profiles while isolating runner with n…
mark-e-deyoung Nov 6, 2026
de429fb
fix(ci): validate both Compose profiles while isolating runner with n…
mark-e-deyoung Nov 6, 2026
9715878
fix(ci): keep bounded Python startup classifier inside valid YAML run…
mark-e-deyoung Nov 6, 2026
725a8e8
fix(ci): keep bounded Python startup classifier inside valid YAML run…
mark-e-deyoung Nov 6, 2026
9b901f8
test(ci): parse both modified workflow YAML files before expensive pu…
mark-e-deyoung Nov 6, 2026
01dc6f7
style(ci): fix public-lint import order at startup acceptance head
mark-e-deyoung Nov 6, 2026
617087f
diagnostic(ci): classify exact Wine startup stage without leaking ser…
mark-e-deyoung Nov 6, 2026
05c4378
fix(wine): bound retry of transient input-trace winepath lookup witho…
mark-e-deyoung Nov 6, 2026
d1844b7
fix(startup): retry both mandatory Wine trace paths without disabling…
mark-e-deyoung Nov 6, 2026
9bfcc3b
test(wine): prove bounded path retry, invalid-output refusal and no l…
mark-e-deyoung Nov 6, 2026
464afaa
test(wine): include bounded trace-path regression in public unit suite
mark-e-deyoung Nov 6, 2026
0ba4f9d
ci(wine): requalify public startup workflow when bounded Wine paths c…
mark-e-deyoung Nov 6, 2026
9dacb10
fix(ci): pin Wine runtime jobs to known passing Ubuntu 24.04 runner
mark-e-deyoung Nov 6, 2026
ffabbeb
fix(ci): pin Wine runtime jobs to known passing Ubuntu 24.04 runner
mark-e-deyoung Nov 6, 2026
35059ae
test(ci): guard known passing public Ubuntu 24.04 Wine execution venue
mark-e-deyoung Nov 6, 2026
3fb7f9f
ci: requalify Wine runner pin whenever reusable smoke workflow changes
mark-e-deyoung Nov 6, 2026
3b089c0
fix(ci): reconcile qualified Wine 11 startup correction with merged R…
mark-e-deyoung Nov 6, 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
91 changes: 91 additions & 0 deletions .github/workflows/ci-unit-isolation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI Unit Isolation and Startup Safety
on:
pull_request:
paths:
- '.github/workflows/ci.yml'
- '.github/workflows/reusable-build-smoke-gate.yml'
- '.github/workflows/ci-unit-isolation.yml'
- 'docker/entrypoint.sh'
- 'scripts/init/30-start-services.sh'
- 'scripts/init/winepath-with-retry.sh'
- 'tests/test_winepath_startup_retry.py'
- 'scripts/ci/test.sh'
- 'scripts/ci/classify-startup-logs.py'
- 'tests/test_ci_unit_isolation.py'

permissions:
contents: read

jobs:
safe-startup-contract:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout public source without saved credentials
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
- name: Shell syntax and isolated CI regression
shell: bash
run: |
set -euo pipefail
bash -n docker/entrypoint.sh scripts/init/30-start-services.sh scripts/ci/test.sh
python3 tests/test_ci_unit_isolation.py
python3 -m py_compile scripts/ci/classify-startup-logs.py
- name: Validate GitHub Actions workflow YAML
shell: bash
run: |
set -euo pipefail
python3 -m pip install --disable-pip-version-check PyYAML==6.0.3
python3 -c 'import yaml; from pathlib import Path; files = (".github/workflows/ci.yml", ".github/workflows/ci-unit-isolation.yml"); [yaml.safe_load(Path(p).read_text(encoding="utf-8")) for p in files]; print("PASS: workflow YAML parsed")'

runtime-independent-unit-suite:
runs-on: ubuntu-24.04
timeout-minutes: 40
steps:
- name: Checkout public source without saved credentials
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
- name: Build unit image without starting Wine
run: docker compose -f compose/docker-compose.yml --profile test --profile interactive build test-runner
- name: Execute real project unit suite with no service dependencies
run: docker compose -f compose/docker-compose.yml --profile test --profile interactive run --rm --no-deps test-runner scripts/ci/test.sh
- name: Cleanup test-only containers
if: always()
run: docker compose -f compose/docker-compose.yml --profile test --profile interactive down --remove-orphans || true

bounded-interactive-startup:
runs-on: ubuntu-24.04
timeout-minutes: 40
steps:
- name: Checkout public source without saved credentials
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
- name: Build exact WineBot interactive image on public runner
run: docker compose -f compose/docker-compose.yml --profile interactive build winebot-interactive
- name: Exercise real interactive health gate
id: startup
continue-on-error: true
run: docker compose -f compose/docker-compose.yml --profile interactive up --detach --wait --wait-timeout 150 winebot-interactive
- name: Classify startup failure without revealing service logs
if: ${{ always() && steps.startup.outcome == 'failure' }}
run: |
set -euo pipefail
cid="$(docker compose -f compose/docker-compose.yml --profile interactive ps -q winebot-interactive || true)"
if [ -z "$cid" ]; then
echo "STARTUP_DIAGNOSTIC container=absent"
else
docker inspect --format='STARTUP_DIAGNOSTIC status={{.State.Status}} exit_code={{.State.ExitCode}} oom={{.State.OOMKilled}}' "$cid" || true
fi
docker compose -f compose/docker-compose.yml --profile interactive logs --no-color --tail 200 winebot-interactive 2>/dev/null |
python3 scripts/ci/classify-startup-logs.py || true
- name: Reject unqualified interactive startup
if: always()
env:
STARTUP_OUTCOME: ${{ steps.startup.outcome }}
run: test "$STARTUP_OUTCOME" = success
- name: Stop isolated interactive service
if: always()
run: docker compose -f compose/docker-compose.yml --profile interactive down --remove-orphans || true
32 changes: 27 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ concurrency:
jobs:
pre-flight:
name: Pre-flight (Lint & Unit)
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Verify capability matrix references
Expand All @@ -38,18 +38,40 @@ jobs:
- name: Containerized Linting
run: docker compose -f compose/docker-compose.yml --profile lint run --rm lint-runner scripts/ci/lint.sh

- name: Containerized Unit Tests
run: docker compose -f compose/docker-compose.yml --profile test --profile interactive run --rm test-runner scripts/ci/test.sh
- name: Containerized Unit Tests (runtime-independent)
run: docker compose -f compose/docker-compose.yml --profile test --profile interactive run --rm --no-deps test-runner scripts/ci/test.sh

- name: Start interactive dependency for browser E2E
id: start-e2e-runtime
run: docker compose -f compose/docker-compose.yml --profile interactive up --detach --wait --wait-timeout 150 winebot-interactive

- name: Classify failed interactive startup without printing service logs
if: ${{ failure() && steps.start-e2e-runtime.outcome == 'failure' }}
run: |
set -euo pipefail
container_id="$(docker compose -f compose/docker-compose.yml --profile interactive ps -q winebot-interactive || true)"
if [ -z "$container_id" ]; then
echo "STARTUP_DIAGNOSTIC container=absent"
else
docker inspect --format='STARTUP_DIAGNOSTIC status={{.State.Status}} exit_code={{.State.ExitCode}} oom={{.State.OOMKilled}}' "$container_id" || true
fi
# Read privately; emit only enumerated stage names, never raw logs or tokens.
docker compose -f compose/docker-compose.yml --profile interactive logs --no-color --tail 200 winebot-interactive 2>/dev/null |
python3 scripts/ci/classify-startup-logs.py || true

- name: Deterministic E2E subset
run: |
docker compose -f compose/docker-compose.yml --profile interactive --profile test run --rm test-runner \
docker compose -f compose/docker-compose.yml --profile test --profile interactive run --rm --no-deps test-runner \
pytest -q /work/tests/e2e/test_dashboard_e2e.py /work/tests/e2e/test_ux_keyboard_accessibility.py

- name: Stop E2E runtime
if: always()
run: docker compose -f compose/docker-compose.yml --profile interactive down --remove-orphans || true

conformance:
name: Conformance (Contracts)
needs: pre-flight
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-build-smoke-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ defaults:

jobs:
build-smoke-gate:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Maximize disk space
Expand Down
8 changes: 8 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ if [ "$(id -u)" = "0" ]; then
fi

# --- USER CONTEXT (winebot) ---
# Classify an early failure by a fixed stage, never echoing environment values.
WINEBOT_STARTUP_STAGE="configuration"
trap 'startup_rc=$?; if [ "$startup_rc" -ne 0 ]; then printf "WINEBOT_STARTUP_ERROR stage=%s rc=%s\\n" "$WINEBOT_STARTUP_STAGE" "$startup_rc" >&2; fi' EXIT
write_instance_state() {
local state="$1"
local reason="${2:-}"
Expand Down Expand Up @@ -116,17 +119,22 @@ if { [ "$BUILD_INTENT" = "rel" ] || [ "$BUILD_INTENT" = "rel-runner" ]; } && [ "
echo "--> Support Mode enabled for ${ttl_min} minutes (until epoch ${WINEBOT_SUPPORT_MODE_UNTIL_EPOCH})."
fi

WINEBOT_STARTUP_STAGE="infrastructure"
# 2. Infrastructure Setup (Session, X11, WM)
echo "--> Pass 2: Infrastructure..."
source /scripts/init/10-setup-infra.sh

WINEBOT_STARTUP_STAGE="wine"
# 3. Wine Environment Setup (Prefix, Theme, VNC)
echo "--> Pass 3: Wine Environment..."
source /scripts/init/20-setup-wine.sh

WINEBOT_STARTUP_STAGE="services"
# 4. Service Startup (API, Recorder, Supervisor)
echo "--> Pass 4: Services..."
source /scripts/init/30-start-services.sh
# Startup complete; do not misclassify later application failures.
trap - EXIT

if [ "${DEBUG:-0}" = "1" ]; then
echo "--> DEBUG: Windows automation tool versions..."
Expand Down
49 changes: 49 additions & 0 deletions scripts/ci/classify-startup-logs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env python3
"""Emit only fixed startup diagnostic codes; never echo untrusted service log text."""

from __future__ import annotations

import sys

SPECIFIC_STAGES = (
("services/trace-log-path", "failed_trace_log_path"),
("services/trace-script-path", "failed_trace_script_path"),
("services/trace-launch", "failed_trace_launch"),
("services/api-token", "failed_api_token"),
("services/native-input-trace", "failed_native_trace"),
("services/recording", "failed_recorder"),
("services/api", "failed_api"),
("services/supervisor", "failed_supervisor"),
("services/input-trace", "failed_input_trace"),
("services/complete", "failed_services_complete"),
("services", "failed_services"),
("configuration", "failed_configuration"),
("infrastructure", "failed_infrastructure"),
("wine", "failed_wine"),
)


def main() -> int:
# Compose logs may contain credentials or user-facing window titles.
# Read job-locally; print ONLY enumerated codes, never raw text.
raw = sys.stdin.read(262144)
for marker, code in SPECIFIC_STAGES:
if "WINEBOT_STARTUP_ERROR stage=" + marker + " " in raw:
print("STARTUP_DIAGNOSTIC stage=" + code)
return 0
for marker, code in (
("Pass 4: Services", "reached_services"),
("Pass 3: Wine Environment", "reached_wine"),
("Pass 2: Infrastructure", "reached_infrastructure"),
("Xvfb failed to start", "xvfb_failure"),
("Configuration admission rejected", "configuration_rejected"),
):
if marker in raw:
print("STARTUP_DIAGNOSTIC stage=" + code)
return 0
print("STARTUP_DIAGNOSTIC stage=unknown")
return 0


if __name__ == "__main__":
raise SystemExit(main())
2 changes: 2 additions & 0 deletions scripts/ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ pytest \
tests/test_visual_profile_cli.py \
tests/test_ci_trust_pack_provenance.py \
tests/test_ci_public_conformance_summary.py \
tests/test_ci_unit_isolation.py \
tests/test_winepath_startup_retry.py \
tests/test_wininspect_error_redaction.py
21 changes: 17 additions & 4 deletions scripts/init/30-start-services.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# 30-start-services.sh: Start API, Tracing, and Supervisor Loop

WINEBOT_STARTUP_STAGE="services/input-trace"
echo "--> Pass 4: Service Startup (WINEBOT_INPUT_TRACE_WINDOWS=${WINEBOT_INPUT_TRACE_WINDOWS:-unset})"

# Post-Init Tracing (Ensures wineserver is stable)
Expand All @@ -9,8 +10,11 @@ if [ "${WINEBOT_INPUT_TRACE_WINDOWS:-0}" = "1" ]; then
sleep 2
WIN_TRACE_MS="${WINEBOT_INPUT_TRACE_WINDOWS_SAMPLE_MS:-5}"
mkdir -p "$SESSION_DIR/logs"
WINE_LOG_PATH=$(winepath -w "$SESSION_DIR/logs/input_events_windows.jsonl")
WINE_SCRIPT_PATH=$(winepath -w /automation/core/input_trace_windows.ahk)
WINEBOT_STARTUP_STAGE="services/trace-log-path"
WINE_LOG_PATH="$(/scripts/init/winepath-with-retry.sh "$SESSION_DIR/logs/input_events_windows.jsonl")"
WINEBOT_STARTUP_STAGE="services/trace-script-path"
WINE_SCRIPT_PATH="$(/scripts/init/winepath-with-retry.sh /automation/core/input_trace_windows.ahk)"
WINEBOT_STARTUP_STAGE="services/trace-launch"
echo "--> Starting Windows Input Trace..."
(
TRACE_RESTART_WINDOW="${WINEBOT_TRACE_RESTART_WINDOW_SECONDS:-120}"
Expand Down Expand Up @@ -47,11 +51,13 @@ if [ "${WINEBOT_INPUT_TRACE_WINDOWS:-0}" = "1" ]; then
) &
fi

WINEBOT_STARTUP_STAGE="services/native-input-trace"
if [ "${WINEBOT_INPUT_TRACE:-0}" = "1" ]; then
python3 -m automation.input_trace start --session-dir "$SESSION_DIR" >/dev/null 2>&1 &
fi

# Recorder (if enabled)
WINEBOT_STARTUP_STAGE="services/recording"
if [ "${WINEBOT_RECORD:-0}" = "1" ]; then
if [[ "$SCREEN" == *x*x* ]]; then RES="${SCREEN%x*}"; else RES="$SCREEN"; fi

Expand All @@ -73,12 +79,16 @@ if [ "${WINEBOT_RECORD:-0}" = "1" ]; then
fi

# API
WINEBOT_STARTUP_STAGE="services/api"
if [ "${ENABLE_API:-0}" = "1" ]; then
if [ -z "${API_TOKEN:-}" ]; then
# Generate a random 16-char token for secure-by-default operation
WINEBOT_STARTUP_STAGE="services/api-token"
export API_TOKEN=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
echo "--> [SECURITY] No API_TOKEN provided. Generated random token: ${API_TOKEN}"
echo "--> [SECURITY] Use this token in 'X-API-Key' header for all requests."
WINEBOT_STARTUP_STAGE="services/api"
# Never print the generated credential into public CI/service logs.
echo "--> [SECURITY] Generated an ephemeral API token (value not logged)."
echo "--> [SECURITY] Token is available only through existing local file discovery."

fi
# Persist for internal tool discovery (use /tmp as /run is root-only)
Expand All @@ -101,6 +111,7 @@ if [ "${ENABLE_API:-0}" = "1" ]; then
fi

# Supervisor
WINEBOT_STARTUP_STAGE="services/supervisor"
if [ "${WINEBOT_SUPERVISE_EXPLORER:-1}" = "1" ]; then
echo "--> Starting Desktop Supervisor..."
# Settle time
Expand Down Expand Up @@ -182,3 +193,5 @@ if [ "${WINEBOT_SUPERVISE_EXPLORER:-1}" = "1" ]; then
else
echo "--> Desktop Supervisor disabled (WINEBOT_SUPERVISE_EXPLORER=0)."
fi

WINEBOT_STARTUP_STAGE="services/complete"
19 changes: 19 additions & 0 deletions scripts/init/winepath-with-retry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Convert one Linux path for Wine input tracing, retrying transient Wine startup.
# No fallback path and no sensitive Wine stderr are admitted to caller logs.
set -euo pipefail
if [ "$#" -ne 1 ] || [ -z "$1" ]; then
exit 2
fi
for attempt in 1 2 3 4; do
translated=""
if translated="$(timeout 8s winepath -w "$1" 2>/dev/null)" &&
[ -n "$translated" ] &&
[[ "$translated" != *$'\n'* ]] &&
[[ "$translated" != *$'\r'* ]]; then
printf '%s\n' "$translated"
exit 0
fi
if [ "$attempt" -lt 4 ]; then sleep 1; fi
done
exit 1
Loading
Loading