Skip to content

fix(polymarket): wait for completed legacy health - #434

Merged
proerror77 merged 2 commits into
mainfrom
codex/polymarket-gate-legacy-health-wait-433
Jul 29, 2026
Merged

proerror77 merged 2 commits into
mainfrom
codex/polymarket-gate-legacy-health-wait-433

Conversation

@proerror77

@proerror77 proerror77 commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Closes #433

Change contract

For a legacy-Python baseline, the shadow Gate admits a current completed health publication or waits up to 3,900 seconds for one; no shadow starts after expiry.

Focused validation

  • Red: a policy-clean health file 241 seconds after its completed write is rejected.
  • Red: a health file that becomes fresh at the 3,900-second boundary is rejected.
  • Green: bash deployment/aliyun/test-polymarket-raw-ops-control-plane.sh
  • Green: bash -n and shellcheck on both changed scripts.
  • Two-axis review: standards APPROVE; spec APPROVE.

Out of scope

Python collector behavior, the legacy market-tape uploader incompatibility, research/snapshot/#235, production cutover, and immutable release replacement.

Dependency / merge order

None. Base is 00a2a8adbe67bbefd4807239a94671b44285935a (main at branch creation).

Rollout / rollback impact

A new immutable artifact and real closed-segment preflight remain required before a new full Gate. Reverting this PR restores immediate Gate admission failure outside the 240-second completed-write window; this PR changes no live control files.

PRD

A standalone PRD is unnecessary: this is the narrowly specified #433 Gate-admission bug fix with one public CLI seam.

Summary by CodeRabbit

  • Bug Fixes
    • Improved startup health checks by adding a bounded grace period for acquiring fresh legacy health data instead of failing immediately.
    • Revalidates baseline identity while waiting to avoid accepting stale or mismatched health observations.
    • Updated legacy-health snapshot boundary handling to align with the new bounded freshness wait.
  • Tests
    • Expanded legacy-health freshness admission tests to cover delayed, timed-out, and late health publications.
    • Added contract verification and bounded-time simulation to ensure correct wait and rejection behavior.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bda60f60-1c9c-4e53-a04a-ef2cbcd6254a

📥 Commits

Reviewing files that changed from the base of the PR and between 7e6e3a8 and b3accd3.

📒 Files selected for processing (2)
  • deployment/aliyun/polymarket-raw-ops-shadow-gate.sh
  • deployment/aliyun/test-polymarket-raw-ops-control-plane.sh
🚧 Files skipped from review as they are similar to previous changes (2)
  • deployment/aliyun/polymarket-raw-ops-shadow-gate.sh
  • deployment/aliyun/test-polymarket-raw-ops-control-plane.sh

📝 Walkthrough

Walkthrough

The shadow Gate now waits up to 3,900 seconds for a fresh legacy health publication while rechecking baseline identity. Control-plane tests cover successful polling, timeout, late publication, contract presence, and updated snapshot-boundary detection.

Changes

Legacy health admission

Layer / File(s) Summary
Gate bounded admission flow
deployment/aliyun/polymarket-raw-ops-shadow-gate.sh
Adds the 3,900-second startup deadline, bounded polling helper, identity revalidation, and startup integration for non-continuous freshness modes.
Admission contract and boundary tests
deployment/aliyun/test-polymarket-raw-ops-control-plane.sh
Extracts and verifies the new contract, tests successful and expired waits, and updates snapshot detection to reference the polling helper.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ShadowGate
  participant BaselineIdentity
  participant LegacyHealthEvidence
  ShadowGate->>LegacyHealthEvidence: Request fresh health observation
  LegacyHealthEvidence-->>ShadowGate: Return observation or freshness failure
  ShadowGate->>BaselineIdentity: Revalidate baseline identity
  BaselineIdentity-->>ShadowGate: Return identity status
  ShadowGate->>LegacyHealthEvidence: Retry until deadline or publication
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly captures the main change: waiting for completed legacy health before shadow start.
Description check ✅ Passed The description covers the required contract, validation, out-of-scope, dependencies, and rollout details with only minor template wording differences.
Linked Issues check ✅ Passed Implements #433: waits up to 3,900s for fresh legacy health, preserves identity gating, and adds stale/expiry tests.
Out of Scope Changes check ✅ Passed No unrelated collector, uploader, rollout, or control-file changes appear; the edits stay within the legacy health gate and its contract tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/polymarket-gate-legacy-health-wait-433

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proerror77
proerror77 force-pushed the codex/polymarket-gate-legacy-health-wait-433 branch from 9b7184b to b3accd3 Compare July 29, 2026 00:17
@proerror77
proerror77 merged commit 9d7b2cc into main Jul 29, 2026
38 checks passed
@proerror77
proerror77 deleted the codex/polymarket-gate-legacy-health-wait-433 branch July 29, 2026 00:27
Sign up for free to 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.

Gate: wait for the next completed legacy health publication before shadow start

1 participant