Skip to content

Commit da7881c

Browse files
Fix conflict pair recording and validation consistency
- Record all unique pairs for N duplicates (N*(N-1)/2 pairs) Previously: 3 duplicates → 2 pairs (A-B, B-C) Now: 3 duplicates → 3 pairs (A-B, A-C, B-C) - Changed validation from re.match() to re.search() for consistency Both scanning and validation now use same matching behavior Addresses feedback in PR review comment #2674204672 and #2674204685 Co-authored-by: AmedeoPelliccia <164860269+AmedeoPelliccia@users.noreply.github.com>
1 parent 7b388c3 commit da7881c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

scripts/check_ata99_registry.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def validate_namespace_id_format(self, namespace_id: str) -> Tuple[bool, Optiona
195195
(is_valid, error_message)
196196
"""
197197
for ns_type, pattern in self.NAMESPACE_PATTERNS.items():
198-
if re.match(pattern, namespace_id):
198+
if re.search(pattern, namespace_id):
199199
return (True, None)
200200

201201
return (False, f"Namespace ID '{namespace_id}' does not match any known pattern")
@@ -268,14 +268,16 @@ def run_gate_004(db_path: str = "plc_ontology.db", directory: Path = Path('.'))
268268

269269
for namespace_id, paths in namespace_to_paths.items():
270270
if len(paths) > 1:
271-
# Record all conflicts in the database (for 3+ duplicates, record multiple conflict pairs)
272-
for i in range(len(paths) - 1):
273-
checker.db.record_namespace_conflict(
274-
namespace_id=namespace_id,
275-
artifact_path_1=paths[i],
276-
artifact_path_2=paths[i + 1],
277-
conflict_type='DUPLICATE_ID'
278-
)
271+
# Record all unique conflict pairs in the database
272+
# For N duplicates, record all N*(N-1)/2 unique pairs
273+
for i in range(len(paths)):
274+
for j in range(i + 1, len(paths)):
275+
checker.db.record_namespace_conflict(
276+
namespace_id=namespace_id,
277+
artifact_path_1=paths[i],
278+
artifact_path_2=paths[j],
279+
conflict_type='DUPLICATE_ID'
280+
)
279281

280282
# Add to checker's conflict list (used for reporting)
281283
checker.conflicts.append({

0 commit comments

Comments
 (0)