fix: resolve awaited Worker path helpers and return unions - #10239
proggeramlug wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughWorker path discovery now supports awaited sync and async helpers, conditional return unions, missing-candidate skipping, and runtime filename dispatch. Compilation preserves URL and path aliases, while runtime construction throws when no compiled candidate matches. ChangesWorker path resolution
Priority: ⬆️ High Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix · Severity of issue fixed: High Sequence Diagram(s)sequenceDiagram
participant WorkerPathHelper
participant collect_modules
participant resolve_candidates
participant lower_candidates
participant WorkerRuntime
WorkerPathHelper->>collect_modules: return awaited and conditional path candidates
collect_modules->>resolve_candidates: resolve candidate files
resolve_candidates-->>collect_modules: compiled entries and skipped missing candidates
collect_modules->>lower_candidates: lower multiple worker paths
lower_candidates->>WorkerRuntime: dispatch by normalized runtime filename
WorkerRuntime-->>lower_candidates: matched worker or runtime error
Merge Risk: ⚪ Minimal · up to The worker-path changes and their cross-layer behavior are covered without a concrete merge-blocking issue. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 47.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 8 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
OpenCode's TUI computes its worker filename with
const file = await target(), wheretargetis async and contains severalif/returnbranches. Perry rejected both the await and the helper body, leaving the Worker constructor as a runtime throw. Module discovery and codegen also required exactly one filename.Follow awaits and collect the union of return paths from sync/async helpers with const path bindings and if/return bodies. Conditions are inspected for direct mutation but never evaluated; opaque awaited probes are allowed. Returned opaque calls, unsupported statements, generators, recursion, URL coercion, and expansion limits remain guarded.
Skip missing candidates with a warning, deduplicate worker entries by canonical file, and dispatch multiple candidates using the runtime string or URL filename. A missing selection throws instead of starting another candidate. Eval-source Worker behavior is unchanged.
Validation (Linux lane only):
cargo test -p perry-hir: 663 passed, 3 ignored.perry-ext-netbuilt together successfully.cargo test --release -p perrywith the new Worker path helper: resolveawait helper()and if/return helper bodies (OpenCode TUI worker:const file = await target(); new Worker(file)) #10236 regression and the five existing worker-related test targets: 23 passed, 1 pre-existing cluster test ignored. Covers both runtime choices, URL filenames with spaces, absent candidates, opaque returns, and recursion.cargo fmt --all -- --check,scripts/check_file_size.sh, and Node version consistency check passed.src/cli/cmd/tui.ts, from the package directory with itsperry.json, using--platform bun --no-link --no-cache:The unsupported-expression warning is gone. This check was intentionally stopped after worker discovery; the full OpenCode graph compile remains with the coordinator.
Refs #10107.
Fixes #10236
Summary by CodeRabbit
New Features
Bug Fixes
Tests