forge
Explore
Log in

Don't you dare go Hollow

🐛 the image proof asserted a refusal through pipefail

Browse files at this commit

4a533beee35cb9c3e81a7c9b84103c145aeb7178Ahmet Kaan GümüşParent: 4c9d9bb
  • ci
    • 🐛 the image proof asserted a refusal through pipefail
Show full message
ci: 🐛 the image proof asserted a refusal through pipefail

The suite-skip path exposed a latent defect one step after the gate: "Prove
the default image is API-only and refuses `local` cleanly" ended with

    docker run --rm … "$img" python -m src.service.preflight 2>&1 \
      | grep -q 'provision_local_stack.sh'

under `set -euo pipefail`, and the refusal it asserts on exits 2 by design
(src/service/preflight.py: main() returns 2, enforce() raises SystemExit(2)).
pipefail therefore handed that 2 back as the STEP's own status: job
35303767476 died at exit 2 with the expected line sitting in the log, while
the two checks before it (torch absent, api path green) had passed.

Not introduced by the gate commit: the shape and the exit 2 both came from
1d40da1 (2026-09-17 20:52), which post-dates the last green run (15f1244,
16:48) — the Test-step hang had been masking it ever since.

The assertions are now explicit and separable: the output goes to $local_out,
the exit code to $local_rc; `local` must exit non-zero AND its message must
name the provisioning script; the api path must exit 0; torch must be absent
inside the image. Swept the workflow for the same shape — the only other
pipelines in steps that survive the suite skip are `docker save | gzip` and
`tar | ssh`, where a non-zero producer MUST fail the step (kept as-is,
deliberately), and no surviving step touches the runner's pip environment
(every `python` there runs inside `docker run "$img"`), so the skip cannot
leave a half-provisioned environment.

Proven locally without an engine: the pre-fix step bytes extracted from the
YAML reproduce the failure (exit 2) against a stubbed docker whose refusal
mirrors preflight's real text, and the post-fix bytes are green on the
intended path and non-zero on three mutated stubs (message without the script
name; local path exiting 0 anyway; torch present in the image).
Local-Gate: ebec10c92d0a3f8f23b464d0743940bc3680df9b (1387 passed, 31s)
.github/workflows/main.ymlmodified+30 -7
@@ -229,29 +229,52 @@ jobs:
229 docker build -f Containerfile -t localhost/hezarfen_rag:$GITHUB_SHA .229 docker build -f Containerfile -t localhost/hezarfen_rag:$GITHUB_SHA .
230 230
231 # VARSAYILAN İMGE KÜÇÜK MÜ (kullanıcı kararı 2026-09-17): yerel yığın231 # 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 # VOLUME'u ile açılır (deploy/provision_local_stack.sh). Bu iddialar233 # VOLUME'u ile açılır (deploy/provision_local_stack.sh). Bu iddialar
234 # imajın kendisinde ölçülür (runner'da torch KURULU, yani runner'da234 # imajın kendisinde ölçülür (runner'da torch KURULU, yani runner'da
235 # ölçmek yanıltıcı olurdu).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 - name: Prove the default image is API-only and refuses `local` cleanly244 - name: Prove the default image is API-only and refuses `local` cleanly
237 run: |245 run: |
238 set -euo pipefail246 set -euo pipefail
239 img=localhost/hezarfen_rag:$GITHUB_SHA247 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 docker run --rm "$img" python -c "import importlib.util, sys; sys.exit(1 if importlib.util.find_spec('torch') else 0)"250 docker run --rm "$img" python -c "import importlib.util, sys; sys.exit(1 if importlib.util.find_spec('torch') else 0)"
241 common=(--env RAG_ALLOW_UNCALIBRATED_ABSTAIN=1 --env LLM_API_KEY=ci)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 docker run --rm "${common[@]}" \254 docker run --rm "${common[@]}" \
243 --env RAG_EMBED_PROVIDER=api --env RAG_EMBED_API_BASE=https://ornek/v1 \255 --env RAG_EMBED_PROVIDER=api --env RAG_EMBED_API_BASE=https://ornek/v1 \
244 --env RAG_EMBED_MODEL=m --env RAG_EMBED_API_KEY=k \256 --env RAG_EMBED_MODEL=m --env RAG_EMBED_API_KEY=k \
245 --env RAG_RERANK_PROVIDER=api --env RAG_RERANK_API_URL=https://ornek/rerank \257 --env RAG_RERANK_PROVIDER=api --env RAG_RERANK_API_URL=https://ornek/rerank \
246 --env RAG_RERANK_MODEL=m --env RAG_RERANK_API_KEY=k \258 --env RAG_RERANK_MODEL=m --env RAG_RERANK_API_KEY=k \
247 "$img" python -m src.service.preflight259 "$img" python -m src.service.preflight
248- if docker run --rm "${common[@]}" --env RAG_EMBED_PROVIDER=local \260+
249- --env RAG_RERANK_PROVIDER=local "$img" python -m src.service.preflight; then261+ # 3. `local` must REFUSE — asserted twice, and neither assertion can be
250- echo "local secimi kucuk imgede GECMEMELIYDI" >&2; exit 1262+ # 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 fi276 fi
252- docker run --rm "${common[@]}" --env RAG_EMBED_PROVIDER=local \277+ echo "kucuk imge dogrulandi: torch yok; api yolu yesil; local yolu exit $local_rc ile ret + ret metni saglama betigini adiyla soyluyor"
253- --env RAG_RERANK_PROVIDER=local "$img" python -m src.service.preflight 2>&1 \
254- | grep -q 'provision_local_stack.sh'
255 278
256 - name: Stage the release bundle279 - name: Stage the release bundle
257 run: |280 run: |