Commit Graph

13 Commits

Author SHA1 Message Date
f9d100ce01 chore: Phase 25.1 完了 - LoopForm v2/Stage1 CLI/環境変数削減 + Phase 26-D からの変更
Phase 25.1 完了成果:
-  LoopForm v2 テスト・ドキュメント・コメント完備
  - 4ケース(A/B/C/D)完全テストカバレッジ
  - 最小再現ケース作成(SSAバグ調査用)
  - SSOT文書作成(loopform_ssot.md)
  - 全ソースに [LoopForm] コメントタグ追加

-  Stage-1 CLI デバッグ環境構築
  - stage1_cli.hako 実装
  - stage1_bridge.rs ブリッジ実装
  - デバッグツール作成(stage1_debug.sh/stage1_minimal.sh)
  - アーキテクチャ改善提案文書

-  環境変数削減計画策定
  - 25変数の完全調査・分類
  - 6段階削減ロードマップ(25→5、80%削減)
  - 即時削除可能変数特定(NYASH_CONFIG/NYASH_DEBUG)

Phase 26-D からの累積変更:
- PHI実装改善(ExitPhiBuilder/HeaderPhiBuilder等)
- MIRビルダーリファクタリング
- 型伝播・最適化パス改善
- その他約300ファイルの累積変更

🎯 技術的成果:
- SSAバグ根本原因特定(条件分岐内loop変数変更)
- Region+next_iパターン適用完了(UsingCollectorBox等)
- LoopFormパターン文書化・テスト化完了
- セルフホスティング基盤強化

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: ChatGPT <noreply@openai.com>
Co-Authored-By: Task Assistant <task@anthropic.com>
2025-11-21 06:25:17 +09:00
fa3091061d trace: add execution route visibility + debug passthrough; phase2170 canaries; docs
- Add HAKO_TRACE_EXECUTION to trace executor route
  - Rust hv1_inline: stderr [trace] executor: hv1_inline (rust)
  - Hakovm dispatcher: stdout [trace] executor: hakovm (hako)
  - test_runner: trace lines for hv1_inline/core/hakovm routes
- Add HAKO_VERIFY_SHOW_LOGS and HAKO_DEBUG=1 (enables both)
  - verify_v1_inline_file() log passthrough with numeric rc extraction
  - test_runner exports via HAKO_DEBUG
- Canary expansion under phase2170 (state spec)
  - Array: push×5/10 → size, len/length alias, per‑recv/global, flow across blocks
  - Map: set dup-key non-increment, value_state get/has
  - run_all.sh: unify, remove SKIPs; all PASS
- Docs
  - ENV_VARS.md: add Debug/Tracing toggles and examples
  - PLAN.md/CURRENT_TASK.md: mark 21.7 green, add Quickstart lines

All changes gated by env vars; default behavior unchanged.
2025-11-08 23:45:29 +09:00
50ac8af2b8 Phase 21.4 Complete: FileBox SSOT + Analyzer Stabilization (7 Tasks)
 Task 1: Fallback Guarantee (create_box failure → ring1/core-ro auto fallback)
- Three-tier fallback system: plugin → builtin → core-ro
- Mode control: auto/plugin-only/core-ro
- New: src/box_factory/builtin_impls/file_box.rs
- New: tools/test_filebox_fallback_smoke.sh

 Task 2: Provider Registration SSOT (static/dynamic/core-ro unified)
- ProviderFactory trait with priority-based selection
- Global registry PROVIDER_FACTORIES implementation
- Priority: dynamic(100) > builtin(10) > core-ro(0)
- New: src/boxes/file/builtin_factory.rs
- New: tools/smoke_provider_modes.sh

 Task 3: FileBox Publication Unification
- Verified: basic/file_box.rs already minimized (11 lines)
- Perfect re-export pattern maintained

 Task 4: ENV Unification (FILEBOX_MODE/DISABLE_PLUGINS priority)
- Removed auto-setting of NYASH_USE_PLUGIN_BUILTINS
- Removed auto-setting of NYASH_PLUGIN_OVERRIDE_TYPES
- Added deprecation warnings with migration guide
- ENV hierarchy: DISABLE_PLUGINS > BOX_FACTORY_POLICY > FILEBOX_MODE

 Task 5: Error Log Visibility (Analyzer rule execution errors to stderr)
- Added [rule/exec] logging before IR-based rule execution
- Format: [rule/exec] HC012 (dead_static_box) <filepath>
- VM errors now traceable via stderr output

 Task 6: Unnecessary Using Removal (14 rules Str alias cleanup)
- Removed unused `using ... as Str` from 14 rule files
- All rules use local _itoa() helper instead
- 14 lines of dead code eliminated

 Task 7: HC017 Skip & TODO Documentation (UTF-8 support required)
- Enhanced run_tests.sh with clear skip message
- Added "Known Limitations" section to README.md
- Technical requirements documented (3 implementation options)
- Re-enable timeline: Phase 22 (Unicode Support Phase)

📊 Test Results:
- Analyzer: 10 tests PASS, 1 skipped (HC017)
- FileBox fallback: All 3 modes PASS
- Provider modes: All 4 modes PASS
- Build: Success (0 errors, 0 warnings)

🎯 Key Achievements:
- 28 files modified/created
- Three-Tier Fallback System (stability)
- SSOT Provider Registry (extensibility)
- ENV unification (operational clarity)
- Error visibility (debugging efficiency)
- Code cleanup (maintainability)
- Comprehensive documentation (Phase 22 ready)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 17:04:21 +09:00
cef820596f FileBox SSOT設計移行完了: Provider Pattern実装
## 🎯 目的
FileBoxをSSOT(Single Source of Truth)設計に移行し、
static/dynamic/builtin providerを統一的に扱える基盤を構築。

##  実装完了(7タスク)

### 1. Provider Lock Global
**File**: `src/runtime/provider_lock.rs`
- `FILEBOX_PROVIDER: OnceLock<Arc<dyn FileIo>>` 追加
- `set_filebox_provider()` / `get_filebox_provider()` 実装

### 2. VM初期化時のProvider選択
**File**: `src/runner/modes/vm.rs`
- `execute_vm_mode()` 冒頭でprovider選択・登録
- ENV(`NYASH_FILEBOX_MODE`, `NYASH_DISABLE_PLUGINS`)対応

### 3. CoreRoFileIo完全実装
**File**: `src/boxes/file/core_ro.rs` (NEW)
- Read-onlyファイルI/O実装
- Thread-safe: `RwLock<Option<File>>`
- Newline正規化(CRLF→LF)

### 4. FileBox委譲化
**File**: `src/boxes/file/mod.rs`
- 直接`std::fs::File`使用 → `Arc<dyn FileIo>` provider委譲
- 全メソッドをprovider経由に変更
- Fail-Fast: write/delete等の非対応操作は明確エラー

### 5. basic/file_box.rs Deprecate
**File**: `src/boxes/file/basic/file_box.rs`
- 120行 → 12行に削減
- `#[deprecated]` マーク + 再エクスポート
- 後方互換性維持

### 6. Feature Flag追加
**File**: `Cargo.toml`
- `builtin-filebox = []` feature追加

### 7. Provider抽象・選択ロジック
**Files**:
- `src/boxes/file/provider.rs` (NEW) - FileIo trait定義
- `src/boxes/file/box_shim.rs` (NEW) - 薄いラッパー
- `src/runner/modes/common_util/provider_registry.rs` (NEW) - 選択ロジック

## 📊 アーキテクチャ進化

**Before**:
```
FileBox (mod.rs) ──直接使用──> std::fs::File
FileBox (basic/)  ──直接使用──> std::fs
```

**After**:
```
FileBox ──委譲──> Arc<dyn FileIo> ──実装──> CoreRoFileIo
                                        ├──> PluginFileIo (future)
                                        └──> BuiltinFileIo (future)
```

## 🔧 技術的成果

1. **Thread Safety**: `RwLock<Option<File>>` で並行アクセス安全
2. **Fail-Fast**: 非対応操作は明確エラー(silent failure無し)
3. **後方互換性**: deprecated re-exportで既存コード維持
4. **環境制御**: `NYASH_FILEBOX_MODE` でランタイム切替

## 📝 環境変数

- `NYASH_FILEBOX_MODE=auto|core-ro|plugin-only`
  - `auto`: プラグインあれば使用、なければCoreRoにフォールバック
  - `core-ro`: 強制的にCoreRo(read-only)
  - `plugin-only`: プラグイン必須(なければFail-Fast)
- `NYASH_DISABLE_PLUGINS=1`: 強制的にcore-roモード

## 🎯 次のステップ(Future)

- [ ] Dynamic統合(plugin_loaderとの連携)
- [ ] BuiltinFileIo実装(feature builtin-filebox)
- [ ] Write/Delete等の操作対応(provider拡張)

## 📚 ドキュメント

- 詳細仕様: `docs/development/runtime/FILEBOX_PROVIDER.md`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 15:13:22 +09:00
adbb0201a9 chore(fmt): add legacy stubs and strip trailing whitespace to unblock cargo fmt 2025-09-17 07:43:07 +09:00
a37fc9709c 🔧 Phase 9.75D: Fix 74 compilation errors - complete share_box() trait implementation
## Summary
- Fixed 74 compilation errors related to missing/misplaced share_box() methods
- Implemented complete NyashBox trait for all Box types across the codebase
- Updated extern_box.rs to modern trait structure

## Changes Made

### Core trait fixes (17 files):
-  Fixed syntax errors: moved share_box() methods to correct positions
-  Added missing share_box() implementations in 17 files
-  Updated extern_box.rs with proper BoxCore and NyashBox implementations

### Files modified:
**Core trait system:**
- src/box_trait.rs: Added share_box() for 7 basic Box types
- src/box_arithmetic.rs: Added share_box() for 4 arithmetic Box types
- src/instance.rs, src/channel_box.rs, src/exception_box.rs: Added missing methods
- src/method_box.rs, src/type_box.rs: Complete trait implementations

**Box implementations (20+ files):**
- All boxes in src/boxes/ directory: Fixed share_box() positioning
- extern_box.rs: Modernized to current trait structure
- Web boxes: Fixed WASM-specific implementations

### Implementation pattern:
```rust
/// 仮実装: clone_boxと同じ(後で修正)
fn share_box(&self) -> Box<dyn NyashBox> {
    self.clone_box()
}
```

## Result
-  `cargo check` now passes successfully (only warnings remain)
-  All NyashBox trait implementations complete
-  Ready for Phase 9.75D VM/WASM backend work
-  "Everything is Box" philosophy maintained

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-15 14:29:47 +09:00
cdcfa98dd1 🔧 Phase A: Add share_box() method to NyashBox trait and all Box implementations
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-15 04:29:41 +00:00
e8c718c78c Phase 9.75-C: COMPLETE - All 10 Box types converted from Arc<Mutex> to RwLock
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-15 01:21:37 +00:00
2464e555dd 🚀 feat: ビルトインBox継承システム完全実装
## 🎯 主要機能
- `box ChatNode from P2PBox` 構文完全対応
- 25個のビルトインBox型で継承可能に
- `from Parent.method()` デリゲーション構文実装

## 🏗️ アーキテクチャ革命
- BoxBase + BoxCore統一設計完成
- parent_type_id による継承関係管理
- as_any() 動的型システム統一実装
- Arc<Mutex>パターン全Box型適用完了

##  技術的達成
- コンパイルエラー: 42個 → 0個 (100%解決)
- ビルトイン継承: StringBox, P2PBox, MathBox等すべて対応
- 実行時型安全性: 完全保証
- Everything is Box哲学: より深化

## 🔧 主要変更ファイル
- src/box_trait.rs: BoxBase/BoxCore統一アーキテクチャ
- src/boxes/*: 全Box型にas_any()実装
- src/interpreter/: ビルトイン継承ディスパッチ実装
- docs/: 継承システム仕様書更新

🎉 Nyashが本格プログラミング言語として大きく進化!

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 15:01:11 +09:00
8892b0c006 🎉 feat: BoxBase+BoxCore革命 Phase4F-G完了 - GUI/IO/データ系Box統一達成
 新たに完了したBox型統一アーキテクチャ移行
- EguiBox: GUI機能、デスクトップアプリケーション対応 🖼️
- BufferBox: バイナリデータ処理、メモリ効率最適化 📦
- FileBox: ファイルシステム操作、安全なIO処理 📁
- JSONBox: JSON解析/操作、型情報豊富な表示 📋

🎯 累積達成: 20+Box型の統一アーキテクチャ移行完了
- 音声系: SoundBox 
- データ系: MapBox, BufferBox, JSONBox 
- UI系: EguiBox 
- IO系: FileBox 
- 数学系: MathBox, FloatBox, RangeBox 
- 時間系: TimeBox, DateTimeBox, TimerBox 
- デバッグ系: DebugBox, RandomBox 
- 基本型: String/Integer/Bool等 

🔧 統一パターン確立による効果
- unsafe ID生成完全排除 → BoxBase::new()安全化
- 一貫したfmt_box()表示システム
- CharmFlow互換性問題の根本解決
- スレッドセーフ性とメモリ安全性向上

🐱 ゆっくり丁寧なアプローチで品質確保
Phase4継続中: 残りBox型も同じ高品質で統一化

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 11:45:34 +09:00
750543be7c 🔧 refactor: すべてのBoxをArc<Mutex>パターンで統一
CopilotのBox実装を私たちのArc<Mutex>パターンで統一:
- BufferBox: Arc<Mutex<Vec<u8>>>で内部可変性を実現
- FileBox: Arc<Mutex<File>>でファイルハンドル管理
- JSONBox: Arc<Mutex<Value>>でJSON値を保持
- HttpClientBox: Arc<Mutex<Client>>でHTTPクライアント管理
- StreamBox: Arc<Mutex>でストリームバッファと位置を管理
- RegexBox: Arc<Regex>で軽量ラッパー実装

各Boxに実用的なメソッドも追加:
- BufferBox: write, read, readAll, clear, length, append, slice
- FileBox: read, write, exists, delete, copy
- JSONBox: parse, stringify, get, set, has, keys
- HttpClientBox: get, post, put, delete, request
- StreamBox: write, read, position, length, reset
- RegexBox: test, find, findAll, replace, split

interpreterに新Box用のメソッド実行を追加:
- data_methods.rs: BufferBox, JSONBox, RegexBox
- network_methods.rs: HttpClientBox, StreamBox

これでコードベース全体が一貫性のあるArc<Mutex>パターンで統一されました!

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-10 13:03:42 +09:00
e6e36ccfb0 Implement NyashBox trait for core boxes - ArrayBox, BufferBox, FileBox, JSONBox, FutureBox, StreamBox, ResultBox
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-10 03:21:24 +00:00
6f916855c8 Add core Box implementations: ArrayBox, ResultBox, FutureBox, BufferBox, FileBox, JSONBox, HttpClientBox, StreamBox, RegexBox 2025-08-10 02:45:57 +00:00