yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
oracle_validation_view_model.h
Go to the documentation of this file.
1// Oracle Validation View Model
2//
3// Pure C++ structs + helpers for:
4// - Parsing oracle-smoke-check and dungeon-oracle-preflight JSON output
5// - Building command argument lists
6// - Reconstructing CLI commands for copy-paste
7//
8// Separated from the panel to allow independent unit testing.
9
10#ifndef YAZE_APP_EDITOR_ORACLE_PANELS_ORACLE_VALIDATION_VIEW_MODEL_H_
11#define YAZE_APP_EDITOR_ORACLE_PANELS_ORACLE_VALIDATION_VIEW_MODEL_H_
12
13#include <optional>
14#include <string>
15#include <vector>
16
17#include "absl/status/status.h"
18#include "absl/status/statusor.h"
19
21
22struct SmokeD4 {
23 bool structural_ok = false;
24 std::string required_rooms_check; // "ran" | "skipped"
25 std::optional<bool> required_rooms_ok; // absent when skipped
26};
27
28struct SmokeD6 {
29 bool ok = false;
30 int track_rooms_found = 0;
31 int min_track_rooms = 0;
32 bool meets_min_track_rooms = false;
33};
34
35struct SmokeD3 {
36 std::string readiness_check; // "ran" | "skipped"
37 std::optional<bool> ok; // absent when skipped
38};
39
40struct SmokeResult {
41 bool ok = false;
42 std::string status; // "pass" | "fail"
43 bool strict_readiness = false;
44 SmokeD4 d4;
45 SmokeD6 d6;
46 SmokeD3 d3;
47};
48
49struct PreflightError {
50 std::string code;
51 std::string message;
52 std::string status_code;
53 std::optional<std::string> room_id;
54};
55
56struct PreflightResult {
57 bool ok = false;
58 int error_count = 0;
59 bool water_fill_region_ok = false;
60 bool water_fill_table_ok = false;
61 bool custom_collision_maps_ok = false;
62 std::string required_rooms_check; // "ran" | "skipped"
63 std::optional<bool> required_rooms_ok;
64 std::vector<PreflightError> errors;
65 std::string status; // "pass" | "fail"
66};
67
69
70struct OracleRunResult {
72
73 bool command_ok = false;
74 absl::StatusCode status_code = absl::StatusCode::kOk;
75 std::string error_message;
76 std::string raw_output;
77 std::string cli_command;
78 std::string timestamp;
79
80 std::optional<SmokeResult> smoke;
81 std::optional<PreflightResult> preflight;
82
83 bool json_parse_failed = false;
84};
85
86absl::StatusOr<SmokeResult> ParseSmokeCheckOutput(const std::string& json_str);
87absl::StatusOr<PreflightResult> ParsePreflightOutput(
88 const std::string& json_str);
89
90struct SmokeOptions {
91 std::string rom_path;
92 int min_d6_track_rooms = 4;
93 bool strict_readiness = false;
94 std::string report_path;
95};
96
97struct PreflightOptions {
98 std::string rom_path;
99 std::string required_collision_rooms;
100 bool require_write_support = false;
101 bool skip_collision_maps = false;
102 std::string report_path;
103};
104
105std::vector<std::string> BuildSmokeArgs(const SmokeOptions& opts);
106std::vector<std::string> BuildPreflightArgs(const PreflightOptions& opts);
107
108std::string BuildCliCommand(const std::string& command_name,
109 const std::vector<std::string>& args);
110
111std::string CurrentTimestamp();
112
113} // namespace yaze::editor::oracle_validation
114
115#endif // YAZE_APP_EDITOR_ORACLE_PANELS_ORACLE_VALIDATION_VIEW_MODEL_H_
std::vector< std::string > BuildSmokeArgs(const SmokeOptions &opts)
std::vector< std::string > BuildPreflightArgs(const PreflightOptions &opts)
std::string BuildCliCommand(const std::string &command_name, const std::vector< std::string > &args)
absl::StatusOr< SmokeResult > ParseSmokeCheckOutput(const std::string &json_str)
absl::StatusOr< PreflightResult > ParsePreflightOutput(const std::string &json_str)