🐛 the image proof asserted a refusal through pipefail
Browse files at this commit4a533beee35cb9c3e81a7c9b84103c145aeb7178Parent: 4c9d9bb- ci
- 🐛 the image proof asserted a refusal through pipefail
1 changed file +30 -7
- .github/workflows/main.yml +30 -7
.github/workflows/main.ymlmodified+30 -7
| @@ -229,29 +229,52 @@ jobs: | ||
| 229 | 229 | docker build -f Containerfile -t localhost/hezarfen_rag:$GITHUB_SHA . |
| 230 | 230 | |
| 231 | 231 | # VARSAYILAN İMGE KÜÇÜK MÜ (kullanıcı kararı 2026-09-17): yerel yığın |
| 232 | - # (torch/FlagEmbedding/ağırlıklar) İMAJA GİRMEZ; yerel yol bir EKLENTİ | |
| 232 | + # (torch/FlagEmbedding/ağırlıklar) İMAĞA GİRMEZ; yerel yol bir EKLENTİ | |
| 233 | 233 | # VOLUME'u ile açılır (deploy/provision_local_stack.sh). Bu iddialar |
| 234 | 234 | # imajın kendisinde ölçülür (runner'da torch KURULU, yani runner'da |
| 235 | 235 | # ölçmek yanıltıcı olurdu). |
| 236 | + # Every assertion here is an EXIT CODE or a CAPTURED STRING, never a | |
| 237 | + # pipeline's status: a refusal is *supposed* to exit non-zero | |
| 238 | + # (src/service/preflight.py -> `return 2` / `SystemExit(2)`), so the old | |
| 239 | + # `docker run … 2>&1 | grep -q …` under `set -o pipefail` handed that 2 | |
| 240 | + # back as the STEP's own status and killed a check that had actually | |
| 241 | + # passed (job 35303767476, exit 2, with the expected line in the log). | |
| 242 | + # Capturing first keeps the two facts separable — the message is asserted | |
| 243 | + # on $local_out, the code on $local_rc. | |
| 236 | 244 | - name: Prove the default image is API-only and refuses `local` cleanly |
| 237 | 245 | run: | |
| 238 | 246 | set -euo pipefail |
| 239 | 247 | img=localhost/hezarfen_rag:$GITHUB_SHA |
| 248 | + # 1. torch must be ABSENT inside the image: `python -c` exits 1 when it | |
| 249 | + # is present, and that non-zero code IS the assertion. | |
| 240 | 250 | docker run --rm "$img" python -c "import importlib.util, sys; sys.exit(1 if importlib.util.find_spec('torch') else 0)" |
| 241 | 251 | common=(--env RAG_ALLOW_UNCALIBRATED_ABSTAIN=1 --env LLM_API_KEY=ci) |
| 252 | + | |
| 253 | + # 2. the shipped default (api) must come up green: exit 0 is the assertion. | |
| 242 | 254 | docker run --rm "${common[@]}" \ |
| 243 | 255 | --env RAG_EMBED_PROVIDER=api --env RAG_EMBED_API_BASE=https://ornek/v1 \ |
| 244 | 256 | --env RAG_EMBED_MODEL=m --env RAG_EMBED_API_KEY=k \ |
| 245 | 257 | --env RAG_RERANK_PROVIDER=api --env RAG_RERANK_API_URL=https://ornek/rerank \ |
| 246 | 258 | --env RAG_RERANK_MODEL=m --env RAG_RERANK_API_KEY=k \ |
| 247 | 259 | "$img" python -m src.service.preflight |
| 248 | - if docker run --rm "${common[@]}" --env RAG_EMBED_PROVIDER=local \ | |
| 249 | - --env RAG_RERANK_PROVIDER=local "$img" python -m src.service.preflight; then | |
| 250 | - echo "local secimi kucuk imgede GECMEMELIYDI" >&2; exit 1 | |
| 260 | + | |
| 261 | + # 3. `local` must REFUSE — asserted twice, and neither assertion can be | |
| 262 | + # fooled by the other: the code must be non-zero, the message must | |
| 263 | + # name the provisioning script. | |
| 264 | + local_env=(--env RAG_EMBED_PROVIDER=local --env RAG_RERANK_PROVIDER=local) | |
| 265 | + local_rc=0 | |
| 266 | + local_out=$(docker run --rm "${common[@]}" "${local_env[@]}" "$img" \ | |
| 267 | + python -m src.service.preflight 2>&1) || local_rc=$? | |
| 268 | + printf '%s\n' "$local_out" | |
| 269 | + if [ "$local_rc" -eq 0 ]; then | |
| 270 | + echo "local secimi kucuk imgede GECMEMELIYDI (exit 0)" >&2 | |
| 271 | + exit 1 | |
| 272 | + fi | |
| 273 | + if ! printf '%s\n' "$local_out" | grep -q 'provision_local_stack.sh'; then | |
| 274 | + echo "ret metni saglama betigini adiyla soylemiyor (exit $local_rc)" >&2 | |
| 275 | + exit 1 | |
| 251 | 276 | fi |
| 252 | - docker run --rm "${common[@]}" --env RAG_EMBED_PROVIDER=local \ | |
| 253 | - --env RAG_RERANK_PROVIDER=local "$img" python -m src.service.preflight 2>&1 \ | |
| 254 | - | grep -q 'provision_local_stack.sh' | |
| 277 | + echo "kucuk imge dogrulandi: torch yok; api yolu yesil; local yolu exit $local_rc ile ret + ret metni saglama betigini adiyla soyluyor" | |
| 255 | 278 | |
| 256 | 279 | - name: Stage the release bundle |
| 257 | 280 | run: | |