fix(deploy): adjudicate unsatisfiable Polymarket shadow gate trade parity - #875
Conversation
…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
|
Warning Review limit reached
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
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. Comment |
There was a problem hiding this comment.
💡 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".
- 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
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_overlapgate has failed withrust_trade_count=0despite 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 GNUdateon macOS (pre-existing;gate-control.shusesdate -d), run with agdateshim on PATH.bash deployment/aliyun/test-polymarket-raw-ops-stage.sh— passed.git diff --check— clean;shellcheckon 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.