|
19 | 19 | from git.version_to_tag import get_possible_tags
|
20 | 20 | from llm.llm_service import LLMService
|
21 | 21 | from log.logger import get_level, logger, pretty_log
|
22 |
| -from rules.rules import RULES_PHASE_1, apply_rules |
| 22 | +from rules.rules import NUM_COMMITS_PHASE_2, RULES_PHASE_1, apply_rules |
23 | 23 | from stats.execution import (
|
24 | 24 | Counter,
|
25 | 25 | ExecutionTimer,
|
@@ -242,14 +242,18 @@ def prospector( # noqa: C901
|
242 | 242 | and use_backend != USE_BACKEND_NEVER
|
243 | 243 | and len(missing) > 0
|
244 | 244 | ):
|
245 |
| - save_preprocessed_commits(backend_address, payload) |
| 245 | + save_or_update_processed_commits(backend_address, payload) |
246 | 246 | else:
|
247 | 247 | logger.warning("Preprocessed commits are not being sent to backend")
|
248 | 248 |
|
249 | 249 | ranked_candidates = evaluate_commits(
|
250 | 250 | preprocessed_commits, advisory_record, backend_address, enabled_rules
|
251 | 251 | )
|
252 | 252 |
|
| 253 | + # Save outcome of security relevance to DB (Phase 2 Rule) |
| 254 | + payload = [c.to_dict() for c in ranked_candidates[:NUM_COMMITS_PHASE_2]] |
| 255 | + save_or_update_processed_commits(backend_address, payload) |
| 256 | + |
253 | 257 | # ConsoleWriter.print("Commit ranking and aggregation...")
|
254 | 258 | ranked_candidates = remove_twins(ranked_candidates)
|
255 | 259 | # ranked_candidates = tag_and_aggregate_commits(ranked_candidates, next_tag)
|
@@ -398,7 +402,7 @@ def retrieve_preprocessed_commits(
|
398 | 402 | return (missing, commits)
|
399 | 403 |
|
400 | 404 |
|
401 |
| -def save_preprocessed_commits(backend_address, payload): |
| 405 | +def save_or_update_processed_commits(backend_address, payload): |
402 | 406 | with ExecutionTimer(
|
403 | 407 | core_statistics.sub_collection(name="save commits to backend")
|
404 | 408 | ):
|
|
0 commit comments