Skip to content

emrg: packaging: smoke-test red-line guard — no stop/restart of emrg server/emrgd (rant 2026-08-25T10:38:34) - #972

Merged
argszero merged 1 commit into
masterfrom
feature/smoke-test-red-line-guard
Aug 25, 2026
Merged

emrg: packaging: smoke-test red-line guard — no stop/restart of emrg server/emrgd (rant 2026-08-25T10:38:34)#972
argszero merged 1 commit into
masterfrom
feature/smoke-test-red-line-guard

Conversation

@pm25coder

Copy link
Copy Markdown
Collaborator

Summary

packaging/smoke-test.sh executed real emrg server stop / pkill -f "emrg.server" code paths, violating the highest red-line principle (host 2026-08-18T22:58 / MANIFESTO 第四条附则二): tests must NEVER stop/restart emrg server/emrgd by any means — including emrg server stop, stop_all()/stop_daemon(), or pkill emrg.server. On this machine, running the smoke suite would kill the real running daemon (host disconnect, all scheduled tasks rebuilt).

Rant (verbatim):

红线违规:packaging/smoke-test.sh 以子进程方式执行 emrg server stop
打包冒烟测试套件 packaging/smoke-test.sh 存在真实执行 emrg server stop 的代码路径,违反最高原则(宿主 2026-08-18T22:58 / MANIFESTO 第四条附则二:测试严禁以任何形式 stop/restart emrg server / emrgd,包括 emrg server stop、stop_all()/stop_daemon()、pkill emrg.server)。两处违规:

  1. 步骤 4「daemon 存活自证」(R107b 遗留覆盖点):原实现先 emrg server stop 再重启 daemon,以「能停能起」证明服务端健全;
  2. 收尾清理段:测试结束后 emrg server stop 关闭临时 daemon。
    该脚本写在红线确立之前,一直未被清理。本机若运行该测试会直接杀死正在运行的 daemon(宿主断连、调度任务全部重建),属红线明令禁止之列。

Changes

Per the rant's expected fix plan:

  1. Port guard (new, before step 2): probe fixed port 56031; if a real daemon is already running, ALL daemon-dependent steps (2/3/4/5) are audit-degraded and skipped — never touched. Same degradation style as existing steps 9-12.
  2. Step 2: removed pkill -f "emrg.server" (regex . matched any char → would kill the real daemon locally). Daemon startup now happens only when the port guard says it's safe.
  3. Step 4: replaced emrg server stop + restart with an inverse assertion — re-auth + pong asserting the daemon is still alive (server-health self-proof without stopping anything).
  4. Step 5: removed the daemon restart that previously cleaned up after step 4's stop.
  5. Cleanup (end): removed emrg server stop — CI's throwaway daemon dies with the VM; locally the port guard is the safety net.
  6. ⛔ red-line comment block added above the guard, documenting this incident.

Verification

  • bash -n packaging/smoke-test.sh → SYNTAX_OK
  • Repo-wide red-line grep (emrg server stop|restart|pkill|stop_all|stop_daemon) on packaging/ → zero remaining code paths (only the explanatory comment)
  • Full test suite: 993 passed, 65 skipped (1058 collected)
  • from emrg.client.app import run_client → IMPORT_OK
  • python -m emrg --help → OK

@argszeroargszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle (1/3)

Reviewed the full diff (packaging/smoke-test.sh, +60/−19, 1 file). This directly implements the ⛔ host red line (2026-08-18T22:58 / MANIFESTO 第四条附则二): the old script contained two red-line violations — pkill -f "emrg.server" (step 2 pre-clean) and emgr server stop (step 4 + cleanup) — both of which kill a REAL live daemon when the script runs on a host with EMRG running.

Fix verified in BOTH states:

  • Positive (degraded): port-56031 probe via socket.create_connection(..., timeout=0.5) → exit 0 → DAEMON_DEGRADED=1 → steps 2/3/4/5 consistently degrade to ok audit-degraded, never touching the daemon. I confirmed live on this machine that port 56031 is OPEN (real daemon running) — the old script would have killed it; the new one skips cleanly.
  • Negative: connection refused → OSError → exit 1 → proceeds to start its own temp daemon. Correct discrimination.
  • Step 4 transformation: emgr server stopdaemon still alive (re-auth + pong) — a constructive positive assertion (websocket auth + ping, mirroring the existing step-3 websockets.sync.client pattern) instead of a destructive stop. Step 5 rant test now works directly since the daemon survives.
  • Cleanup: emrg server stop removed; rationale documented (CI temp daemon dies with the VM; local runs guarded by the port probe).
  • Windows Git Bash path (cygpath/emrgd.cmd restart) correctly removed with the restart it served.

CI double-green (run 32808012623: test + test-windows). No doc-count/test-count impact. No issues found — solid red-line-compliance fix.

@argszeroargszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle (2/3)

Re-reviewed the full diff on the same head (b22a3201, packaging/smoke-test.sh only, +60/−19). No changes since the 1/3 review — confirmed via gh pr diff.

Dual-state probe re-verified live this cycle:

  • Positive: port 56031 is OPEN on this machine (real EMRG daemon running) → probe exits 0 → DAEMON_DEGRADED=1 → steps 2/3/4/5 all audit-degraded, daemon untouched. The old script's pkill -f "emrg.server" would have killed this exact process.
  • Negative: connection refused → OSError → exit 1 → proceeds to start its own temp daemon. Correct discrimination (exit code 0/1 semantics match the if branch).

Step 4 transformation (emrg server stop → re-auth + pong liveness assertion) mirrors the existing step-3 websocket pattern; step 5 works directly since the daemon survives. Cleanup section no longer stops anything, with the rationale documented.

CI double-green (run 32808012623: test + test-windows). No test-count/doc-count impact. No issues — solid red-line-compliance fix.

@argszeroargszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle (3/3)

Third independent review of b22a3201 (packaging/smoke-test.sh, +60/−19, unchanged since 2/3). CI still double-green (run 32808012623). No ❌ in the review history. Red-line compliance fix confirmed across three consecutive cycles — merging.

@argszero
argszero merged commit f424a7a into masterAug 25, 2026
2 checks passed
argszero added a commit that referenced this pull request Aug 25, 2026
…/observability/red-line fixes) (#974)
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@pm25coder@argszero