Skip to content

fix(polymarket): accept verified noncanonical preflight - #432

Merged
proerror77 merged 2 commits into
mainfrom
codex/polymarket-real-preflight-noncanonical-431
Jul 28, 2026
Merged

fix(polymarket): accept verified noncanonical preflight#432
proerror77 merged 2 commits into
mainfrom
codex/polymarket-real-preflight-noncanonical-431

Conversation

@proerror77

@proerror77 proerror77 commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Change contract

Accept a real closed-segment compatibility preflight when the exact candidate uploads exactly one segment and the immutable OSS data/manifest/_SUCCESS triplet independently matches the source bytes and SHA, even when canonical_uploaded_segments is zero. Bind the 0/1 canonical count to the independently read-back manifest flags.

Out of scope

Dependency / merge order

None. Base is main at 170cdea. Merge before rebuilding the next raw-ops candidate and running a new real-segment preflight.

Focused validation

  • deployment/aliyun/test-polymarket-raw-ops-control-plane.sh
  • deployment/aliyun/test-polymarket-market-recorder-release.sh
  • bash -n and ShellCheck for the changed shell paths
  • git diff --check
  • Independent spec review: APPROVE
  • Independent standards review: APPROVE

The regression fixture runs the real candidate uploader on a format-valid, non-canonical closed segment and proves uploaded_segments=1, canonical_uploaded_segments=0, exact source/readback SHA, immutable triplet verification, and manifest/count binding. Negative coverage retains incompatible, empty/no-quote, cross-hour, unrelated-output, missing-triplet, tampered, multiple-upload, missing-flag, flag/count mismatch, negative-count, and non-canonical reference-Gate rejection.

Rollout / rollback impact

Control-plane policy only. Rollback is reverting this PR. Production remains Python until a separately governed real-segment preflight and complete 3600+601 second Gate pass.

PRD

None; this is the small, already-specified defect in #431.

Closes #431

Summary by CodeRabbit

  • Bug Fixes

    • Improved validation of canonical and complete market segments during uploads.
    • Correctly supports zero canonical segments while rejecting inconsistent counts or flags.
    • Strengthened checks for uploaded evidence and market metrics.
  • Tests

    • Expanded coverage for noncanonical uploads, inconsistent counts, missing flags, negative values, and duplicate uploads.
    • Added validation for canonical status consistency across upload summaries and manifests.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The real-market shadow gate now propagates and validates canonical metadata, accepts zero canonical uploaded segments when triplets are non-canonical, enforces policy consistency, and expands control-plane coverage for invalid canonical states.

Changes

Canonical Upload Validation

Layer / File(s) Summary
Triplet and preflight validation
deployment/aliyun/polymarket-raw-ops-shadow-gate.sh
OSS triplets now carry boolean canonical flags, require matching metadata, and compare canonical status with non-negative upload counts.
Gate policy consistency rules
deployment/aliyun/polymarket-shadow-gate-policy.jq
Policy checks require matching triplet flags and exact canonical-count derivation while allowing nonnegative canonical metrics.
Control-plane scenarios and assertions
deployment/aliyun/test-polymarket-raw-ops-control-plane.sh
Tests parameterize canonical counts, add non-canonical evidence, and reject inconsistent, missing, multiple, or negative canonical states.

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

Possibly related issues

Possibly related PRs

  • proerror77/monday#34 — Updates related raw-ops and shadow-gate policy wiring and tests.
  • proerror77/monday#286 — Modifies canonical and segment-completeness validation in the Polymarket triplet flow.
  • proerror77/monday#422 — Changes the same shadow-gate scripts and real-market preflight consistency checks.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy #431 by allowing verified non-canonical preflight uploads while preserving triplet, status, and canonical-count binding.
Out of Scope Changes check ✅ Passed The modified scripts and policy stay focused on the preflight contract and tests, without obvious unrelated product or uploader changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly summarizes the main change: accepting verified noncanonical preflight results.
Description check ✅ Passed The description covers the required contract, out-of-scope, dependency, validation, rollout, and scope-exception sections.
✨ 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-real-preflight-noncanonical-431

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.

@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: 543b967e1f

ℹ️ 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
@proerror77
proerror77 merged commit 00a2a8a into main Jul 28, 2026
40 checks passed
@proerror77
proerror77 deleted the codex/polymarket-real-preflight-noncanonical-431 branch July 28, 2026 17:02
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 real-segment preflight must accept verified non-canonical uploads

1 participant