fix: surface scenario parse failures instead of silently skipping - #41
Merged
Merged
Conversation
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)".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
load_scenarios_from_dir/load_all_scenariosはシナリオファイルのパース失敗をdebug!でログして黙ってスキップしていました。このため tachyon-apps では YAML 構文エラーのある.scenario.mdが約2年間 27 ファイル暗黙スキップされ続け、「Loading 120 → Loaded 93」の差分に誰も気づきませんでした(修復は quantum-box/tachyon-apps#6332)。変更内容
warn!に昇格 — ファイル名と anyhow のエラーチェーン全体({:#})を出力します。MUON_FAIL_ON_PARSE_ERROR=true(TestConfigManager::new()が読む)または CLI の--fail-on-parse-errorで、最初のパース失敗をロード失敗(Err)として扱います。既定は従来どおりスキップ(warn 付き)。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)を出力することを確認。関連