fix(vedastro): pin SDK at install and cap free-tier wait
Image build patches vedastro.check_for_update to a no-op after pip install so import cannot hit pypi or upgrade the pin. Free-tier queue waits are capped to VEDASTRO_TIMEOUT_SECONDS and fail fast as free_tier_rate_limited. Gateway status exposes runtime mode as booleans without secrets. BUG-719 resolved; BUG-720 stays investigating until production env is filled in.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Neutralize vedastro SDK import-time PyPI upgrade. Fail the image build if the hook is missing."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
NOOP_SOURCE = 'def check_for_update(package_name="vedastro"):\n return None\n'
|
||||
|
||||
|
||||
def patch_update_check(path: Path) -> None:
|
||||
text = path.read_text(encoding="utf-8")
|
||||
if "def check_for_update" not in text:
|
||||
raise SystemExit(f"{path} does not define check_for_update")
|
||||
path.write_text(NOOP_SOURCE, encoding="utf-8")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
spec = importlib.util.find_spec("vedastro.update_check")
|
||||
if spec is None or not spec.origin:
|
||||
print("vedastro.update_check is not installed", file=sys.stderr)
|
||||
return 1
|
||||
path = Path(spec.origin)
|
||||
patch_update_check(path)
|
||||
print(f"neutralized {path}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user