Skip to content

fix: surface scenario parse failures instead of silently skipping - #41

Merged
takanorifukuyama merged 1 commit into
mainfrom
fix/warn-on-scenario-parse-error
Jul 3, 2026
Merged

fix: surface scenario parse failures instead of silently skipping#41
takanorifukuyama merged 1 commit into
mainfrom
fix/warn-on-scenario-parse-error

Conversation

@takanorifukuyama

Copy link
Copy Markdown
Contributor

背景

load_scenarios_from_dir / load_all_scenarios はシナリオファイルのパース失敗を debug! でログして黙ってスキップしていました。このため tachyon-apps では YAML 構文エラーのある .scenario.md が約2年間 27 ファイル暗黙スキップされ続け、「Loading 120 → Loaded 93」の差分に誰も気づきませんでした(修復は quantum-box/tachyon-apps#6332)。

変更内容

  1. パース失敗を warn! に昇格 — ファイル名と anyhow のエラーチェーン全体({:#})を出力します。
  2. strict モード追加MUON_FAIL_ON_PARSE_ERROR=trueTestConfigManager::new() が読む)または CLI の --fail-on-parse-error で、最初のパース失敗をロード失敗(Err)として扱います。既定は従来どおりスキップ(warn 付き)。
  3. ロード完了ログにスキップ数を明示Loaded N test scenarios from DIR / skipped M (parse errors) 形式。

公開 API のシグネチャは変更していないため、既存の呼び出し側(tachyon-apps の run_tests.rs、muon serve の hooks 等)はそのまま動作します。環境変数は TestConfigManager::new() で読むため、tachyon-apps 側は CI に env を足すだけで有効化できます。

動作確認

  • cargo test(全 suite green、config テスト 11 件 + 追加 4 件)
  • cargo fmt --check / cargo clippy(新規警告なし。既出の format! インライン警告は既存コード由来)
  • 実地検証: MUON_FAIL_ON_PARSE_ERROR=true cargo run --bin muon -- -p ../apps/tachyon-api/tests/scenarios が壊れたファイル名+エラーチェーンつきで即失敗し、非 strict では Loaded 96 ... / skipped 27 (parse errors) を出力することを確認。

関連

  • tachyon-apps 側の CI 有効化 + submodule bump PR は別途作成(quantum-box/tachyon-apps#6332 のマージが前提)。

Scenario files that failed to parse were logged at debug level and
silently dropped, so broken files could go unnoticed for years
(tachyon-apps had 27 .scenario.md files skipped this way).

- Promote parse-failure logs to warn! with the file name and the
  full anyhow error chain ({:#}).
- Add a strict mode via MUON_FAIL_ON_PARSE_ERROR env var (read by
  TestConfigManager::new) or the --fail-on-parse-error CLI flag:
  the first parse failure aborts loading with an error.
- Report skipped counts in the load-summary logs:
  "Loaded N test scenarios from DIR / skipped M (parse errors)".
@takanorifukuyama
takanorifukuyama merged commit 47140c0 into main Jul 3, 2026
8 of 9 checks passed
@takanorifukuyama
takanorifukuyama deleted the fix/warn-on-scenario-parse-error branch July 3, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant