|
|
80e952b83a
|
feat(joinir): Phase 54 SELFHOST-SHAPE-GROWTH - 構造軸育成 + 偽陽性観測
Phase 53 成果を踏まえ、構造シグネチャ軸を 5+ に育て、
偽陽性観測テストで name ガード縮小準備を整えた。
方針変更: 新ループ追加 → 構造軸育成 + 偽陽性率測定に焦点変更
- 理由: Phase 53 で selfhost P2/P3 実戦パターン追加済み
- 焦点: 既存ループに対する構造軸拡張 + 精度測定
主な成果:
1. 構造軸 5+ 達成:
- carrier 数
- carrier 型
- Compare パターン
- branch 構造
- NEW: Compare op 分布 (count_compare_ops ヘルパー)
2. 偽陽性観測テスト追加:
- test_phase54_structural_axis_discrimination_p2()
- test_phase54_structural_axis_discrimination_p3()
3. 重要な発見 - 偽陽性率 ~50%:
- P2: selfhost P2 が正しく検出されず (name ガード依存)
- P3: selfhost P3 が Pattern4ContinueMinimal と誤検出 (構造的類似性)
- 結論: 構造判定のみでは分離不十分、name ガード必須と判明
変更内容:
- shape_guard.rs (+80 lines):
- count_compare_ops() 構造軸ヘルパー追加
- detect_shapes() pub 化 (テストから呼び出し可能に)
- SelfhostVerifySchemaP2/SelfhostDetectFormatP3 enum 追加 (将来用)
- normalized_joinir_min.rs (+110 lines):
- 偽陽性観測テスト 2 個追加 (P2/P3 各1)
- canonical shapes vs selfhost shapes 構造判定精度測定
- phase49 doc (+200 lines):
- Phase 54 節完成版
- 偽陽性分析結果記録
- name ガード縮小方針明記
- enum 拡張対応:
- bridge.rs (+8 lines)
- normalized.rs (+8 lines)
- ast_lowerer/mod.rs (+2 lines)
偽陽性観測結果 (2025-12-12):
- P2 構造判定: selfhost P2 検出失敗 → name ガード必須
- P3 構造判定: selfhost P3 が Pattern4 と誤判定 → 構造的類似性問題
- 総合: 偽陽性率 ~50% → 構造軸 5 本では不十分
次フェーズ方針 (Phase 55+):
- Phase 55-A: 条件複雑度軸追加 (BinOp/UnaryOp ネスト深度)
- Phase 55-B: 算術パターン軸追加 (Mul/Sub/Div 出現パターン)
- Phase 56: selfhost 実戦ループ追加 (6 本以上蓄積)
- Phase 57: 誤判定率 < 5% 達成後に name ガード縮小開始
name ガード撤去条件 (Phase 57):
- 構造軸 8+ 本確立
- selfhost P2/P3 各 6 本以上蓄積
- 誤判定率 < 5% 達成
- 複合的特徴量ベース判定実装
回帰テスト: ✅ 939 PASS, 0 FAIL (既存挙動不変)
Files Modified: 8 files
Lines Added: ~408 lines (net)
Implementation: Pure additive (feature-gated)
Phase 54 完了!構造軸育成・偽陽性観測基盤確立!
|
2025-12-12 17:12:58 +09:00 |
|
|
|
7b0db59100
|
feat(joinir): Phase 53 - SELFHOST-NORM-DEV-EXPAND implementation
Expanded selfhost dev Normalized target with 2 practical P2/P3 loop variations,
strengthened structural signature axis, and implemented two-stage detection.
Key Changes:
1. Documentation (phase49-selfhost-joinir-depth2-design.md +128 lines):
- Added Phase 53 section with candidate selection rationale
- Documented two-stage detector strategy (structural primary + dev-only name guard)
- Defined structural axis strengthening (carrier count/type, branch patterns)
2. Fixtures (+210 lines):
- selfhost_args_parse_p2.program.json (60 lines): P2 with String carrier + conditional branching
- selfhost_stmt_count_p3.program.json (150 lines): P3 with 5 carriers + multi-branch if-else
3. Structured Builders (fixtures.rs +48 lines):
- build_selfhost_args_parse_p2_structured_for_normalized_dev()
- build_selfhost_stmt_count_p3_structured_for_normalized_dev()
4. ShapeGuard Two-Stage Detection (shape_guard.rs +80 lines):
- Added SelfhostArgsParseP2/SelfhostStmtCountP3 to NormalizedDevShape enum
- Implemented is_selfhost_args_parse_p2(): P2 core family + name guard
- Implemented is_selfhost_stmt_count_p3(): 2-10 carrier check + name guard
- Updated capability_for_shape() mappings
5. Bridge Integration (bridge.rs +8 lines, normalized.rs +10 lines):
- Added shape handlers delegating to existing normalizers
- Added roundtrip reconstruction handlers
6. Entry Point Registration (ast_lowerer/mod.rs +2 lines):
- Registered selfhost_args_parse_p2/selfhost_stmt_count_p3 as LoopFrontend routes
7. Dev VM Comparison Tests (normalized_joinir_min.rs +40 lines):
- normalized_selfhost_args_parse_p2_vm_bridge_direct_matches_structured()
- normalized_selfhost_stmt_count_p3_vm_bridge_direct_matches_structured()
8. Test Context Fix (dev_env.rs):
- Added thread-local test context depth counter
- Fixed deadlock in nested test_ctx() calls via reentrant with_dev_env_if_unset()
Structural Axis Growth:
P2 family:
- Carrier count: 1-3 (unchanged)
- NEW: Type diversity (Integer/String mixed)
- NEW: Conditional branching patterns (Eq-heavy comparisons)
P3 family:
- NEW: Carrier count upper bound: 2-10 (was 2-4)
- NEW: Multi-branch if-else (5+ branches with nested structure)
- NEW: Complex conditional patterns
Test Results:
- normalized_dev: 40/40 PASS (including 2 new tests)
- lib regression: 939 PASS, 56 ignored
- Existing behavior unchanged (normalized_dev feature-gated)
Phase 53 Achievements:
✅ P2/P3 each gained 1 practical variation (2 total)
✅ Two-stage detection: structural primary + dev-only name guard
✅ Structural axis expanded: 4 axes (carrier count/type/Compare/branch patterns)
✅ All tests PASS, no regressions
✅ Test context deadlock fixed (0.04s for 29 tests)
Files Modified: 14 files
Lines Added: ~516 lines (net)
Implementation: Pure additive (feature-gated)
Next Phase (54+):
- Accumulate 6+ loops per P2/P3 family
- Achieve 5+ stable structural axes
- Target < 5% false positive rate
- Then shrink/remove name guard scope
|
2025-12-12 16:40:20 +09:00 |
|