diff --git a/scripts/resolvers/design.ts b/scripts/resolvers/design.ts index e12e1964d..f8669811d 100644 --- a/scripts/resolvers/design.ts +++ b/scripts/resolvers/design.ts @@ -1127,17 +1127,17 @@ function designReadyProbe(ctx: TemplateContext): string { return `_DS=$("${toShellPath(ctx.paths.skillRoot)}/bin/gstack-paths" --get GSTACK_STATE_ROOT 2>/dev/null); _DC=\${_DS:+$_DS/design-ready}; _DK=$(ls -diL "$D" 2>/dev/null) _dt() { if command -v gtimeout >/dev/null; then gtimeout 10 "$@"; elif command -v timeout >/dev/null; then timeout 10 "$@" elif command -v perl >/dev/null; then perl -e 'alarm(shift);exec(@ARGV)' 10 "$@"; else return 125; fi; } -_RC=0; _FIX="Fix: cd \${D%/design/dist/design} && ./setup" +_RC=0; _F="Fix: cd \${D%/design/dist/design} && ./setup" if [ ! -x "$D" ]; then _RC=missing elif [ ! "$_DC" -nt "$D" ] || [ "$(cat "$_DC")" != "$_DK" ]; then _dt "$D" >/dev/null 2>&1 "$_DC" 2>/dev/null ;; - missing) echo "DESIGN_NOT_AVAILABLE: $D is not installed. $_FIX" ;; - 124|142) echo "DESIGN_NOT_AVAILABLE: $D timed out after 10s at launch" ;; - 125) echo "DESIGN_NOT_AVAILABLE: no timeout, gtimeout or perl to bound the $D launch check" ;; - 137) echo "DESIGN_NOT_AVAILABLE: $D exited 137 (killed at launch; on macOS usually an invalid code signature). $_FIX" ;; - *) echo "DESIGN_NOT_AVAILABLE: $D exited $_RC at launch" ;; + missing) echo "DESIGN_NOT_AVAILABLE: $D is not installed. $_F" ;; + 124|142) echo "DESIGN_NOT_AVAILABLE: $D timed out after 10s" ;; + 125) echo "DESIGN_NOT_AVAILABLE: no timeout/gtimeout/perl to bound $D" ;; + 137) echo "DESIGN_NOT_AVAILABLE: $D exited 137 (killed at launch; on macOS usually an invalid code signature). $_F" ;; + *) echo "DESIGN_NOT_AVAILABLE: $D exited $_RC" ;; esac`; } diff --git a/test/design-setup-probe.test.ts b/test/design-setup-probe.test.ts index 369c3afd6..5697a1d0b 100644 --- a/test/design-setup-probe.test.ts +++ b/test/design-setup-probe.test.ts @@ -61,7 +61,7 @@ describe('B4: DESIGN_READY requires a binary that starts', () => { expect(w.launches()).toBe(1); fs.writeFileSync(path.join(w.install, 'design/dist/design'), `#!/bin/sh\necho launched >> "${w.home}/launches"\nexit 3\n`); fs.utimesSync(path.join(w.install, 'design/dist/design'), new Date(), new Date(Date.now() + 5_000)); - expect(run(setup(), w).stdout.trim()).toBe(`DESIGN_NOT_AVAILABLE: ${w.install}/design/dist/design exited 3 at launch`); + expect(run(setup(), w).stdout.trim()).toBe(`DESIGN_NOT_AVAILABLE: ${w.install}/design/dist/design exited 3`); }); test(`${host.name}: a binary killed at launch is not ready and names the fix`, () => { @@ -86,7 +86,7 @@ describe('B4: DESIGN_READY requires a binary that starts', () => { if (found) fs.symlinkSync(found, path.join(bin, tool)); } const r = run(fenceAfter(path.join(HOSTS[0].dir('design-review'), 'SKILL.md'), '## DESIGN SETUP'), w, bin); - expect(r.stdout.trim()).toBe(`DESIGN_NOT_AVAILABLE: no timeout, gtimeout or perl to bound the ${w.install}/design/dist/design launch check`); + expect(r.stdout.trim()).toBe(`DESIGN_NOT_AVAILABLE: no timeout/gtimeout/perl to bound ${w.install}/design/dist/design`); expect(w.launches()).toBe(0); }); @@ -100,7 +100,7 @@ describe('B4: DESIGN_READY requires a binary that starts', () => { child.on('error', reject); child.on('close', () => resolve(text)); }); - expect(stdout.trim()).toBe(`DESIGN_NOT_AVAILABLE: ${w.install}/design/dist/design timed out after 10s at launch`); + expect(stdout.trim()).toBe(`DESIGN_NOT_AVAILABLE: ${w.install}/design/dist/design timed out after 10s`); }, 30_000); test('office-hours visual exploration uses the same probe', () => {