phase29ad(p3): finalize pattern6/7 fixture naming ssot

This commit is contained in:
2025-12-28 17:51:11 +09:00
parent 9c44e990a9
commit d8786ebab9
21 changed files with 201 additions and 228 deletions

View File

@ -1,5 +1,5 @@
// Phase 29ac P3: Pattern7 split-scan near-miss fixup (contract-aligned OK)
// Origin: phase29ab_pattern7_firstfail_min.hako (else step was i = i + 2)
// Origin: phase29ab_pattern7_splitscan_contract_min.hako (else step was i = i + 2)
// Expect: split("a,b,c", ",") -> length 3
static box StringUtils {
@ -37,4 +37,3 @@ static box Main {
return result.length()
}
}

View File

@ -1,11 +1,15 @@
# Self Current Task — Now (main)
## Current Focus: Phase 29ac COMPLETEP1P3: Pattern6/7 thaw
## Current Focus: Phase 29ad COMPLETENaming SSOT
**2025-12-28: Phase 29ad 完了**
- 目的: Pattern6/7 fixture/smoke の命名規約を SSOT 化し、variant 名を明示して迷いを消す
- 入口: `docs/development/current/main/phases/phase-29ad/README.md`
**2025-12-28: Phase 29ac 完了**
- 目的: Pattern6/7 の near-missfreeze固定を、契約維持のまま PASS へ倒すsilent fallback禁止
- 入口: `docs/development/current/main/phases/phase-29ac/README.md`
- 結果: reverse/matchscan は `phase29ab_pattern6_*` を OK 化、split-scan は fixup OK fixture`phase29ac_pattern7_*`)を追加
- 結果: reverse/matchscan は `phase29ab_pattern6_*` を OK 化、split-scan は near-miss OK fixture`phase29ab_pattern7_splitscan_nearmiss_ok_min`)を追加
**2025-12-28: Phase 29ab P1 完了**
- 目的: Pattern2 の LoopBodyLocal promotion の最小ケースを fixture+integration smoke で固定
@ -35,21 +39,21 @@
**2025-12-28: Phase 29ab P5 完了**
- 目的: Pattern7 SplitScan の「形は近いが契約違反」ケースを extractor 段で freeze に固定SSOT化
- 実装: `src/mir/builder/control_flow/joinir/patterns/pattern7_split_scan.rs``freeze_with_hint("phase29ab/pattern7/contract", ...)`
- fixture: `apps/tests/phase29ab_pattern7_firstfail_min.hako`
- smoke: `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern7_firstfail_min_vm.sh`
- fixture: `apps/tests/phase29ab_pattern7_splitscan_contract_min.hako`
- smoke: `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern7_splitscan_contract_min_vm.sh`
- 検証: `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern7_*"` PASS
**2025-12-28: Phase 29ab P6 完了**
- 目的: Pattern6 ScanWithInit の near-miss契約違反を extractor 段で freeze に固定SSOT化
- 実装: `src/mir/builder/control_flow/joinir/patterns/pattern6_scan_with_init.rs``[joinir/phase29ab/pattern6/contract]`
- fixture: `apps/tests/phase29ab_pattern6_firstfail_min.hako`
- smoke: `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_firstfail_min_vm.sh`
- fixture: `apps/tests/phase29ab_pattern6_scan_with_init_contract_min.hako`
- smoke: `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_scan_with_init_contract_min_vm.sh`
- 検証: `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern6_*"` PASS
**2025-12-28: Phase 29ab P7 完了**
- 目的: Pattern6 reverse scan / matchscan の near-miss を追加で freeze 固定し、契約境界を安定化
- fixtures: `apps/tests/phase29ab_pattern6_{reverse,matchscan}_firstfail_min.hako`
- smokes: `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_{reverse,matchscan}_firstfail_min_vm.sh`
- fixtures: `apps/tests/phase29ab_pattern6_{reverse,matchscan}_contract_min.hako`
- smokes: `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_{reverse,matchscan}_contract_min_vm.sh`
- 検証: `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern6_*"` PASS3/3
**2025-12-28: Phase 29ab P8 完了**

View File

@ -8,6 +8,9 @@ Related:
## 直近JoinIR/selfhost
- **Phase 29ad✅ COMPLETE: Naming SSOT for Pattern6/7 fixtures**
- 入口: `docs/development/current/main/phases/phase-29ad/README.md`
- **Phase 29ac✅ COMPLETE: De-freeze Pattern6/7**
- 入口: `docs/development/current/main/phases/phase-29ac/README.md`

View File

@ -46,13 +46,13 @@ Pattern6 OK:
- `apps/tests/phase29ab_pattern6_matchscan_ok_min.hako`
Pattern6 contract:
- `apps/tests/phase29ab_pattern6_firstfail_min.hako`
- `apps/tests/phase29ab_pattern6_reverse_firstfail_min.hako`
- `apps/tests/phase29ab_pattern6_matchscan_firstfail_min.hako`
- `apps/tests/phase29ab_pattern6_scan_with_init_contract_min.hako`
- `apps/tests/phase29ab_pattern6_reverse_contract_min.hako`
- `apps/tests/phase29ab_pattern6_matchscan_contract_min.hako`
Pattern7 OK:
- `apps/tests/phase29ab_pattern7_splitscan_ok_min.hako`
- `apps/tests/phase29ac_pattern7_splitscan_nearmiss_fix_ok_min.hako`
- `apps/tests/phase29ab_pattern7_splitscan_nearmiss_ok_min.hako`
Pattern7 contract:
- `apps/tests/phase29ab_pattern7_firstfail_min.hako`
- `apps/tests/phase29ab_pattern7_splitscan_contract_min.hako`

View File

@ -10,24 +10,10 @@ Goal: Fix near-miss vs OK boundaries for Pattern2/6/7 and provide a single entry
## Fixtures and Smokes
### Freeze-fixed (contract violations)
- Pattern2 seg freeze:
- `apps/tests/phase29ab_pattern2_seg_freeze_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern2_seg_freeze_min_vm.sh`
- Pattern7 SplitScan first-fail:
- `apps/tests/phase29ab_pattern7_firstfail_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern7_firstfail_min_vm.sh`
- Pattern6 ScanWithInit first-fail:
- `apps/tests/phase29ab_pattern6_firstfail_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_firstfail_min_vm.sh`
- Pattern6 reverse scan near-miss:
- `apps/tests/phase29ab_pattern6_reverse_firstfail_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_reverse_firstfail_min_vm.sh`
- Pattern6 matchscan near-miss:
- `apps/tests/phase29ab_pattern6_matchscan_firstfail_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_matchscan_firstfail_min_vm.sh`
Pattern6/7 の OK/contract fixtures 一覧は SSOT に集約:
- `docs/development/current/main/design/pattern6-7-contracts.md`
### OK (PASS fixed)
### Pattern2 / Phase 263
- Pattern2 LoopBodyLocal min:
- `apps/tests/phase29ab_pattern2_loopbodylocal_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern2_loopbodylocal_min_vm.sh`
@ -37,21 +23,12 @@ Goal: Fix near-miss vs OK boundaries for Pattern2/6/7 and provide a single entry
- Pattern2 seg notapplicable:
- `apps/tests/phase29ab_pattern2_seg_notapplicable_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern2_seg_notapplicable_min_vm.sh`
- Pattern2 seg freeze:
- `apps/tests/phase29ab_pattern2_seg_freeze_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern2_seg_freeze_min_vm.sh`
- Phase 263 realworld seg (Derived slot path):
- `apps/tests/phase263_pattern2_seg_realworld_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase263_pattern2_seg_realworld_min_vm.sh`
- Pattern6 ScanWithInit OK:
- `apps/tests/phase29ab_pattern6_scan_with_init_ok_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_scan_with_init_ok_min_vm.sh`
- Pattern6 reverse scan OK:
- `apps/tests/phase29ab_pattern6_reverse_ok_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_reverse_ok_min_vm.sh`
- Pattern6 matchscan OK:
- `apps/tests/phase29ab_pattern6_matchscan_ok_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_matchscan_ok_min_vm.sh`
- Pattern7 SplitScan OK:
- `apps/tests/phase29ab_pattern7_splitscan_ok_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern7_splitscan_ok_min_vm.sh`
## Commands

View File

@ -8,26 +8,14 @@ Goal: Convert freeze-fixed Pattern6/7 near-miss cases into PASS while keeping co
- P2 ✅ Pattern6 matchscan: fixture を contract-aligned に修正して PASS
- P3 ✅ Pattern7 split-scan: near-miss を contract-aligned な OK fixture として PASS 固定(元の契約違反 fixture は残す)
## Target list (initial)
## Target list (SSOT)
- `apps/tests/phase29ab_pattern6_reverse_firstfail_min.hako`
- `apps/tests/phase29ab_pattern6_matchscan_firstfail_min.hako`
- `apps/tests/phase29ab_pattern7_firstfail_min.hako`
- Pattern6/7 の OK/contract fixtures 一覧: `docs/development/current/main/design/pattern6-7-contracts.md`
## Outcome (SSOT)
## Outcome
### PASS fixtures (behavioral)
- Pattern6 reverse scan OK: `apps/tests/phase29ab_pattern6_reverse_ok_min.hako`RC=1
- Pattern6 matchscan OK: `apps/tests/phase29ab_pattern6_matchscan_ok_min.hako`RC=1
- Pattern7 split-scan near-miss fixup OK: `apps/tests/phase29ac_pattern7_splitscan_nearmiss_fix_ok_min.hako`RC=3
### FAIL-Fast fixtures (contract boundary)
- Pattern6 scan-with-init contract violation: `apps/tests/phase29ab_pattern6_firstfail_min.hako`tag: `[joinir/phase29ab/pattern6/contract]`
- Pattern6 reverse scan contract violation: `apps/tests/phase29ab_pattern6_reverse_firstfail_min.hako`tag: `[joinir/phase29ab/pattern6/contract]`
- Pattern6 matchscan contract violation: `apps/tests/phase29ab_pattern6_matchscan_firstfail_min.hako`tag: `[joinir/phase29ab/pattern6/contract]`
- Pattern7 split-scan contract violation: `apps/tests/phase29ab_pattern7_firstfail_min.hako`tag: `[joinir/phase29ab/pattern7/contract]`
- PASS/contract fixture の一覧は SSOT に集約(上記参照)。
- Phase29ac では split-scan の fixup OK fixture を追加し、契約違反 fixture は維持。
## Pass order (recommended)
@ -46,4 +34,4 @@ Goal: Convert freeze-fixed Pattern6/7 near-miss cases into PASS while keeping co
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern6_*"`
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern7_*"`
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ac_pattern7_*"`
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern7_*"`

View File

@ -0,0 +1,36 @@
# Phase 29ad: Pattern6/7 naming SSOT (fixtures + smokes)
Goal: remove ambiguous "firstfail" naming and make the variant explicit for every Pattern6/7 fixture and smoke.
## Naming rules (SSOT)
- Pattern6:
- `phase29ab_pattern6_<variant>_{ok|contract}_min.{hako,sh}`
- variants: `scan_with_init`, `reverse`, `matchscan`
- Pattern7:
- `phase29ab_pattern7_splitscan_{ok|contract}_min.{hako,sh}`
- near-miss OK variant: `phase29ab_pattern7_splitscan_nearmiss_ok_min.{hako,sh}`
## Current mapping
Pattern6 OK:
- `apps/tests/phase29ab_pattern6_scan_with_init_ok_min.hako`
- `apps/tests/phase29ab_pattern6_reverse_ok_min.hako`
- `apps/tests/phase29ab_pattern6_matchscan_ok_min.hako`
Pattern6 contract:
- `apps/tests/phase29ab_pattern6_scan_with_init_contract_min.hako`
- `apps/tests/phase29ab_pattern6_reverse_contract_min.hako`
- `apps/tests/phase29ab_pattern6_matchscan_contract_min.hako`
Pattern7 OK:
- `apps/tests/phase29ab_pattern7_splitscan_ok_min.hako`
- `apps/tests/phase29ab_pattern7_splitscan_nearmiss_ok_min.hako`
Pattern7 contract:
- `apps/tests/phase29ab_pattern7_splitscan_contract_min.hako`
## Commands
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern6_"`
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern7_"`

View File

@ -707,6 +707,33 @@ run_nyash_llvm() {
# シンプルテスト補助(スクリプト互換)
test_pass() { log_success "$1"; return 0; }
test_fail() { log_error "$1 ${2:-}"; return 1; }
expect_joinir_contract_freeze() {
local test_name="$1"
local output="$2"
local exit_code="$3"
local tag="$4"
if [ "$exit_code" -eq 0 ]; then
echo "[FAIL] Expected JoinIR contract freeze error, got exit 0"
echo "[INFO] Output:"
echo "$output" | tail -n 40 || true
test_fail "$test_name: Unexpected success"
return 1
fi
if echo "$output" | grep -Fq "$tag"; then
test_pass "$test_name: joinir contract freeze detected"
return 0
fi
echo "[FAIL] Expected joinir contract freeze tag in output"
echo "[INFO] Exit code: $exit_code"
echo "[INFO] Output:"
echo "$output" | tail -n 60 || true
test_fail "$test_name: Missing joinir contract freeze tag"
return 1
}
test_skip() { log_warn "SKIP $1 ${2:-}"; return 0; }
# 出力比較ヘルパー

View File

@ -1,40 +0,0 @@
#!/bin/bash
# Phase 29ab P6: Pattern6 first-fail minimal (contract violation)
# Tests: scan-with-init step mismatch must fail-fast
source "$(dirname "$0")/../../../lib/test_runner.sh"
export SMOKES_USE_PYVM=0
require_env || exit 2
INPUT="$NYASH_ROOT/apps/tests/phase29ab_pattern6_firstfail_min.hako"
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
set +e
OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env NYASH_DISABLE_PLUGINS=1 HAKO_JOINIR_STRICT=1 "$NYASH_BIN" "$INPUT" 2>&1)
EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 124 ]; then
test_fail "phase29ab_pattern6_firstfail_min_vm: hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
exit 1
fi
if [ "$EXIT_CODE" -eq 0 ]; then
echo "[FAIL] Expected JoinIR contract freeze error, got exit 0"
echo "[INFO] Output:"
echo "$OUTPUT" | tail -n 40 || true
test_fail "phase29ab_pattern6_firstfail_min_vm: Unexpected success"
exit 1
fi
if echo "$OUTPUT" | grep -q "\[joinir/phase29ab/pattern6/contract\]"; then
test_pass "phase29ab_pattern6_firstfail_min_vm: joinir contract freeze detected"
exit 0
else
echo "[FAIL] Expected joinir contract freeze tag in output"
echo "[INFO] Exit code: $EXIT_CODE"
echo "[INFO] Output:"
echo "$OUTPUT" | tail -n 60 || true
test_fail "phase29ab_pattern6_firstfail_min_vm: Missing joinir contract freeze tag"
exit 1
fi

View File

@ -0,0 +1,25 @@
#!/bin/bash
# Phase 29ad P0: Pattern6 match scan contract violation
# Tests: missing step update must fail-fast
source "$(dirname "$0")/../../../lib/test_runner.sh"
export SMOKES_USE_PYVM=0
require_env || exit 2
INPUT="$NYASH_ROOT/apps/tests/phase29ab_pattern6_matchscan_contract_min.hako"
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
set +e
OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env NYASH_DISABLE_PLUGINS=1 HAKO_JOINIR_STRICT=1 "$NYASH_BIN" "$INPUT" 2>&1)
EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 124 ]; then
test_fail "phase29ab_pattern6_matchscan_contract_min_vm: hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
exit 1
fi
if expect_joinir_contract_freeze "phase29ab_pattern6_matchscan_contract_min_vm" "$OUTPUT" "$EXIT_CODE" "[joinir/phase29ab/pattern6/contract]"; then
exit 0
fi
exit 1

View File

@ -1,40 +0,0 @@
#!/bin/bash
# Phase 29ad P0: Pattern6 match scan contract violation
# Tests: missing step update must fail-fast
source "$(dirname "$0")/../../../lib/test_runner.sh"
export SMOKES_USE_PYVM=0
require_env || exit 2
INPUT="$NYASH_ROOT/apps/tests/phase29ab_pattern6_matchscan_firstfail_min.hako"
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
set +e
OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env NYASH_DISABLE_PLUGINS=1 HAKO_JOINIR_STRICT=1 "$NYASH_BIN" "$INPUT" 2>&1)
EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 124 ]; then
test_fail "phase29ab_pattern6_matchscan_firstfail_min_vm: hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
exit 1
fi
if [ "$EXIT_CODE" -eq 0 ]; then
echo "[FAIL] Expected JoinIR contract freeze error, got exit 0"
echo "[INFO] Output:"
echo "$OUTPUT" | tail -n 40 || true
test_fail "phase29ab_pattern6_matchscan_firstfail_min_vm: Unexpected success"
exit 1
fi
if echo "$OUTPUT" | grep -q "\[joinir/phase29ab/pattern6/contract\]"; then
test_pass "phase29ab_pattern6_matchscan_firstfail_min_vm: joinir contract freeze detected"
exit 0
else
echo "[FAIL] Expected joinir contract freeze tag in output"
echo "[INFO] Exit code: $EXIT_CODE"
echo "[INFO] Output:"
echo "$OUTPUT" | tail -n 60 || true
test_fail "phase29ab_pattern6_matchscan_firstfail_min_vm: Missing joinir contract freeze tag"
exit 1
fi

View File

@ -0,0 +1,25 @@
#!/bin/bash
# Phase 29ad P0: Pattern6 reverse scan contract violation
# Tests: reverse step mismatch must fail-fast
source "$(dirname "$0")/../../../lib/test_runner.sh"
export SMOKES_USE_PYVM=0
require_env || exit 2
INPUT="$NYASH_ROOT/apps/tests/phase29ab_pattern6_reverse_contract_min.hako"
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
set +e
OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env NYASH_DISABLE_PLUGINS=1 HAKO_JOINIR_STRICT=1 "$NYASH_BIN" "$INPUT" 2>&1)
EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 124 ]; then
test_fail "phase29ab_pattern6_reverse_contract_min_vm: hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
exit 1
fi
if expect_joinir_contract_freeze "phase29ab_pattern6_reverse_contract_min_vm" "$OUTPUT" "$EXIT_CODE" "[joinir/phase29ab/pattern6/contract]"; then
exit 0
fi
exit 1

View File

@ -1,40 +0,0 @@
#!/bin/bash
# Phase 29ad P0: Pattern6 reverse scan contract violation
# Tests: reverse step mismatch must fail-fast
source "$(dirname "$0")/../../../lib/test_runner.sh"
export SMOKES_USE_PYVM=0
require_env || exit 2
INPUT="$NYASH_ROOT/apps/tests/phase29ab_pattern6_reverse_firstfail_min.hako"
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
set +e
OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env NYASH_DISABLE_PLUGINS=1 HAKO_JOINIR_STRICT=1 "$NYASH_BIN" "$INPUT" 2>&1)
EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 124 ]; then
test_fail "phase29ab_pattern6_reverse_firstfail_min_vm: hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
exit 1
fi
if [ "$EXIT_CODE" -eq 0 ]; then
echo "[FAIL] Expected JoinIR contract freeze error, got exit 0"
echo "[INFO] Output:"
echo "$OUTPUT" | tail -n 40 || true
test_fail "phase29ab_pattern6_reverse_firstfail_min_vm: Unexpected success"
exit 1
fi
if echo "$OUTPUT" | grep -q "\[joinir/phase29ab/pattern6/contract\]"; then
test_pass "phase29ab_pattern6_reverse_firstfail_min_vm: joinir contract freeze detected"
exit 0
else
echo "[FAIL] Expected joinir contract freeze tag in output"
echo "[INFO] Exit code: $EXIT_CODE"
echo "[INFO] Output:"
echo "$OUTPUT" | tail -n 60 || true
test_fail "phase29ab_pattern6_reverse_firstfail_min_vm: Missing joinir contract freeze tag"
exit 1
fi

View File

@ -0,0 +1,25 @@
#!/bin/bash
# Phase 29ab P6: Pattern6 scan-with-init contract violation
# Tests: scan-with-init step mismatch must fail-fast
source "$(dirname "$0")/../../../lib/test_runner.sh"
export SMOKES_USE_PYVM=0
require_env || exit 2
INPUT="$NYASH_ROOT/apps/tests/phase29ab_pattern6_scan_with_init_contract_min.hako"
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
set +e
OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env NYASH_DISABLE_PLUGINS=1 HAKO_JOINIR_STRICT=1 "$NYASH_BIN" "$INPUT" 2>&1)
EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 124 ]; then
test_fail "phase29ab_pattern6_scan_with_init_contract_min_vm: hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
exit 1
fi
if expect_joinir_contract_freeze "phase29ab_pattern6_scan_with_init_contract_min_vm" "$OUTPUT" "$EXIT_CODE" "[joinir/phase29ab/pattern6/contract]"; then
exit 0
fi
exit 1

View File

@ -1,40 +0,0 @@
#!/bin/bash
# Phase 29ab P5: Pattern7 first-fail minimal (contract violation)
# Tests: split scan with else step != i + 1 must fail-fast
source "$(dirname "$0")/../../../lib/test_runner.sh"
export SMOKES_USE_PYVM=0
require_env || exit 2
INPUT="$NYASH_ROOT/apps/tests/phase29ab_pattern7_firstfail_min.hako"
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
set +e
OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env NYASH_DISABLE_PLUGINS=1 HAKO_JOINIR_STRICT=1 "$NYASH_BIN" "$INPUT" 2>&1)
EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 124 ]; then
test_fail "phase29ab_pattern7_firstfail_min_vm: hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
exit 1
fi
if [ "$EXIT_CODE" -eq 0 ]; then
echo "[FAIL] Expected JoinIR contract freeze error, got exit 0"
echo "[INFO] Output:"
echo "$OUTPUT" | tail -n 40 || true
test_fail "phase29ab_pattern7_firstfail_min_vm: Unexpected success"
exit 1
fi
if echo "$OUTPUT" | grep -q "\[joinir/phase29ab/pattern7/contract\]"; then
test_pass "phase29ab_pattern7_firstfail_min_vm: joinir contract freeze detected"
exit 0
else
echo "[FAIL] Expected joinir contract freeze tag in output"
echo "[INFO] Exit code: $EXIT_CODE"
echo "[INFO] Output:"
echo "$OUTPUT" | tail -n 60 || true
test_fail "phase29ab_pattern7_firstfail_min_vm: Missing joinir contract freeze tag"
exit 1
fi

View File

@ -0,0 +1,25 @@
#!/bin/bash
# Phase 29ab P5: Pattern7 split-scan contract violation
# Tests: split scan with else step != i + 1 must fail-fast
source "$(dirname "$0")/../../../lib/test_runner.sh"
export SMOKES_USE_PYVM=0
require_env || exit 2
INPUT="$NYASH_ROOT/apps/tests/phase29ab_pattern7_splitscan_contract_min.hako"
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
set +e
OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env NYASH_DISABLE_PLUGINS=1 HAKO_JOINIR_STRICT=1 "$NYASH_BIN" "$INPUT" 2>&1)
EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 124 ]; then
test_fail "phase29ab_pattern7_splitscan_contract_min_vm: hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
exit 1
fi
if expect_joinir_contract_freeze "phase29ab_pattern7_splitscan_contract_min_vm" "$OUTPUT" "$EXIT_CODE" "[joinir/phase29ab/pattern7/contract]"; then
exit 0
fi
exit 1

View File

@ -1,12 +1,12 @@
#!/bin/bash
# Phase 29ac P3: Pattern7 split-scan near-miss fixup OK minimal
# Phase 29ac P3: Pattern7 split-scan near-miss OK minimal (renamed)
# Tests: split("a,b,c", ",") -> length 3
source "$(dirname "$0")/../../../lib/test_runner.sh"
export SMOKES_USE_PYVM=0
require_env || exit 2
INPUT="$NYASH_ROOT/apps/tests/phase29ac_pattern7_splitscan_nearmiss_fix_ok_min.hako"
INPUT="$NYASH_ROOT/apps/tests/phase29ab_pattern7_splitscan_nearmiss_ok_min.hako"
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
set +e
@ -15,17 +15,16 @@ EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 124 ]; then
test_fail "phase29ac_pattern7_splitscan_nearmiss_fix_ok_min_vm: hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
test_fail "phase29ab_pattern7_splitscan_nearmiss_ok_min_vm: hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
exit 1
fi
if [ "$EXIT_CODE" -eq 3 ]; then
test_pass "phase29ac_pattern7_splitscan_nearmiss_fix_ok_min_vm: RC=3 (expected)"
test_pass "phase29ab_pattern7_splitscan_nearmiss_ok_min_vm: RC=3 (expected)"
exit 0
fi
echo "[FAIL] Expected exit 3, got $EXIT_CODE"
echo "$OUTPUT" | tail -n 40 || true
test_fail "phase29ac_pattern7_splitscan_nearmiss_fix_ok_min_vm: Unexpected RC"
test_fail "phase29ab_pattern7_splitscan_nearmiss_ok_min_vm: Unexpected RC"
exit 1