fix(vedastro): pin SDK at install and cap free-tier wait
Independent Staging Quality Gate / validate (push) Successful in 9m36s
Independent Staging Quality Gate / publish (push) Successful in 18m18s

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:
jesse-ux
2026-09-16 00:25:15 +08:00
parent 62be52dacf
commit 6b3248bf53
9 changed files with 323 additions and 3 deletions
+32
View File
@@ -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())
+2 -1
View File
@@ -6,11 +6,12 @@ ENV PYTHONUNBUFFERED=1 \
PIP_DEFAULT_TIMEOUT=60
WORKDIR /app
COPY requirements.txt ./
COPY requirements.txt deploy/patch_vedastro_update_check.py ./
RUN sed -i 's|http://deb.debian.org|https://mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources \
&& apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 update \
&& apt-get install -y --no-install-recommends build-essential nodejs \
&& python -m pip install -r requirements.txt \
&& python patch_vedastro_update_check.py \
&& apt-get purge -y --auto-remove build-essential \
&& rm -rf /var/lib/apt/lists/*