[codex] Guard cyclic inheritance walks in codegen#4261
Conversation
|
Follow-up for the OpenCode refusal-to-link blocker:
Validation:
Full OpenTUI/OpenCode rerun with the rebuilt binary still produced no binary. It timed out at the configured 1200000ms before object emission, last visible progress around |
|
Updated this PR with a follow-up fix for the new pre-object timeout from the patched OpenCode graph. Root cause: Validation:
New first blocker after this fix: |
|
Updated this PR with two more OpenCode full-graph movements. Commits:
What moved:
Validation:
Current remaining terminal result:
|
|
Updated with commit This fixes the current Focused validation: cargo test -p perry-codegen --test duplicate_function_symbols -- --nocapture
# 3 passed
cargo build -p perry
cargo build -p perry --release
# passed
./target/release/perry --version
# perry 0.5.1112
shasum -a 256 ./target/release/perry
# 8a94b6c794cb28628fe124720307030c5a8b2ee4e199f36e56038ee616f8d859 ./target/release/perryDirect OpenCode compile rerun: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-0PGQN5
/usr/bin/time -l env PERRY_PROGRESS_TIMINGS=1 \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o ./opencode-perry-native-smoke-release-export-alias \
> /tmp/perry-opencode-0PGQN5-release-export-alias.log 2>&1Result: codegen reached No binary was produced. The graph moved from 14 failed modules to 13. New first representative failure in the log is the remaining Remeda duplicate local symbol: Other remaining blockers include Actual OpenCode Perry-native still has no binary. |
|
Updated with commit This fixes the Remeda var s = ..., a = ...;
export { s as a, a as b };Before the fix, codegen emitted two value getter functions named Focused validation: cargo test -p perry-codegen --test duplicate_function_symbols -- --nocapture
# 4 passed
cargo build -p perry
cargo build -p perry --release
# passed
./target/release/perry --version
# perry 0.5.1112
shasum -a 256 ./target/release/perry
# bf40f10fa549caa1bad3a0626fdafd2e07760fc357427451821eec91be89f63d ./target/release/perryDirect OpenCode compile rerun: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-0PGQN5
/usr/bin/time -l env PERRY_PROGRESS_TIMINGS=1 \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o ./opencode-perry-native-smoke-release-value-getter-alias \
> /tmp/perry-opencode-0PGQN5-release-value-getter-alias.log 2>&1Result: codegen reached No binary was produced. New first blocker is object filename length for OpenTelemetry machine-id modules: Remaining compile/codegen failures after those include Actual OpenCode Perry-native still has no binary. |
|
Moved the OpenTelemetry object filename blocker with What changed:
Validation:
Direct OpenCode compile rerun: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-0PGQN5
rm -f /tmp/perry-opencode-0PGQN5-release-safe-obj-names.log ./opencode-perry-native-smoke-release-safe-obj-names
/usr/bin/time -l env PERRY_PROGRESS_TIMINGS=1 \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o ./opencode-perry-native-smoke-release-safe-obj-names \
> /tmp/perry-opencode-0PGQN5-release-safe-obj-names.log 2>&1Result:
Current next first blocker from Other remaining failures in that run: Actual OpenCode Perry-native still has no binary; this only moved the object filename blocker. |
|
Moved the Zod/property-receiver What changed:
Validation:
Direct OpenCode compile rerun: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-0PGQN5
rm -f /tmp/perry-opencode-0PGQN5-release-push-spread.log ./opencode-perry-native-smoke-release-push-spread
/usr/bin/time -l env PERRY_PROGRESS_TIMINGS=1 \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o ./opencode-perry-native-smoke-release-push-spread \
> /tmp/perry-opencode-0PGQN5-release-push-spread.log 2>&1Result:
Current next first blocker from Other remaining failures in that run: Actual OpenCode Perry-native still has no binary; this only moved the mixed property-receiver |
|
Moved the generated SSE What changed:
Validation: cargo test -p perry-transform async_generator_catch_route_break_does_not_emit_bare_continue -- --nocapture
# test result: ok. 1 passed; 0 failed
cargo build -p perry --release
# Finished release profile
shasum -a 256 /Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry
# 52d0e33a8760442b6f897a0edb71fa7a6e850eb349c45bfeb283c5fffe9e74caIsolated SSE compile now writes an object: PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/debug \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/debug/perry \
compile --no-link --no-auto-optimize \
/private/var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opencode-perry-source.u32cWx/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts \
-o /tmp/perry-sse-fixed
# Found 1 module(s): 1 native, 0 JavaScript
# Wrote object file: serverSentEvents_gen_ts.oFull direct OpenCode compile moved from cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-0PGQN5
PERRY_PROGRESS_TIMINGS=1 \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o ./opencode-perry-native-smoke-release-continue-route \
> /tmp/perry-opencode-0PGQN5-release-continue-route.log 2>&1Terminal result: The previous Actual OpenCode Perry-native still has no binary; the next first blocker is now |
|
Update: moved the remaining New commit: What changed:
Validation:
Full direct OpenCode graph rerun from the kept temp dir: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-0PGQN5
/usr/bin/time -l env PERRY_PROGRESS_TIMINGS=1 \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o ./opencode-perry-native-smoke-release-many-arg-closure \
> /tmp/perry-opencode-0PGQN5-release-many-arg-closure.log 2>&1Result: moved from Current next first blocker: The direct compile exited |
|
Update: fixed/moved the sole Commit: Root cause: Perry did not classify bare Fix: treat Validation:
Fresh release hashes after rebase:
Direct full OpenCode compile rerun with the fresh release binary: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-0PGQN5
/usr/bin/time -l env PERRY_PROGRESS_TIMINGS=1 \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o ./opencode-perry-native-smoke-release-dot-ns-rebased \
> /tmp/perry-opencode-0PGQN5-release-dot-ns-rebased.log 2>&1Result: moved the
New current blocker: final linker undefined symbols, no output binary:
Actual OpenCode Perry-native still has no binary. |
|
Update: moved the first final-link undefined-symbol blocker with Root cause: the CJS wrapper hoisted every Fix: CJS wrapping now resolves each require target when module-collection context is available. If the target is a native-compiled non-CJS module, the hoisted import is Validation:
Full direct graph rerun: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-0PGQN5
/usr/bin/time -l env PERRY_PROGRESS_TIMINGS=1 \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o ./opencode-perry-native-smoke-release-cjs-require-esm \
> /tmp/perry-opencode-0PGQN5-release-cjs-require-esm.log 2>&1Result: link still fails and actual OpenCode Perry-native still has no binary, but the requested first blocker moved. The previous log had 69 undefined symbols and started with: The new log has 56 undefined symbols; the The direct compile completed object writing and failed at final link in |
|
Updated #4261 with commit Root cause for the first linker undefined symbol:
Regression/validation: cargo test -p perry dotted_extensionless_relative_import_appends_extension -- --nocapture
# result: ok. 1 passed
cargo build -p perry
# result: finished successfully
PERRY_BIN=target/debug/perry ./tests/test_dotted_extensionless_import.sh
# result: PASS
PERRY_BIN=target/debug/perry ./tests/test_cjs_require_esm_namespace.sh
# result: PASS
PERRY_BIN=target/debug/perry ./tests/test_dynamic_import_self_namespace_reexport.sh
# result: PASS
cargo build -p perry --release
# result: finished successfully
PERRY_BIN=target/release/perry ./tests/test_dotted_extensionless_import.sh
# result: PASS
shasum -a 256 target/release/perry
# e3be7ae3d7738edf5e1afb79356a862f25fa048bf98ba3c3c2d1a270d9098005 target/release/perryFull graph rerun evidence: cd /Users/andrew/Documents/opentui/packages/core && \
PERRY_BIN=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
bun scripts/opencode-source-perry-smoke.ts \
--source-dir /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opencode-perry-source.u32cWx \
--perry-native --perry-check-deps --perry-verbose \
--compile-timeout-ms 1200000 --keep-temp \
--opencode-compat-disable-external-plugin-loader-import \
--opencode-compat-static-readline-import \
--opencode-compat-inline-text-import-assets \
--opencode-compat-disable-image-resizer-import \
--opencode-compat-disable-debug-agent-eval \
--opencode-compat-disable-gray-matter-js-engine-eval \
--opencode-compat-disable-shell-parser-wasm-import \
--opencode-compat-disable-msgpackr-new-function-readerResult: the old linker undefined New current first blocker: the graph now correctly resolves additional dotted modules, including Kept temp dir from the harness rerun: Actual OpenCode Perry-native still has no binary. This update only moves the |
|
Update after the OpenTUI/OpenCode no-runtime-JS guard rerun:
Validation: cargo test -p perry diagnostic_mentions_native_import_edge_for_runtime_js_module -- --nocapture
cargo test -p perry-hir --lib import -- --nocapture
cargo build -p perry
PERRY_BIN=target/debug/perry ./tests/test_runtime_js_guard_import_edge.sh
cargo build -p perry --releaseFresh release binary: OpenTUI harness rerun with the fresh release binary still does not produce an OpenCode Perry-native binary, but the false Package hint remains: Harness log: |
|
Follow-up on the current OpenTUI/OpenCode blocker after Status: the false Authoritative harness rerun with release binary sha256
I inspected the generated temp host config at Temp-only opt-in experiment: I backed up and edited only the kept temp cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-pgbLD0
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o ./opencode-perry-native-smoke-explicit-native-js-packages \
2>&1 | tee /tmp/perry-opencode-pgbLD0-explicit-native-js-packages.logThat moved the guard and exposed the first native package blocker in Small reducer: cd /tmp/perry-bun-ffi-structs-native-repro
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts -o ./repro-binReducer shape: import { defineEnum } from "bun-ffi-structs"
const Example = defineEnum({ one: 1 }, "u8")
console.log(Example.to("one"))with {
"type": "module",
"perry": {
"compilePackages": ["bun-ffi-structs"],
"allow": { "compilePackages": ["bun-ffi-structs"] }
}
}Root source in var backend = await loadBackend();
async function loadBackend() {
if (typeof process !== "undefined" && "bun" in process.versions) {
return createBunBackend(await importModule("bun:ffi"));
}
try {
return createNodeBackend(await importModule("node:ffi"));
} catch (error) { ... }
}
function importModule(specifier) {
return import(specifier).then((module) => module.default ?? module);
}I also probed a direct Latest authoritative coordinator rerun command remains: cd /Users/andrew/Documents/opentui/packages/core && \
PERRY_BIN=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
bun scripts/opencode-source-perry-smoke.ts \
--source-dir /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opencode-perry-source.u32cWx \
--perry-native --perry-check-deps --perry-verbose \
--compile-timeout-ms 1200000 --keep-temp \
--opencode-compat-disable-external-plugin-loader-import \
--opencode-compat-static-readline-import \
--opencode-compat-inline-text-import-assets \
--opencode-compat-disable-image-resizer-import \
--opencode-compat-disable-debug-agent-eval \
--opencode-compat-disable-gray-matter-js-engine-eval \
--opencode-compat-disable-shell-parser-wasm-import \
--opencode-compat-disable-msgpackr-new-function-reader |
|
Update: pushed Root cause: Fix: lower no-init exported identifier vars through the normal var-decl path and register the named export/exported object. Added Validation:
Full graph evidence with corrected OpenTUI win32 FFI guard:
Current next blocker: final native link still fails, first undefined is |
|
Update after What changed:
Validation:
Direct OpenCode graph compile validation: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-xptSVW
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-xptSVW/opencode-perry-native-smoke-ns-dedupeResult:
Current first linker undefined symbol: Next visible related symbols include |
|
Updated with What changed:
Validation:
Release binary:
Direct OpenCode compile result:
Moved blocker:
Current next first blocker:
Actual OpenCode Perry-native still has no binary and no product truth proof. |
|
Update after commit
|
|
Remeda Root cause: the compile import map kept an old compatibility entry keyed by an imported symbol's exported name. In the Remeda shape: import { a as n, c as a } from "./chunk-ANXBDSUI.js"
import { a as t } from "./chunk-WIMGWYZL.js"the later Validation:
Full direct OpenCode compile: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-xptSVW
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize entry.ts \
-o /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-xptSVW/opencode-perry-native-smoke-remeda-alias-compatLog: Result: reached final native link, no output binary. The previous Remeda undefined symbol Remaining visible linker symbols after that are Zod Actual OpenCode Perry-native still has no binary/product proof. |
|
Update for the y18n linker blocker:
New first blocker after this fix: final native link undefineds now start with Zod |
|
Update: moved the Zod reserved-name export linker blocker. New commit on this branch:
What changed:
Validation:
Focused compiler-path check:
Full direct OpenCode compile rerun: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-xptSVW
/usr/bin/time -p sh -c 'PERRY_NO_CACHE=1 PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release /Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry compile -v --no-auto-optimize entry.ts -o /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-xptSVW/opencode-perry-native-smoke-zod-reserved-alias' > /tmp/perry-opencode-opentui-native-zod-reserved-alias.log 2>&1Result:
New current first linker blocker: Actual OpenCode Perry-native still has no binary/product proof. |
|
Updated with What changed:
Focused validation:
Release binary:
Full direct OpenCode graph rerun: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-xptSVW
/usr/bin/time -p sh -c 'PERRY_NO_CACHE=1 PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release /Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry compile -v --no-auto-optimize entry.ts -o /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-xptSVW/opencode-perry-native-smoke-undici-dispatcher-canonical-class' > /tmp/perry-opencode-opentui-native-undici-dispatcher-canonical-class.log 2>&1Result:
Actual OpenCode Perry-native still has no binary; this only moves the Undici dispatcher method linker blocker. |
|
Update for the Effect Committed/pushed Diagnosis:
Validation:
Full graph rerun caveat from this worker:
Coordinator rerun command should use the existing OpenTUI harness and include the Win32 FFI no-op flag: cd /Users/andrew/Documents/opentui/packages/core && \
PERRY_BIN=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
bun scripts/opencode-source-perry-smoke.ts \
--source-dir /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opencode-perry-source.u32cWx \
--perry-native --perry-check-deps --perry-verbose \
--compile-timeout-ms 1200000 --keep-temp \
--opencode-compat-disable-external-plugin-loader-import \
--opencode-compat-static-readline-import \
--opencode-compat-inline-text-import-assets \
--opencode-compat-disable-image-resizer-import \
--opencode-compat-disable-debug-agent-eval \
--opencode-compat-disable-gray-matter-js-engine-eval \
--opencode-compat-disable-shell-parser-wasm-import \
--opencode-compat-disable-msgpackr-new-function-reader \
--opencode-compat-disable-win32-ffi-console-controlActual OpenCode Perry-native still has no binary/product proof from this update. |
|
Update after the latest coordinator timeout:
Validation on this worker: cargo fmt --check
cargo test -p perry class_canonical_paths_keep_monomorph_collisions_separate -- --nocapture
cargo build -p perry
cargo build -p perry --releaseReduced OpenCode-temp smoke with rebuilt release binary: cd /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-CcHmFS && \
PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release \
/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry \
compile -v --no-auto-optimize runner-entry.ts \
-o /var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-CcHmFS/runner-entry-bin-canonical-path-mapResult: wrote Release binary for coordinator rerun: I could not run the authoritative full OpenTUI harness from this worker because direct compile of the kept temp hits |
What changed
this-as-value collector inheritance traversal, including focused cyclic-parent regression tests.Why
The OpenCode Perry-native graph moved past the previous default-stack codegen overflow, reached
codegen ... visited=2760/2760, and then exited 137 with no output binary. Reduction showed a smaller minimatch/OpenCode util graph getting stuck after codegen innative-factswork. The hang came from cyclic lowered class parent chains: helper walks such as accessor lookup andthis-as-value collection repeatedly followed the same parent closure IDs.The fix makes these inheritance walks terminate on cycles instead of treating parent chains as guaranteed trees.
Validation
cargo test -p perry-codegen cyclic_parent_chain -- --nocapturepassed: 3 tests.cargo build -p perry --releasepassed./var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-mLd9EePERRY_NO_CACHE=1 PERRY_CODEGEN_THREADS=1 PERRY_RUNTIME_DIR=/Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release /Users/andrew/.codex/worktrees/perry-opencode-compile-timeout/target/release/perry compile -v --no-auto-optimize minimatch-core-entry.ts -o /tmp/perry-minimatch-rebased-binSTATUS=0, wrote/tmp/perry-minimatch-rebased-bin, 20.6 MB, max RSS 764887040.✗ 24 module(s) failed to compile — REFUSING TO LINKarray.push_spread expects exactly 1 arg, got 2,continue statement outside any loop, and one@__perry_ns__undefined-value clang failure.This PR does not complete the OpenTUI/OpenCode migration. Actual OpenCode Perry-native still has no binary and no UI/input/update/teardown proof.