Fail Polymarket Gate before cutover target drift - #404
Conversation
📝 WalkthroughWalkthroughCutover and shadow-gate scripts now share fail-closed preflight checks for baseline mode, active binaries, systemd drop-ins, control-directory trust, bundled assets, and release manifests. Tests verify release binding, contract consistency, ordering, and legacy/Rust baseline scenarios. ChangesCutover control validation
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
deployment/aliyun/test-polymarket-raw-ops-control-plane.sh (1)
176-184: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a rejection case for an insecure/missing bundled asset.
Both cases here turn on the candidate SHA. Because
verify_control_releasedrops the return status of its per-assetsecure_control_filecall (polymarket-raw-ops-shadow-gate.shLine 224) and this harness overrides that helper with a non-dying predicate, removingfixture-controlwould still let the positive assertion at Line 176 pass. A case that deletes or symlinks$release_manifest_dir/fixture-controland expects rejection would pin the fix.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@deployment/aliyun/test-polymarket-raw-ops-control-plane.sh` around lines 176 - 184, The test harness lacks coverage for a missing or insecure bundled asset because both existing assertions vary only the candidate SHA. Add a rejection case that removes or symlinks "$release_manifest_dir/fixture-control", invokes verify_control_release with the valid candidate SHA, and asserts failure; use the existing fixture-control setup and harness cleanup conventions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@deployment/aliyun/polymarket-raw-ops-shadow-gate.sh`:
- Around line 222-225: The verify_control_release asset and manifest checks must
propagate predicate failures instead of silently continuing. In
deployment/aliyun/polymarket-raw-ops-shadow-gate.sh:222-225, include asset in
the local declarations and return 1 when either secure_control_file call fails;
apply the identical corresponding change to verify_control_release in
deployment/aliyun/polymarket-raw-ops-cutover.sh. In
deployment/aliyun/test-polymarket-raw-ops-control-plane.sh:176-184, add a
rejection case that removes or symlinks release_manifest_dir/fixture-control to
verify dropped asset-check status is detected.
---
Nitpick comments:
In `@deployment/aliyun/test-polymarket-raw-ops-control-plane.sh`:
- Around line 176-184: The test harness lacks coverage for a missing or insecure
bundled asset because both existing assertions vary only the candidate SHA. Add
a rejection case that removes or symlinks
"$release_manifest_dir/fixture-control", invokes verify_control_release with the
valid candidate SHA, and asserts failure; use the existing fixture-control setup
and harness cleanup conventions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8921f2ec-667a-469b-aed2-cb4c936ced61
📒 Files selected for processing (3)
deployment/aliyun/polymarket-raw-ops-cutover.shdeployment/aliyun/polymarket-raw-ops-shadow-gate.shdeployment/aliyun/test-polymarket-raw-ops-control-plane.sh
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b99e0ac2f
ℹ️ 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".
Change contract
Fail the Polymarket shadow Gate before its observation clock when the production cutover target already contains control or systemd state that the promotion path would reject, and repeat the same read-only check before transition.
Out of scope
Collector behavior, Gate duration, PID or immutable evidence semantics, snapshot or research logic, and issue #235.
Dependency or merge order
None.
Focused validation
Rollout / rollback impact
Future release bundles fail before the 4201-second observation if the target is already unsafe, then recheck immediately before transition. The currently running immutable #326 candidate is unchanged. Roll back by reverting this PR.
A PRD is unnecessary because this is a small, already-specified deployment-order defect with one behavior contract.
Closes #403
Summary by CodeRabbit
Bug Fixes
Tests