feat(phase72-c): JoinIR dev flags SSOT foundation - config::env helpers

Phase 72-C: Created centralized SSOT helpers for all 9 DevOnly JoinIR flags.

New module: src/config/env/joinir_dev.rs
- lower_generic_enabled() → NYASH_JOINIR_LOWER_GENERIC (CRITICAL: 15 uses)
- mainline_debug_enabled() → NYASH_JOINIR_MAINLINE_DEBUG (5 uses)
- if_merge_enabled() → NYASH_JOINIR_IF_MERGE
- debug_enabled() → NYASH_JOINIR_DEBUG (deprecated)
- vm_bridge_enabled() → NYASH_JOINIR_VM_BRIDGE
- strict_enabled() → NYASH_JOINIR_STRICT
- snapshot_generate_enabled() → NYASH_JOINIR_SNAPSHOT_GENERATE
- snapshot_test_enabled() → NYASH_JOINIR_SNAPSHOT_TEST
- input_mode() → NYASH_JOINIR_INPUT

Benefits:
- All ENV reads routed through single module (joinir_dev)
- Easy to extend with validation, logging, or tracing
- Consistent naming: *_enabled() for bool flags, input_mode() for string value
- Foundation for next step: replace direct std::env calls in code

Next steps:
1. Update joinir_env test helpers with similar pattern
2. Replace std::env::var("NYASH_JOINIR_*") calls with config::env::joinir_dev::*
3. Update tests to use centralized helpers

Tests verified: cargo check passed with no errors

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-02 12:46:35 +09:00
parent b028aa791e
commit 6842a72df1
2 changed files with 52 additions and 0 deletions

View File

@ -5,10 +5,12 @@
mod catalog;
pub mod dump;
pub mod joinir_dev;
pub mod stage1;
pub use catalog::{env_vars, AppliesTo, EnvVarMeta};
pub use dump::*;
pub use joinir_dev::*;
pub use stage1::*;
use std::collections::BTreeMap;

50
src/config/env/joinir_dev.rs vendored Normal file
View File

@ -0,0 +1,50 @@
//! JoinIR development / experimental flags (SSOT).
//! Phase 72-C: Consolidate all NYASH_JOINIR_* dev flags through centralized helpers.
use crate::config::env::env_bool;
/// NYASH_JOINIR_LOWER_GENERIC=1 - Enable generic lowering path for JoinIR
/// (CRITICAL: 15 occurrences in codebase)
pub fn lower_generic_enabled() -> bool {
env_bool("NYASH_JOINIR_LOWER_GENERIC")
}
/// NYASH_JOINIR_MAINLINE_DEBUG=1 - Debug output for mainline JoinIR lowering
pub fn mainline_debug_enabled() -> bool {
env_bool("NYASH_JOINIR_MAINLINE_DEBUG")
}
/// NYASH_JOINIR_IF_MERGE=1 - Enable If-merge experimental mode
pub fn if_merge_enabled() -> bool {
env_bool("NYASH_JOINIR_IF_MERGE")
}
/// NYASH_JOINIR_DEBUG=1 - General debug mode (deprecated, prefer mainline_debug)
pub fn debug_enabled() -> bool {
env_bool("NYASH_JOINIR_DEBUG")
}
/// NYASH_JOINIR_VM_BRIDGE=1 - Enable VM bridge mode
pub fn vm_bridge_enabled() -> bool {
env_bool("NYASH_JOINIR_VM_BRIDGE")
}
/// NYASH_JOINIR_STRICT=1 - Strict validation mode
pub fn strict_enabled() -> bool {
env_bool("NYASH_JOINIR_STRICT")
}
/// NYASH_JOINIR_SNAPSHOT_GENERATE=1 - Generate snapshot for testing
pub fn snapshot_generate_enabled() -> bool {
env_bool("NYASH_JOINIR_SNAPSHOT_GENERATE")
}
/// NYASH_JOINIR_SNAPSHOT_TEST=1 - Test using snapshot
pub fn snapshot_test_enabled() -> bool {
env_bool("NYASH_JOINIR_SNAPSHOT_TEST")
}
/// NYASH_JOINIR_INPUT=* - Input source or mode
pub fn input_mode() -> Option<String> {
std::env::var("NYASH_JOINIR_INPUT").ok()
}