refactor(joinir): Phase 82-83 - Debug flag SSOT + Fallback verification

Phase 82: Centralized JoinIR debug flag reading
- Added is_joinir_debug() SSOT function in joinir_flags.rs
- Replaced 16 direct env::var() calls across 8 files
- Updated docs to recommend HAKO_JOINIR_DEBUG (NYASH_ deprecated)
- Backward compat: Both env vars work

Phase 83: Verified promoted carrier fallback behavior
- Confirmed NO fallback to name-based lookup for DigitPos/Trim
- Documented fallback expectations in Phase 80/81 docs
- Added verification commands and expected output

Changes:
- src/config/env/joinir_flags.rs: +187 lines (new SSOT module)
- 8 files: env var reads → is_joinir_debug() calls
- 3 docs: HAKO_JOINIR_DEBUG examples + fallback sections
- 1 summary doc: phase82-83-debug-flag-ssot-summary.md

Tests: 970/970 lib PASS, 58/58 normalized_dev PASS
Impact: Dev-only (zero production changes)
This commit is contained in:
nyash-codex
2025-12-13 19:01:14 +09:00
parent 3ff032ead5
commit 9e32807a96
12 changed files with 589 additions and 22 deletions

View File

@ -559,14 +559,16 @@ For detailed ExitLine logging:
```bash
# DigitPos pattern verification
NYASH_JOINIR_DEBUG=1 cargo test --features normalized_dev \
HAKO_JOINIR_DEBUG=1 cargo test --features normalized_dev \
test_phase81_digitpos_exitline_contract -- --nocapture 2>&1 | grep exit-line
# Expected: [joinir/exit-line] skip ConditionOnly carrier 'is_digit_pos'
# Legacy: NYASH_JOINIR_DEBUG=1 also works (deprecated)
# Trim pattern verification
NYASH_JOINIR_DEBUG=1 cargo test --features normalized_dev \
HAKO_JOINIR_DEBUG=1 cargo test --features normalized_dev \
test_phase81_trim_exitline_contract -- --nocapture 2>&1 | grep exit-line
# Expected: [joinir/exit-line] skip ConditionOnly carrier 'is_ch_match'
# Legacy: NYASH_JOINIR_DEBUG=1 also works (deprecated)
```
### Test Files Modified
@ -644,3 +646,42 @@ Duration: .062845590s
- Pre-existing failure is unrelated to ExitLine contract
---
## Phase 82/83 Addendum: Debug Flag SSOT & Fallback Verification
### Debug Flag Unification (Phase 82)
**Changes**:
- Centralized JoinIR debug flag reading to `is_joinir_debug()` function
- Replaced 16 direct `std::env::var("NYASH_JOINIR_DEBUG")` calls
- Updated documentation to recommend `HAKO_JOINIR_DEBUG=1`
**Backward Compatibility**:
- Both `HAKO_JOINIR_DEBUG` and `NYASH_JOINIR_DEBUG` work
- Recommended: Use `HAKO_JOINIR_DEBUG=1` (NYASH_ variant deprecated)
### Fallback Behavior (Phase 83)
**Expected**: Promoted carriers (DigitPos/Trim) should NEVER fallback to name-based lookup
**Verification**:
```bash
# DigitPos pattern - promoted carrier 'is_digit_pos'
HAKO_JOINIR_DEBUG=1 cargo test --features normalized_dev \
test_phase81_digitpos_exitline_contract -- --nocapture 2>&1 | grep "\[binding_pilot"
# Trim pattern - promoted carrier 'is_ch_match'
HAKO_JOINIR_DEBUG=1 cargo test --features normalized_dev \
test_phase81_trim_exitline_contract -- --nocapture 2>&1 | grep "\[binding_pilot"
```
**Expected Output**:
- `[binding_pilot/hit]` tags ✅ (BindingId path success)
- NO `[binding_pilot/fallback]` tags ❌ (name fallback should NOT occur)
**Status (Phase 83)**:
- All Phase 81 tests PASS
- No fallback to name-based lookup detected
- Promoted carriers correctly resolved via BindingId path
---