Files
hakorune/tools/smokes
nyash-codex 6055d53eff feat(phase21.5/22.1): MirBuilder JsonFrag refactor + FileBox ring-1 + registry tests
Phase 21.5 (AOT/LLVM Optimization Prep)
- FileBox ring-1 (core-ro) provider: priority=-100, always available, no panic path
  - src/runner/modes/common_util/provider_registry.rs: CoreRoFileProviderFactory
  - Auto-registers at startup, eliminates fallback panic structurally
- StringBox fast path prototypes (length/size optimization)
- Performance benchmarks (C/Python/Hako comparison baseline)

Phase 22.1 (JsonFrag Unification)
- JsonFrag.last_index_of_from() for backward search (VM fallback)
- Replace hand-written lastIndexOf in lower_loop_sum_bc_box.hako
- SentinelExtractorBox for Break/Continue pattern extraction

MirBuilder Refactor (Box → JsonFrag Migration)
- 20+ lower_*_box.hako: Box-heavy → JsonFrag text assembly
- MirBuilderMinBox: lightweight using set for dev env
- Registry-only fast path with [registry:*] tag observation
- pattern_util_box.hako: enhanced pattern matching

Dev Environment & Testing
- Dev toggles: SMOKES_DEV_PREINCLUDE=1 (point-enable), HAKO_MIR_BUILDER_SKIP_LOOPS=1
- phase2160: registry opt-in tests (array/map get/set/push/len) - content verification
- phase2034: rc-dependent → token grep (grep -F based validation)
- run_quick.sh: fast smoke testing harness
- ENV documentation: docs/ENV_VARS.md

Test Results
 quick phase2034: ALL GREEN (MirBuilder internal patterns)
 registry phase2160: ALL GREEN (array/map get/set/push/len)
 rc-dependent tests → content token verification complete
 PREINCLUDE policy: default OFF, point-enable only where needed

Technical Notes
- No INCLUDE by default (maintain minimalism)
- FAIL_FAST=0 in Bring-up contexts only (explicit dev toggles)
- Tag-based route observation ([mirbuilder/min:*], [registry:*])
- MIR structure validation (not just rc parity)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 19:42:42 +09:00
..

Hakorune Smoke Tests v2 — Guide (Nyash-compatible)

Overview

  • Entry: tools/smokes/v2/run.sh — unified runner for quick/integration/full.
  • Profiles:
    • quick — fast developer checks.
    • integration — VM↔LLVM parity, basic stability.
    • full — comprehensive matrix.

🎯 Two Baselines (Runbook)

これから開発の基準となる2つのベースライン

📦 VM ラインRust VM - 既定)

用途: 開発・デバッグ・検証用(高速・型安全)

# ビルド
cargo build --release

# 一括スモークテスト
tools/smokes/v2/run.sh --profile quick

# 個別スモークテスト
tools/smokes/v2/run.sh --profile quick --filter "<glob>"
# 例: --filter "core/json_query_min_vm.sh"

# 単発実行(参考)
$NYASH_BIN --backend vm apps/APP/main.hako

llvmlite ラインLLVMハーネス

用途: 本番・最適化・配布用(実証済み安定性)

前提: Python3 + llvmlite

pip install llvmlite  # 未導入の場合

実行手順:

# ビルドLLVM_SYS_180_PREFIX不要
cargo build --release --features llvm

# 一括スモークテスト
tools/smokes/v2/run.sh --profile integration

# 個別スモークテスト
tools/smokes/v2/run.sh --profile integration --filter "<glob>"

# 単発実行
NYASH_LLVM_USE_HARNESS=1 $NYASH_BIN --backend llvm apps/tests/peek_expr_block.hako

# 有効化確認
$NYASH_BIN --version | rg -i 'features.*llvm'

💡 重要: 両方のラインのテストが通ることで、MIR14統一アーキテクチャの品質を保証

🔁 QuickでAST/LLVM系も実行したいとき

通常、quick は LLVM未ビルド時に AST/LLVM系テストを自動で SKIP します。 Quickでも実行したい場合は、先に LLVM 有効でビルドしてください:

LLVM_SYS_180_PREFIX=$(llvm-config-18 --prefix) cargo build --release --features llvm
tools/smokes/v2/run.sh --profile quick

テストランナーは LLVM 非対応時にヒントを出力しますbuildコマンドの案内

Notes

  • Using resolution: prefer nyash.toml aliases (SSOT). Some tests may enable NYASH_ALLOW_USING_FILE=1 internally for convenience.
  • Plugin warnings are informational; smokes are designed to pass without dynamic plugins.
  • Harness single-run may take longer due to link+exec; integration profile includes generous timeouts.
  • Binary selection in scripts: always use $NYASH_BIN (the runner sets it to target/release/hakorune when present, otherwise falls back to nyash).
  • Branding: uservisible messages prefer “Hakorune”; the legacy nyash binary remains for compatibility but may be gatedHAKO_ALLOW_NYASH=1)。

Dev Mode (defaults)

  • In v2 smokes, the quick profile exports NYASH_DEV=1 by default.
    • This enables CLI --dev-equivalent defaults inside Nyash:
      • AST using ON (SSOT + AST prelude merge)
      • Operator Boxes in observe mode (no adoption)
      • Minimal diagnostics; output parity is preserved
  • You can also run manually with nyash --dev script.hako.

Common commands

  • Quick suite (auto NYASH_DEV=1):
    • tools/smokes/v2/run.sh --profile quick
  • Focus JSON smokes:
    • tools/opbox-json.sh (Roundtrip/Nested, plugins disabled, generous timeout)
  • One-off program (VM):
    • $NYASH_BIN --backend vm --dev apps/APP/main.hako

Key env knobs

  • NYASH_DEV=1 — enable dev defaults (same effect as --dev).
  • SMOKES_DEFAULT_TIMEOUT — per test timeout seconds (default 15 for quick).
  • SMOKES_PLUGIN_MODE=dynamic|static — plugin mode for preflight (auto by default).
  • SMOKES_FORCE_CONFIG=rust_vm_dynamic|llvm_static — force backend config.
  • SMOKES_NOTIFY_TAIL — lines to show on failure tail (default 80).

Notes

  • Dev defaults are designed to be non-intrusive: tests remain behaviorcompatible.
  • To repro outside smokes, either pass --dev or export NYASH_DEV=1.

Heavy JSON probes

  • Heavy JSON tests (nested/roundtrip/query_min) run a tiny parser probe first.
  • The probe's stdout last non-empty line is trimmed and compared to ok.
  • If not ok, the test is SKIP (parser unavailable), not FAIL. This avoids false negatives due to environment noise or optional dependencies.