- Marked MIR builder modularization as completed
- Added completion dates and commit hashes
- Updated next priority tasks from copilot_issues.txt
- Cleaned up completed task descriptions
- Extracted 29 instruction handlers from 691-line execute_instruction function
- Created vm_instructions.rs module for better code organization
- Deleted legacy execute_instruction_old function (691 lines removed)
- Reduced vm.rs from 2075 to 1382 lines (33% reduction)
Benefits:
- Each instruction handler is now independently testable
- Improved maintainability and readability
- Easier to add new VM instructions
- Better separation of concerns
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive dual-mode design document (script vs application mode)
- Update phase 9.8 documentation with implementation progress
- Enhance VM with improved error handling and debugging
- Add MIR verification improvements
- Add test cases for MIR/VM POC
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Add early TypeOp lowering in build_expression for method-style is()/as()
- Add early TypeOp lowering in build_expression for function-style isType()/asType()
- Add special handling in build_print_statement for print(isType/asType(...))
- Fix MIR optimizer borrow checker issues and remove obsolete BoxFieldLoad
- Extract string literal helper supports both direct literals and StringBox wrappers
- Note: isType call generation still has issues (undefined SSA value in print)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive tests for TypeOp (Check/Cast) instructions
- Add tests for WeakRef creation and upgrade behavior
- Add tests for legacy TypeCheck/Cast instruction compatibility
- Verify VM execution with new MIR instructions
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed me ValueId inconsistency in static box methods
- Previously, each me reference generated a new const __me__ ValueId
- Now caches the first me ValueId in variable_map for reuse
- This ensures RefSet and RefGet operate on the same object
- ArrayBox get/set/push now working correctly in VM mode
- Test results: 1, 42, 3 (as expected)
🔧 Technical Details:
- build_me_expression() now stores fallback ValueId in variable_map
- Subsequent me references reuse the same ValueId
- VM BoxCall debug logs confirm ArrayBox methods dispatch correctly
Co-Authored-By: ChatGPT5
Co-Authored-By: Claude <noreply@anthropic.com>
- Document dynamic type conversion implementations
- Add test results for Integer non-zero conditions
- Update ArrayBox/MapBox VM method support status
- Record SocketBox timeout method implementations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add dynamic bool conversion for BoxRef(BoolBox)→bool and BoxRef(VoidBox)→false
- Implement String concatenation with Bool and BoxRef types via toString()
- Add Void/Bool comparison support (Eq/Ne only) to prevent VM crashes
- Implement comprehensive ArrayBox methods in VM:
- push/pop/length/get/set/remove
- contains/indexOf/clear/join/sort/reverse/slice
- Implement comprehensive MapBox methods in VM:
- set/get/has/delete/keys/values/size/clear
- Add SocketBox timeout methods (acceptTimeout/recvTimeout)
- Update VM documentation with all new operations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add Void/Bool comparison support (Eq/Ne only) to prevent VM crashes
- Implement BoolBox→bool coercion in as_bool() for branch conditions
- Add VoidBox→false coercion for nullish false behavior
- Support String+BoxRef concatenation with automatic toString()
- Add PluginBoxV2 toString() support for debugging
- Add legacy ResultBox method support for compatibility
This fixes VM execution errors with plugin methods returning Result types
and enables proper string concatenation with plugin boxes.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Add e2e_vm_http_status_404/500 tests to verify HTTP status handling
- ResultBox properly returns Ok(Response) for HTTP errors, Err for connection failures
- Create dynamic-plugin-flow.md documenting MIR→VM→Registry→Plugin flow
- Add vm-stats test files for HTTP 404/500 status codes
- Update net-plugin.md with HTTP error handling clarification
- Create E2E_TESTS.md documenting all E2E test behaviors
- Add mir-26-instruction-diet.md for MIR optimization plans
- Add vm-stats-cookbook.md for VM statistics usage guide
- Update MIR verifier to properly track self-assignment patterns
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix MIR builder to correctly return phi values in if-else statements
- Add extract_assigned_var helper to handle Program blocks
- Update variable mapping after phi node creation
- Fixes 'Value %14 not set' error in e2e_vm_http_client_error_result
- Fix HTTP plugin error handling for connection failures
- Return error string instead of handle on tcp_ok=false
- Enable proper ResultBox(Err) creation for failed connections
- Now r.isOk() correctly returns false for connection errors
- Add VM fallback for toString() on any Box type
- Ensures error messages can be displayed even without specific implementation
- All e2e_vm_http_client_error_result tests now pass
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
✅ All E2E tests passing:
- e2e_vm_plugin_filebox_copy_from_handle: Handle arguments (tag=8) working
- e2e_vm_http_get_basic: GET with ResultBox.get_value() working
- e2e_vm_http_post_and_headers: POST with status/headers/body verified (201:V:R)
Key achievement:
- VM already had ResultBox methods (is_ok/get_value/get_error) implemented
- HTTP plugin methods now correctly return values through ResultBox
- Full VM×Plugin integration verified
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add VM instruction statistics (--vm-stats, --vm-stats-json)
- Fix missing fields in ast.rs test code (public_fields, private_fields)
- Add CliConfig fields for VM statistics
- Enable TLV debug logging in plugin_loader_v2
- Successfully test FileBox handle passing and HTTP plugin creation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Major changes:
- Add --vm-stats and --vm-stats-json CLI flags for VM instruction profiling
- Implement instruction counting by opcode type with JSON output support
- Add enhanced TLV debug logging with NYASH_DEBUG_PLUGIN=1 environment variable
- Fix missing fields in CliConfig and ASTNode::BoxDeclaration for test compatibility
- Improve plugin method call error messages with argument count/type details
This enables MIR→VM conversion health checks and supports the Phase 8.6 VM optimization goals.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add VM→Plugin and Plugin→VM boundary logging for method calls
- Enhanced debug output for tracking plugin invocation flow
- Added return value type/instance logging for better debugging
- Improved plugin communication traceability
This helps debug issues like the recent 45-day HTTP response debugging saga.
All logging is controlled by NYASH_DEBUG_PLUGIN=1 environment variable.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixed the method ID order in HttpRequestBox configuration to match plugin implementation:
- path: method_id 1 (was incorrectly 2)
- readBody: method_id 2 (was incorrectly 3)
- respond: method_id 3 (was incorrectly 1)
This resolves the 45-day debugging issue where req.respond(resp) was calling
the wrong plugin method, causing HTTP responses to have empty bodies.
All E2E tests now pass:
- e2e_http_stub_end_to_end ✅
- e2e_http_multiple_requests_order ✅
- e2e_http_post_and_headers ✅
- e2e_http_server_restart ✅
- e2e_http_server_shutdown_and_restart ✅🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add returns_result=true configuration for HTTP server methods
- Fix ResultBox downcasting in interpreter calls
- Improve HTTP plugin with server_id tracking and response ID hints
- Add TCP connection support with fallback to stub mode
- Implement response ID mapping improvements
- Fix various race conditions in concurrent request handling
This partially addresses the HTTP response body empty issue, though
ID mapping still needs further refinement.
Co-Authored-By: ChatGPT5 <noreply@openai.com>
Co-Authored-By: Claude <noreply@anthropic.com>
- Add returns_result = true to HttpServerBox methods (start, stop, accept)
- Update all E2E tests to use .get_value() for Result handling
- Prepare for gradual Result-based error handling migration
This implements the first phase of ChatGPT5's Result正規化 design,
starting with network-related methods as agreed.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add returns_result.md documenting Result正規化 (returns_result = true)
- Add when-pattern-matching.md with future pattern matching syntax design
- Update E2E tests to use get_value() for HTTP responses
- Update plugin system README with B案 (Result-based) support
- Remove singleton from HttpServerBox and SocketServerBox for stability
This prepares for gradual migration to Result-based error handling,
starting with Net plugin methods, as agreed with ChatGPT5's design.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add e2e_plugin_net_additional.rs with parallel server tests
- Fix test to properly handle request objects (no double accept)
- Add comprehensive net-plugin documentation
- Implement debug tracing for method calls
- Enhance plugin lifecycle documentation
- Improve error handling in plugin loader
- Add leak tracking infrastructure (for future use)
- Update language spec with latest plugin features
This enhances test coverage for concurrent HTTP servers and improves
the overall plugin system documentation and debugging capabilities.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix path parsing for absolute URLs (http://...) in net plugin
- Add Integer(tag=5) i64 compatibility for port arguments
- Implement proper accept() wait loop (up to 5 seconds)
- Add start_seq for reliable server routing
- Remove singleton pattern from HTTP/Socket servers
- Add Socket E2E tests with timeout support
- Enable NYASH_NET_LOG environment variable for debugging
All 5 HTTP E2E tests now pass consistently\!
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add e2e_http_post_and_headers: Full POST request with headers test
- Verify client POST with body data ('DATA')
- Server reads request body and responds with custom status (201)
- Custom headers (X-Test: V) properly set and retrieved
- Complete request/response cycle validation: '201:V:R' ✅
- All 4 HTTP plugin tests passing
HTTP POSTとヘッダー操作のE2Eテスト追加
- POSTリクエストのボディ送受信確認
- カスタムステータスコード(201 Created)
- HTTPヘッダーの設定と取得
- 完全なHTTPプロトコル機能の検証
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Add e2e_http_server_restart: Verify server can stop/start and handle requests (returns 'B')
- Add e2e_http_server_shutdown_and_restart: Verify plugin shutdown/reinit works (returns 'Y')
- Fix active server tracking with ACTIVE_SERVER_ID for proper request routing
- All 3 HTTP plugin E2E tests now passing ✅
HTTPサーバー再起動とシャットダウンテスト追加
- サーバーのstop/start再起動が正常動作
- プラグインshutdown後の再初期化も確認
- アクティブサーバー管理で適切なリクエストルーティング実現
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Implement full HTTP flow test: server → client → accept → respond → readBody
- All HTTP Box types working correctly (HttpServerBox, HttpClientBox, HttpRequestBox, HttpResponseBox)
- Handle type encoding for plugin method arguments working properly
- Test validates complete HTTP request/response cycle
- Net plugin E2E test passing ✅
HTTPネットワークプラグインのE2Eテスト追加
- サーバー起動からレスポンス読み取りまでの完全なフロー検証
- Handle型引数のTLVエンコーディングも正常動作
- 非同期HTTPフローの完全動作確認
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Add singleton support for plugin boxes (e.g., CounterBox)
- Implement shutdown_plugins_v2() for controlled plugin lifecycle
- Plugin instances now shared across multiple new() calls
- Shutdown properly releases and allows re-initialization
- All singleton E2E tests passing ✅
ChatGPT5による高度なプラグインライフサイクル管理実装
- シングルトンパターンでプラグインインスタンス共有
- 明示的なshutdownでリソース解放と再初期化対応
- Nyashの統一ライフサイクルポリシー維持
Note: ast.rs test failures are due to rapid development pace -
tests need updating for new BoxDeclaration fields (private_fields, public_fields)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Add reserved name guard test to prevent non-builtin factories from hijacking builtin names
- Add Handle TLV encoding/decoding test for FileBox copyFrom method
- Add CounterBox plugin tests for inc/get operations and clone/share behavior
- All unified registry E2E tests passing ✅
統一レジストリシステムの包括的なE2Eテスト追加
- ビルトイン名保護テスト
- Handle型TLVエンコーディングテスト
- CounterBoxプラグインテスト
- 全テスト成功確認
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>