@@ -107,6 +107,7 @@ class EUAIActReporter {
107107 std::vector<InferenceRecord> records;
108108 bool chain_ok = true ;
109109 std::string chain_id;
110+ int read_errors = 0 ;
110111
111112 for (const auto & path : inference_log_files) {
112113 auto rdr_result = InferenceLogReader::open (path);
@@ -124,7 +125,7 @@ class EUAIActReporter {
124125 if (meta) chain_id = meta->chain_id ;
125126 }
126127 auto all = rdr.read_all ();
127- if (!all) continue ;
128+ if (!all) { ++read_errors; continue ; }
128129 for (auto & rec : *all)
129130 if (rec.timestamp_ns >= opts.start_ns &&
130131 rec.timestamp_ns <= opts.end_ns )
@@ -142,6 +143,11 @@ class EUAIActReporter {
142143 ComplianceReport report = make_report_skeleton (
143144 ComplianceStandard::EU_AI_ACT_ART12, opts,
144145 static_cast <int64_t >(records.size ()), chain_ok, chain_id);
146+ if (read_errors > 0 ) {
147+ report.incomplete_data = true ;
148+ report.read_errors .push_back (" Art.12: failed to read " + std::to_string (read_errors)
149+ + " of " + std::to_string (inference_log_files.size ()) + " inference log files" );
150+ }
145151
146152 report.content = format_article12_json (records, opts, report);
147153 return report;
@@ -171,6 +177,7 @@ class EUAIActReporter {
171177 std::vector<InferenceRecord> records;
172178 bool chain_ok = true ;
173179 std::string chain_id;
180+ int read_errors = 0 ;
174181
175182 for (const auto & path : inference_log_files) {
176183 auto rdr_result = InferenceLogReader::open (path);
@@ -187,7 +194,7 @@ class EUAIActReporter {
187194 if (meta) chain_id = meta->chain_id ;
188195 }
189196 auto all = rdr.read_all ();
190- if (!all) continue ;
197+ if (!all) { ++read_errors; continue ; }
191198 for (auto & rec : *all)
192199 if (rec.timestamp_ns >= opts.start_ns &&
193200 rec.timestamp_ns <= opts.end_ns )
@@ -201,6 +208,11 @@ class EUAIActReporter {
201208 ComplianceReport report = make_report_skeleton (
202209 ComplianceStandard::EU_AI_ACT_ART13, opts,
203210 static_cast <int64_t >(records.size ()), chain_ok, chain_id);
211+ if (read_errors > 0 ) {
212+ report.incomplete_data = true ;
213+ report.read_errors .push_back (" Art.13: failed to read " + std::to_string (read_errors)
214+ + " of " + std::to_string (inference_log_files.size ()) + " inference log files" );
215+ }
204216
205217 report.content = format_article13_json (records, opts, report);
206218 return report;
@@ -234,6 +246,7 @@ class EUAIActReporter {
234246 std::vector<DecisionRecord> dec_records;
235247 bool dec_chain_ok = true ;
236248 std::string dec_chain_id;
249+ int dec_read_errors = 0 ;
237250
238251 for (const auto & path : decision_log_files) {
239252 auto rdr_result = DecisionLogReader::open (path);
@@ -250,7 +263,7 @@ class EUAIActReporter {
250263 if (meta) dec_chain_id = meta->chain_id ;
251264 }
252265 auto all = rdr.read_all ();
253- if (!all) continue ;
266+ if (!all) { ++dec_read_errors; continue ; }
254267 for (auto & rec : *all)
255268 if (rec.timestamp_ns >= opts.start_ns &&
256269 rec.timestamp_ns <= opts.end_ns )
@@ -261,6 +274,7 @@ class EUAIActReporter {
261274 std::vector<InferenceRecord> inf_records;
262275 bool inf_chain_ok = true ;
263276 std::string inf_chain_id;
277+ int inf_read_errors = 0 ;
264278
265279 for (const auto & path : inference_log_files) {
266280 auto rdr_result = InferenceLogReader::open (path);
@@ -277,7 +291,7 @@ class EUAIActReporter {
277291 if (meta) inf_chain_id = meta->chain_id ;
278292 }
279293 auto all = rdr.read_all ();
280- if (!all) continue ;
294+ if (!all) { ++inf_read_errors; continue ; }
281295 for (auto & rec : *all)
282296 if (rec.timestamp_ns >= opts.start_ns &&
283297 rec.timestamp_ns <= opts.end_ns )
@@ -309,6 +323,16 @@ class EUAIActReporter {
309323 ComplianceReport report = make_report_skeleton (
310324 ComplianceStandard::EU_AI_ACT_ART19, opts, total, chain_ok,
311325 dec_chain_id.empty () ? inf_chain_id : dec_chain_id);
326+ if (dec_read_errors > 0 ) {
327+ report.incomplete_data = true ;
328+ report.read_errors .push_back (" Art.19: failed to read " + std::to_string (dec_read_errors)
329+ + " of " + std::to_string (decision_log_files.size ()) + " decision log files" );
330+ }
331+ if (inf_read_errors > 0 ) {
332+ report.incomplete_data = true ;
333+ report.read_errors .push_back (" Art.19: failed to read " + std::to_string (inf_read_errors)
334+ + " of " + std::to_string (inference_log_files.size ()) + " inference log files" );
335+ }
312336
313337 report.content = format_article19_json (
314338 dec_records, inf_records, opts, report,
@@ -553,7 +577,7 @@ class EUAIActReporter {
553577 o += ind2 + " \" level\" :" + sp + std::to_string (opts.risk_level ) + " ," + nl;
554578 const char * risk_labels[] = {" " ," minimal" ," limited" ," high" ," unacceptable" };
555579 o += ind2 + " \" label\" :" + sp + " \" "
556- + std::string (opts.risk_level <= 4 ? risk_labels[opts.risk_level ] : " unknown" )
580+ + std::string (( opts.risk_level >= 0 && opts. risk_level <= 4 ) ? risk_labels[opts.risk_level ] : " unknown" )
557581 + " \" " + nl;
558582 o += ind + " }," + nl;
559583 }
0 commit comments