Skip to content

investigate: preflight-scan change to shadow-gate triggers snapshot test failure (cross-impact on #586) #733

Description

@proerror77

Problem

Issue #586 (PR #730, bounded preflight scan) is blocked: its Rust Workspace check fails at the snapshot test (exercise_bootstrap_snapshot) with snapshot rejected: ...digest changed before rollback manifest. Investigation shows a cross-impact: the #586 preflight-scan change to polymarket-raw-ops-shadow-gate.sh triggers the snapshot test to fail, even though the two are code-independent.

What is known (all experiments)

Experiment Result Conclusion
main (after #732 sync fix) Monorepo CI gate PASS snapshot is green on main
#586 branch (preflight change + counterexample) FAIL #586 change triggers snapshot failure
#586 branch without counterexample still FAIL counterexample is NOT the cause
Local GNU-coreutils reproduction (full overrides) PASS logic is correct in isolation
#731 sync fix (PR #732) merged but ineffective not the root cause

Established facts

  • snapshot rejected comes from polymarket-raw-ops-cutover.sh:1080 (snapshotted Rust bootstrap binary digest changed before rollback manifest), i.e. after snapshot_legacy copies ACTIVE_BINARY into the rollback dir and sha256sum --check --stricts it against baseline_release_sha.
  • On CI the digest genuinely mismatches (sha256sum: WARNING: 1 computed checksum did NOT match); locally it matches.
  • The failing case is exercise_bootstrap_snapshot (test harness), whose install()/stat() overrides interact with snapshot_legacy's copying of /etc/systemd/system/* and the bootstrap binary.
  • Removing the counterexample from the test script does not change the outcome, so the trigger is the preflight-scan change to polymarket-raw-ops-shadow-gate.sh (or its interaction with the test harness's sed extraction of preflight functions).

Hypotheses to investigate

  1. Preflight sed-extraction interaction: the test script sed-extracts real_market_segment_preflight + PREFLIGHT_SCAN_WINDOW_RECORDS (L799-808). The preflight change may alter what is extracted, changing shell state that the later snapshot test relies on.
  2. stat() override over-broad: test stat() { printf '0755\n'; } returns 0755 for both -c %a (mode) and -c %u/%U (owner) queries. If the override is not scoped correctly for the bootstrap path, secure_regular_file's root-owner check breaks.
  3. install() override redirect: install -m "$mode" "/etc/systemd/system/$asset" must redirect to $systemd_fixture; if the redirect misses for a new path, the install fails and the copy target differs.
  4. CI environment/timing: main passes but fix(pm-gate): real-market preflight budget too small for tick-level segments #586 fails consistently; the preflight scan change may alter test ordering or resource usage such that the snapshot runs under different conditions.

Recommended approach

  • Dedicated worktree/branch on main; run deployment/aliyun/test-polymarket-raw-ops-control-plane.sh on CI (Linux) with only the preflight change, then bisect which part (sed extraction line, PREFLIGHT_SCAN_WINDOW_RECORDS constant, or the shadow-gate scan body) triggers the snapshot failure.
  • Add targeted debug to exercise_bootstrap_snapshot (print baseline_sha, rollback-bin sha, ACTIVE_BINARY sha at failure) — the existing SNAPSHOT_DEBUG instrumentation showed copied-binary-drift digest mismatch is expected, so focus on absent-control.

Blocks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentFully specified and safe for an autonomous agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions