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>
This commit is contained in:
nyash-codex
2025-11-08 17:04:21 +09:00
parent 2dcb89a3b7
commit 50ac8af2b8
31 changed files with 699 additions and 133 deletions

View File

@ -15,6 +15,10 @@ NYASH_DISABLE_PLUGINS = "1"
## コア運用セット(最小)
- NYASH_CLI_VERBOSE: CLI の詳細ログ("1" で有効)
- NYASH_DISABLE_PLUGINS: 外部プラグインを無効化CI/再現性向上)
- NYASH_BOX_FACTORY_POLICY: Box生成の優先順位制御Phase 21.4推奨ENV
- `builtin_first`: Builtin優先Analyzer推奨、デフォルト
- `strict_plugin_first`: Plugin最優先開発・本番環境
- `compat_plugin_first`: Plugin > Builtin > User互換モード
## JIT共通
- NYASH_JIT_THRESHOLD: JIT 降下開始の閾値(整数)
@ -77,3 +81,49 @@ NYASH_DISABLE_PLUGINS = "1"
- NYASH_MIR_REF_BOXCALL: RefGet/Set → BoxCall 変換を有効化
- NYASH_MIR_CORE13: Core13 セットの一括有効(将来拡張)
- NYASH_MIR_CORE13_PURE: Core13 純化モード("1" で有効。最終MIRは13命令のみ許可され、Load/Store などは `env.local.get/set``new``env.box.new` 経由へ強制正規化。禁制命令が残存するとコンパイルエラーで早期失敗。
## 非推奨ENV変数Phase 21.4で段階的削除)
以下の環境変数は **非推奨** です。新しい統一ENV変数を使用してください
### ❌ NYASH_USE_PLUGIN_BUILTINS削除予定
- **理由**: 自動設定による混乱、新しいポリシーシステムで代替
- **代替**: `NYASH_BOX_FACTORY_POLICY=strict_plugin_first` または `compat_plugin_first`
- **状態**: Phase 21.4で自動設定を削除、警告メッセージを表示
- **完全削除**: Phase 22で参照も含めて完全削除予定
### ❌ NYASH_PLUGIN_OVERRIDE_TYPES削除予定
- **理由**: 自動設定による不整合、FactoryPolicy で統一管理
- **代替**: `NYASH_BOX_FACTORY_POLICY` で全体的な優先順位を制御
- **状態**: Phase 21.4で自動設定を削除、警告メッセージを表示
- **完全削除**: Phase 22で参照も含めて完全削除予定
### 移行ガイド
#### Before (非推奨)
```bash
# ❌ 古い方法(自動設定に依存)
NYASH_USE_PLUGIN_BUILTINS=1 ./target/release/nyash program.hako
NYASH_PLUGIN_OVERRIDE_TYPES="ArrayBox,MapBox" ./target/release/nyash program.hako
```
#### After (推奨)
```bash
# ✅ 新しい方法(統一ポリシー)
# Analyzer環境Builtin優先
NYASH_BOX_FACTORY_POLICY=builtin_first ./target/release/nyash program.hako
# 開発・本番環境Plugin優先
NYASH_BOX_FACTORY_POLICY=strict_plugin_first ./target/release/nyash program.hako
# プラグイン完全無効CI/検証)
NYASH_DISABLE_PLUGINS=1 ./target/release/nyash program.hako
```
#### FileBox専用制御
```bash
# ✅ FileBox providerの明示的制御
NYASH_FILEBOX_MODE=auto ./target/release/nyash program.hako # 自動選択(デフォルト)
NYASH_FILEBOX_MODE=core-ro ./target/release/nyash program.hako # Builtin core-ro固定
NYASH_FILEBOX_MODE=plugin-only ./target/release/nyash program.hako # Plugin必須Fail-Fast
```