From e770191e564d3fcde21dc819604fe5787c272c43 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 12 Mar 2026 14:07:32 +0000 Subject: [PATCH 1/3] fix: transpile() does not throw on <4 stack outputs (#584) Replace silent ?? '0' fallbacks with an explicit length check that throws when the DYADIC stack holds fewer than 4 values at program termination. isValid() in the evolution pipeline now correctly rejects underflow programs instead of silently scoring them as valid with zeroed outputs. Co-Authored-By: Claude Sonnet 4.6 --- tools/push3-transpiler/src/transpiler.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/push3-transpiler/src/transpiler.ts b/tools/push3-transpiler/src/transpiler.ts index 4f13c17..9924769 100644 --- a/tools/push3-transpiler/src/transpiler.ts +++ b/tools/push3-transpiler/src/transpiler.ts @@ -391,10 +391,15 @@ export function transpile(program: Node): TranspileResult { processItems(program.items, state); // Pop 4 outputs: top → ci, then anchorShare, anchorWidth, discoveryDepth. - const ciVar = state.dStack.pop() ?? '0'; - const anchorShareVar = state.dStack.pop() ?? '0'; - const anchorWidthVar = state.dStack.pop() ?? '0'; - const discoveryDepthVar = state.dStack.pop() ?? '0'; + if (state.dStack.length < 4) { + throw new Error( + `Program must leave exactly 4 values on the DYADIC stack; found ${state.dStack.length}`, + ); + } + const ciVar = state.dStack.pop()!; + const anchorShareVar = state.dStack.pop()!; + const anchorWidthVar = state.dStack.pop()!; + const discoveryDepthVar = state.dStack.pop()!; return { functionBody: state.lines, ciVar, anchorShareVar, anchorWidthVar, discoveryDepthVar }; } From 5dffed123deb4f6a9fb2870bc42f026f00a26db0 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 12 Mar 2026 14:19:01 +0000 Subject: [PATCH 2/3] ci: retrigger after infra failure From 403a304c9844cc1e76335cd5e10c495fd09f91d1 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 12 Mar 2026 14:48:15 +0000 Subject: [PATCH 3/3] fix: tighten stack-depth guard to !== 4 to catch overflow (#584) Reviewer noted that `< 4` only catches underflow; programs leaving 5+ values on the DYADIC stack silently passed isValid(). Change the guard to `!== 4` so both under- and overflow are rejected, matching the documented 'exactly 4 outputs' contract. Co-Authored-By: Claude Sonnet 4.6 --- tools/push3-transpiler/src/transpiler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/push3-transpiler/src/transpiler.ts b/tools/push3-transpiler/src/transpiler.ts index 9924769..fe4a5bb 100644 --- a/tools/push3-transpiler/src/transpiler.ts +++ b/tools/push3-transpiler/src/transpiler.ts @@ -391,7 +391,7 @@ export function transpile(program: Node): TranspileResult { processItems(program.items, state); // Pop 4 outputs: top → ci, then anchorShare, anchorWidth, discoveryDepth. - if (state.dStack.length < 4) { + if (state.dStack.length !== 4) { throw new Error( `Program must leave exactly 4 values on the DYADIC stack; found ${state.dStack.length}`, );