From d8fde15eb5981be7e23d77241f48a8bdcf2ff5dc Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 29 Aug 2026 21:25:03 -0700 Subject: [PATCH] test(linux): avoid buffered serve readiness detection --- config/docker/headless-serve-shutdown/run-signal-case.sh | 4 ++-- config/scripts/headless-serve-shutdown-workflow.test.mjs | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/docker/headless-serve-shutdown/run-signal-case.sh b/config/docker/headless-serve-shutdown/run-signal-case.sh index 532e33f0cc7..13a5ec82c61 100755 --- a/config/docker/headless-serve-shutdown/run-signal-case.sh +++ b/config/docker/headless-serve-shutdown/run-signal-case.sh @@ -54,10 +54,10 @@ app_pid=$! app_start_ticks=$(awk '{print $22}' "/proc/$app_pid/stat") # The inner shell expands its positional parameters. -# shellcheck disable=SC2016 +# shellcheck disable=SC1083,SC2016 ready_line=$(timeout "$startup_timeout_seconds" bash -c ' tail --pid="$1" -n +1 -F "$2" 2>/dev/null \ - | sed -n 's/^[^{]*//p' \ + | sed -u -n 's/^[^{]*//p' \ | jq --unbuffered -Rnc '\''first(inputs | fromjson? | select(.type == "orca_server_ready" and .schemaVersion == 1))'\'' ' bash "$app_pid" "$stdout_log" || true) if [[ -z "$ready_line" ]]; then diff --git a/config/scripts/headless-serve-shutdown-workflow.test.mjs b/config/scripts/headless-serve-shutdown-workflow.test.mjs index d4de0cd55a3..2e16de08bed 100644 --- a/config/scripts/headless-serve-shutdown-workflow.test.mjs +++ b/config/scripts/headless-serve-shutdown-workflow.test.mjs @@ -5,6 +5,7 @@ import { describe, expect, it } from 'vitest' const workflow = parse(readFileSync('.github/workflows/pr.yml', 'utf8')) const headlessLinuxGuide = readFileSync('docs/reference/headless-linux-server.md', 'utf8') +const signalCase = readFileSync('config/docker/headless-serve-shutdown/run-signal-case.sh', 'utf8') function readSystemdUnitBlocks(doc, unitName) { const escapedUnitName = unitName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') @@ -65,6 +66,10 @@ describe('headless serve shutdown PR gate', () => { expect(steps.indexOf(appImageShutdownStep)).toBeGreaterThan(steps.indexOf(launcherShutdownStep)) }) + it('keeps the readiness parser line-buffered', () => { + expect(signalCase).toContain("| sed -u -n 's/^[^{]*//p'") + }) + it('keeps owned Xvfb alive during the documented systemd graceful stop', () => { const serveUnits = readSystemdUnitBlocks(headlessLinuxGuide, 'orca-serve.service') const ownedXvfbUnits = serveUnits.filter((unit) => !/^Environment=DISPLAY=/m.test(unit))