11"""Tier 0 of the fix loop: a deterministic version bump, no agent involved.
22
3- Most vulnerable-package fixes are exactly this — rewrite the pin, regenerate
3+ Most vulnerable-package fixes are exactly this: rewrite the pin, regenerate
44the lockfile, done. The agent tiers in fix.py only run when this fails
55(major bump breaks the build, tests fail, or the package isn't a direct
66dependency this module knows how to edit).
@@ -27,7 +27,7 @@ def _bump_npm(cwd: Path, name: str, version: str) -> bool:
2727 pattern = re .compile (rf'("{ escaped } "\s*:\s*")[^"]*(")' )
2828 new_text , count = pattern .subn (rf"\g<1>^{ version } \g<2>" , text )
2929 if count == 0 :
30- return False # not a direct dependency — let the agent tier handle it
30+ return False # not a direct dependency: let the agent tier handle it
3131 _write (manifest , new_text )
3232
3333 if shutil .which ("npm" ) and (cwd / "package-lock.json" ).exists ():
@@ -39,7 +39,7 @@ def _bump_npm(cwd: Path, name: str, version: str) -> bool:
3939 if shutil .which ("yarn" ) and (cwd / "yarn.lock" ).exists ():
4040 result = subprocess .run (["yarn" , "install" , "--mode" , "update-lockfile" ], cwd = cwd , capture_output = True )
4141 return result .returncode == 0
42- return False # no lockfile tool available to regenerate — don't leave it stale
42+ return False # no lockfile tool available to regenerate: don't leave it stale
4343
4444
4545def _bump_pip (cwd : Path , name : str , version : str ) -> bool :
@@ -93,7 +93,7 @@ def _bump_cargo(cwd: Path, name: str, version: str) -> bool:
9393 ["cargo" , "update" , "-p" , name , "--precise" , version ], cwd = cwd , capture_output = True ,
9494 )
9595 return result .returncode == 0
96- return True # no lockfile yet — the manifest edit alone is the fix
96+ return True # no lockfile yet: the manifest edit alone is the fix
9797
9898
9999_BUMPERS = {
@@ -107,7 +107,7 @@ def _bump_cargo(cwd: Path, name: str, version: str) -> bool:
107107def try_bump (cwd : str , ecosystem : str , name : str , target_version : str ) -> bool :
108108 """Attempt the deterministic fix. Returns True if the manifest (and
109109 lockfile, where applicable) were rewritten successfully. False means
110- "give up cleanly" — the caller escalates to the agent tier."""
110+ "give up cleanly": the caller escalates to the agent tier."""
111111 bumper = _BUMPERS .get (ecosystem )
112112 if bumper is None :
113113 return False
0 commit comments