iotxing-lab-prod-deploy-cancelled-20261205
Times are Asia/Shanghai (UTC+8) unless a timestamp carries its own offset.
Git commit dates below are shown as recorded (seed/main commits used +08;
github-actions[bot] commits on lab-prod were recorded in UTC and are converted here).

Repo: https://github.com/shuizhengqi1/iotxing-lab-prod-deploy-cancelled-20261205
(public; fixture shop only; emails such as chen@shop.invalid; no real PII; no real card numbers)
lab-prod is a file-backed stand-in database (prod/orders.json, prod/deploy_state.json),
not a real merchant production system. The deploy job (not a person) updates that branch.
GITHUB_TOKEN pushes to lab-prod do not start a new workflow run; deploy.yml triggers only on main.
Fixture commits were written by hand, not by a live coding model.
No Windows run; no claims about machine 6.

========== Commits (main) ==========
- seed  950e92d124fa40ac14c74d5e012d1447e0310215  2026-12-05 18:43:39 +08
  fixture shop, 30 orders conceived without partner_id; no deploy workflow yet
- chore  a4b6a5c359d23cdd05ce3d8a382d0a829a4fce97  18:43:51 +08
  ignore pytest cache
- SHA-A (machine 1)  63e02fc64f35be670447e7f94288db60a1545352  18:44:29 +08
  tag experiment-a-sha-a
  adds .github/workflows/deploy.yml (concurrency group production-deploy,
  cancel-in-progress: true) and scripts/deploy.py
  backfill rule DEFAULT_PARTNER_ID=internal
- SHA-B (machine 2)  72fdbc44fd96c90737583b81c468c5397cc09ee8  18:45:15 +08
  tag experiment-a-sha-b
  leftover / new checkout default DEFAULT_PARTNER_ID=web
  pushed while run A was mid-backfill

lab-prod seed  ca87554d28e4dd7086424c21031b5e903a16615d  18:43:39 +08
  tag lab-prod-seed
  30 orders, all missing partner_id, deploy_state status=live on 950e92d124fa

========== Experiment A (real GitHub Actions) ==========
Desired failure, observed honestly.

Run A  47510919673  conclusion=cancelled
  https://github.com/shuizhengqi1/iotxing-lab-prod-deploy-cancelled-20261205/actions/runs/47510919673
  job 145645754863  https://github.com/shuizhengqi1/iotxing-lab-prod-deploy-cancelled-20261205/actions/runs/47510919673/job/145645754863
  created 18:44:40  job started 18:44:42  job completed 18:45:33  run updated 18:45:34
  DEPLOY_START ref=refs/heads/main sha=63e02fc64f35be670447e7f94288db60a1545352  at 18:44:45
  DEPLOY_FETCHED total=30 missing=30 deploy_status=live
  lab-prod commit 1aeed3b8586b0797ba6817112d65fd9facd912f8  10:44:45Z = 18:44:45
    "deploy start migrating rule=internal"
  BACKFILL_START rule=internal pending=30 sleep=5.0
  lab-prod commit 3a2c1573ed1d6845144e16828bb43b4556631e28  10:45:11Z = 18:45:11
    "backfill progress internal=5 web=0 missing=25"
  BACKFILL_PROGRESS total=30 partner_internal=5 missing=25 deploy_status=migrating  at 18:45:12
  ##[error]The operation was canceled.  at 18:45:31
  No DEPLOY_DONE.

Orders backfilled by A before cancel (partner_id=internal, assigned_by_sha=SHA-A):
  ord_1001 18:44:51, ord_1002 18:44:56, ord_1003 18:45:01,
  ord_1004 18:45:06, ord_1005 18:45:11.

Mid-state when SHA-B was pushed (18:45:15, snapshot before-sha-b):
  status=migrating  rule=internal  deploy_sha=SHA-A
  internal=5  web=0  missing=25

Run A2 (second main push, still experiment A)  47510976235  conclusion=failure
  https://github.com/shuizhengqi1/iotxing-lab-prod-deploy-cancelled-20261205/actions/runs/47510976235
  job 145645990949  https://github.com/shuizhengqi1/iotxing-lab-prod-deploy-cancelled-20261205/actions/runs/47510976235/job/145645990949
  created 18:45:18  (pending while A still in_progress)  job started 18:45:36
  job completed 18:48:08  run updated 18:48:09
  DEPLOY_START ref=refs/heads/main sha=72fdbc44fd96c90737583b81c468c5397cc09ee8  at 18:45:44
  DEPLOY_FETCHED total=30 partner_internal=5 partner_web=0 missing=25 deploy_status=migrating
  Started a second backfill with rule=web on that dirty mid-state.
  Filled remaining 25 orders as partner_id=web (ord_1006..ord_1030, assigned_by_sha=SHA-B).
  Last remote progress commit f102e453a77e5b6e8924ab8eae4b42872003e391  10:47:57Z = 18:47:57
    internal=5 web=25 missing=0  still status=migrating  finished_at=null
  Local commit "deploy done live" (5a8fd2e) was created on the runner but
    git push origin HEAD:lab-prod was remote rejected at 18:48:05:
    "! [remote rejected] HEAD -> lab-prod (failed)"
    "error: failed to push some refs"
  No DEPLOY_DONE in the job log. Remote lab-prod tip remained f102e45
  (tag experiment-a-lab-prod-dirty, branch lab-prod-after-experiment-a).

Final dirty evidence (experiment A, live lab-prod after restore):
  status=migrating
  deploy_sha=72fdbc44fd96c90737583b81c468c5397cc09ee8
  rule=web
  finished_at=null
  internal=5  web=25  missing=0
  The first migration never marked complete. The second run mutated 25 rows
  under a different rule, then failed the hook. Mixed catalog + stuck lock.

========== Experiment B (real GitHub Actions, after a disclosed force-push) ==========
Force-pushed lab-prod back to seed ca87554 at 18:50:08 (experiment A tip kept
on tag/branch above). Temporarily set cancel-in-progress: false on main.

SHA-B1  9b2e2ce3765282a62cae89abfb8647fa55bdbfcb  18:50:09 +08
  tag experiment-b-sha-b1
  cancel-in-progress: false, DEFAULT_PARTNER_ID=internal
SHA-B2  d408f6b0870ab72a5f9a557ce9a6354e823871b6  18:50:16 +08
  tag experiment-b-sha-b2  branch experiment-b
  DEFAULT_PARTNER_ID=web, pushed while run B1 was already in_progress

Run B1  47511386014  conclusion=success
  https://github.com/shuizhengqi1/iotxing-lab-prod-deploy-cancelled-20261205/actions/runs/47511386014
  job 145647207030  https://github.com/shuizhengqi1/iotxing-lab-prod-deploy-cancelled-20261205/actions/runs/47511386014/job/145647207030
  created 18:50:12  started 18:50:14  completed 18:53:00  updated 18:53:01
  DEPLOY_START sha=9b2e2ce... at 18:50:17
  BACKFILL_START pending=30 rule=internal
  DEPLOY_DONE at 18:52:58 backfilled=30  deploy_status=live
  all 30 orders partner_id=internal

Run B2  47511396816  conclusion=success
  https://github.com/shuizhengqi1/iotxing-lab-prod-deploy-cancelled-20261205/actions/runs/47511396816
  job 145647959151  https://github.com/shuizhengqi1/iotxing-lab-prod-deploy-cancelled-20261205/actions/runs/47511396816/job/145647959151
  created 18:50:19
  Observed status=pending while B1 was still in_progress (first seen 18:50:26;
  still pending through the internal backfill; also seen status=queued at 18:53:03
  just after B1 completed).
  job started 18:53:03  completed 18:53:11  updated 18:53:11
  DEPLOY_START sha=d408f6b... at 18:53:05
  DEPLOY_FETCHED total=30 partner_internal=30 missing=0 deploy_status=live
  BACKFILL_START rule=web pending=0
  DEPLOY_DONE at 18:53:08 backfilled=0  deploy_status=live
  Final catalog still 30 internal / 0 web (idempotent skip of existing partner_id).
  lab-prod tip then 719d734d0d30338cd30785d224fffbb6e4f7ab6c
  (tag experiment-b-lab-prod-final)

SAW_QUEUE=1 on real GitHub Actions. B1 was not cancelled.

========== Local mutex (NOT GitHub Actions) ==========
scripts/deploy.py ENFORCE_DEPLOY_MUTEX=1, LOCAL_PROD_DIR, SHA-A code (internal rule).
After a simulated mid-backfill cancel (internal=10, missing=20, status=migrating):
  DEPLOY_BLOCKED reason=already_migrating held_by=local-mutex-first
  exit 1; counts and lock unchanged.
This was not installed as the live required workflow. The live workflow after
recording is again the buggy cancel-in-progress: true (see restore below).

========== Restore (disclosed force-push) ==========
To keep experiment A's dirty evidence as the live lab tips without starting a
fifth deploy, GitHub Actions was temporarily disabled, then:
  main    force-pushed to 72fdbc44fd96c90737583b81c468c5397cc09ee8
          (buggy cancel-in-progress: true)
  lab-prod force-pushed to f102e453a77e5b6e8924ab8eae4b42872003e391
          (dirty mixed state from experiment A)
Actions was then re-enabled. Run list still has exactly the four runs above;
no fifth workflow run was created.

========== What is GitHub vs local ==========
GitHub Actions (real): experiment A cancellation + dirty mixed state;
  experiment B queued then success on a consistent database.
Local only: mutex exit-non-zero when status=migrating.
Not tested: Windows, a real merchant database, an implemented rollback/down
  migration, branch protection, GitHub Environment reviewers, orchestrators
  other than GitHub Actions concurrency, isolated reproduction of the sparse
  "remote rejected (failed)" on the last live push of run 47510976235.
