Skip to content

fix(deploy): adjudicate unsatisfiable Polymarket shadow gate trade parity - #875

Merged
proerror77 merged 4 commits into
mainfrom
fix/polymarket-shadow-gate-finalization-parity
Aug 14, 2026
Merged

fix(deploy): adjudicate unsatisfiable Polymarket shadow gate trade parity#875
proerror77 merged 4 commits into
mainfrom
fix/polymarket-shadow-gate-finalization-parity

Conversation

@proerror77

Copy link
Copy Markdown
Owner

Change

The 3600s Polymarket shadow gate's parity phase compares the candidate against the running baseline with a trade coverage/field/byte parity trio. When the shadow candidate uses finalization-deferred emission (post-#680: trades emitted only after settlement + 1800s lag + 3 stable polls) and the baseline emits continuously (pre-#680), no mature shadow trade can exist inside the gate window — the trio is mathematically unsatisfiable, and every post-#680 legacy_overlap gate has failed with rust_trade_count=0 despite byte-exact metadata (161/161) and settlement (112/112) parity and a green real-market upload preflight.

The gate now detects both sides' emission modes from the collector health schema and records a trade_parity_mode:

  • finalization_deferred_overlap (mixed semantics): the trio is replaced, not dropped — the raw verifier failure must be confined to the trade family; metadata/settlement/rotation/asset/dedupe parity must pass; the shadow must emit no trade the baseline lacks; the finalization pipeline must engage (tracked/settled/stable-poll counters sampled from the shadow state each cycle, eviction-safe running maxima); the canonical upload still runs.
  • continuous_overlap / rust_self (same semantics both sides): full trade parity required exactly as before.

The verdict JSON records the applied mode, both emission modes, the raw verifier checks (parity_verifier), the progression counters (finalization_progress), and a human-readable reason, so the evidence stays self-explanatory. The policy binds the mode to the detected semantics so a gate cannot silently downgrade.

Issue relationship

Closes #868

Validation

  • bash deployment/aliyun/test-polymarket-raw-ops-control-plane.sh — passed (includes new regression pins: finalization-mode shadow + legacy-emission baseline → trade coverage not required and forged variants rejected; same-semantics overlap → trade coverage still required; downgrade attempts rejected). Note: the suite needs GNU date on macOS (pre-existing; gate-control.sh uses date -d), run with a gdate shim on PATH.
  • bash deployment/aliyun/test-polymarket-raw-ops-stage.sh — passed.
  • git diff --check — clean; shellcheck on the gate script — clean (runs inside the control-plane suite).

Runtime impact and rollback

No runtime or host changes in this PR: it amends gate verdict adjudication and policy. The next candidate gate run applies the new policy via its release control bundle. Rollback: revert this commit; gates against a pre-#680 continuous baseline then fail closed as before.

…rity

A finalization-deferred shadow (post-#680) emits a market's trades only
after settlement plus the 1800-second finalization lag plus stable polls,
so against a continuous-emission baseline no mature shadow trade can exist
inside the 3600-second gate window: the trade coverage/field/byte parity
trio is unsatisfiable by construction and every post-#680 legacy_overlap
gate has failed with rust_trade_count=0 despite green metadata,
settlement, rotation, asset, and dedupe parity.

Detect both emission modes from the collector health schema. In the mixed
case, replace the trio with equivalent-strength satisfiable evidence: the
remaining parity families must pass, the raw verifier failure must be
confined to the trade family, the shadow must emit no trade the baseline
lacks, the finalization pipeline must engage (tracked/settled/stable-poll
counters from the shadow state, eviction-safe running maxima), and the
canonical upload still runs. The verdict records the applied trade parity
mode, both emission modes, the raw verifier checks, and the reason.
Same-semantics gates keep full trade parity unchanged.

Closes #868
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@proerror77, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 44f57fff-aa81-4d1d-9373-23a63beb78a0

📥 Commits

Reviewing files that changed from the base of the PR and between 22c1b5a and 661387a.

📒 Files selected for processing (4)
  • deployment/aliyun/README.md
  • deployment/aliyun/polymarket-raw-ops-shadow-gate.sh
  • deployment/aliyun/polymarket-shadow-gate-policy.jq
  • deployment/aliyun/test-polymarket-raw-ops-control-plane.sh

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 enabled auto-merge (squash) August 14, 2026 03:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f6159f8f88

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread deployment/aliyun/polymarket-raw-ops-shadow-gate.sh Outdated
Comment thread deployment/aliyun/polymarket-raw-ops-shadow-gate.sh Outdated
Comment thread deployment/aliyun/polymarket-raw-ops-shadow-gate.sh Outdated
Sonic Shih and others added 2 commits August 14, 2026 12:21
- initialize the finalization maxima once to null; an empty second
  assignment made the first jq fold die before parity
- classify collector emission mode by the collect-reference CLI contract:
  #680 removed --max-retained-trade-ids exactly when finalization-deferred
  emission replaced per-poll emission, so the probe binds to #680 rather
  than the later post-#743 health counter, and any probe uncertainty
  classifies continuous (fail-closed, full trade parity)
- require finalization advancement, not existence: a positive growing
  stable-poll maximum (zero until the 1800-second lag elapses) or a
  growing settled maximum, mirrored in the gate policy, with flat-counter
  forged evidence rejected and single-channel growth accepted in the
  control-plane contract tests

Refs #868
@proerror77
proerror77 merged commit bb8929e into main Aug 14, 2026
42 checks passed
@proerror77
proerror77 deleted the fix/polymarket-shadow-gate-finalization-parity branch August 14, 2026 04:29
This was referenced Aug 14, 2026
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.

polymarket shadow gate trade parity unsatisfiable for post-#680 candidates vs pre-#680 baseline

1 participant