This repository was archived by the owner on Feb 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ async def apply_decay(project_path: Optional[str] = None) -> int:
120120 if abs (new_strength - pattern .strength ) > 0.001 :
121121 pattern .strength = new_strength
122122 pattern .updated_at = now
123- await pattern .aio_save ()
123+ await pattern .save ()
124124 updated += 1
125125
126126 return updated
@@ -267,7 +267,7 @@ async def promote_pattern_to_heuristic(pattern) -> int:
267267 async with m :
268268 async with m .connection ():
269269 # Create heuristic
270- heuristic = await Heuristic .aio_create (
270+ heuristic = await Heuristic .create (
271271 domain = pattern .domain ,
272272 rule = pattern .pattern_text ,
273273 explanation = f"Auto-extracted pattern: { pattern .signature or 'behavioral' } . "
@@ -286,7 +286,7 @@ async def promote_pattern_to_heuristic(pattern) -> int:
286286 # Mark pattern as promoted
287287 pattern .promoted_to_heuristic_id = heuristic .id
288288 pattern .updated_at = datetime .utcnow ()
289- await pattern .aio_save ()
289+ await pattern .save ()
290290
291291 return heuristic .id
292292
Original file line number Diff line number Diff line change @@ -423,9 +423,12 @@ async def upsert_pattern(pattern: Dict[str, Any]) -> int:
423423 async with m :
424424 async with m .connection ():
425425 # Try to find existing pattern
426- try :
427- existing = await Pattern .aio_get (Pattern .pattern_hash == pattern_hash )
426+ existing = None
427+ async for p in Pattern .select ().where (Pattern .pattern_hash == pattern_hash ):
428+ existing = p
429+ break
428430
431+ if existing :
429432 # Update existing pattern
430433 existing .occurrence_count += pattern .get ('occurrence_count' , 1 )
431434 existing .last_seen = now
@@ -438,12 +441,12 @@ async def upsert_pattern(pattern: Dict[str, Any]) -> int:
438441 existing .session_ids = json .dumps (session_ids )
439442
440443 existing .updated_at = now
441- await existing .aio_save ()
444+ await existing .save ()
442445 return existing .id
443446
444- except Pattern . DoesNotExist :
447+ else :
445448 # Create new pattern
446- new_pattern = await Pattern .aio_create (
449+ new_pattern = await Pattern .create (
447450 pattern_type = pattern ['pattern_type' ],
448451 pattern_hash = pattern_hash ,
449452 pattern_text = pattern ['pattern_text' ],
You can’t perform that action at this time.
0 commit comments