Skip to content

Commit 64a791b

Browse files
author
Test User
committed
When building reference registry for change impact allow lanient mode to allow passing even with validation errrors.
This allows to work with new reqvire code that might fail validaton on previous commits. Also it allows to have imperfect previous commit but still to do change impact.
1 parent 0504b28 commit 64a791b

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

cli/src/cli.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,8 @@ pub fn handle_command(
584584
})?;
585585

586586
let mut refference_model_manager = ModelManager::new();
587-
let _not_interested=refference_model_manager.parse_and_validate(Some(&git_commit), excluded_filename_patterns);
587+
// Use lenient mode for reference registry to handle historical commits with validation issues
588+
let _not_interested=refference_model_manager.parse_and_validate_with_mode(Some(&git_commit), excluded_filename_patterns, true);
588589

589590
let report=change_impact::compute_change_impact(
590591
&model_manager.graph_registry,

core/src/model.rs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,47 @@ impl ModelManager {
3333
git_commit_hash: Option<&str>,
3434
excluded_filename_patterns: &GlobSet
3535
) -> Result<Vec<ReqvireError>, ReqvireError> {
36-
debug!("Starting two-pass validation architecture");
36+
self.parse_and_validate_with_mode(git_commit_hash, excluded_filename_patterns, false)
37+
}
38+
39+
pub fn parse_and_validate_with_mode(
40+
&mut self,
41+
git_commit_hash: Option<&str>,
42+
excluded_filename_patterns: &GlobSet,
43+
lenient: bool
44+
) -> Result<Vec<ReqvireError>, ReqvireError> {
45+
debug!("Starting two-pass validation architecture (lenient={})", lenient);
3746

3847
// Pass 1: Element collection with local validation
3948
let pass1_errors = self.pass1_collect_elements(
4049
git_commit_hash,
4150
excluded_filename_patterns
4251
)?;
4352

44-
// If Pass 1 has errors, return them as an error
53+
// If Pass 1 has errors, return them as an error (unless lenient mode)
4554
if !pass1_errors.is_empty() {
4655
debug!("Pass 1 validation failed with {} errors", pass1_errors.len());
47-
return Err(ReqvireError::ValidationError(pass1_errors));
56+
if !lenient {
57+
return Err(ReqvireError::ValidationError(pass1_errors));
58+
}
59+
debug!("Lenient mode: continuing despite Pass 1 errors");
4860
}
4961

50-
debug!("Pass 1 completed successfully, proceeding to Pass 2");
62+
debug!("Pass 1 completed, proceeding to Pass 2");
5163

5264
// Pass 2: Graph construction and relation validation
5365
let pass2_errors = self.pass2_build_relations(excluded_filename_patterns)?;
5466

55-
// If Pass 2 has errors, return them as an error
67+
// If Pass 2 has errors, return them as an error (unless lenient mode)
5668
if !pass2_errors.is_empty() {
5769
debug!("Pass 2 validation failed with {} errors", pass2_errors.len());
58-
return Err(ReqvireError::ValidationError(pass2_errors));
70+
if !lenient {
71+
return Err(ReqvireError::ValidationError(pass2_errors));
72+
}
73+
debug!("Lenient mode: continuing despite Pass 2 errors");
5974
}
6075

61-
debug!("Both passes completed successfully");
76+
debug!("Validation completed");
6277
Ok(Vec::new())
6378
}
6479

0 commit comments

Comments
 (0)