Skip to content

fix(polymarket): stage exact raw-ops releases - #483

Merged
proerror77 merged 2 commits into
mainfrom
codex/polymarket-raw-ops-stage-449
Jul 29, 2026
Merged

proerror77 merged 2 commits into
mainfrom
codex/polymarket-raw-ops-stage-449

Conversation

@proerror77

@proerror77 proerror77 commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Change contract

Atomically stage one exact, manifest-addressed Polymarket raw-ops candidate from a root-owned artifact and exact source checkout, rejecting partial, mixed, mutable, or overwriting publication before any Gate or production mutation.

Closes #449

Out of scope

Dependency or merge order

Depends on #448 / PR #469, already merged at 3aae5ddc7c2a699c3d1b6ff95b1f322f6b8bd7e9. The separate cutover-receipt contract must follow this PR.

Focused validation

  • bash deployment/aliyun/test-polymarket-raw-ops-stage.sh
  • bash deployment/aliyun/test-polymarket-raw-ops-control-plane.sh
  • bash -n on all changed shell scripts
  • shellcheck on all changed shell scripts
  • YAML parse for both changed workflows
  • git diff --check
  • Two-axis review: standards approved; code review findings fixed and follow-up found no actionable issue
  • Counterexamples cover missing manifest, wrong candidate/source, self-consistent mixed controls, unexpected archive entries, symlinks, writable files, existing destination, publication race, and partial staging

Rollout / rollback impact

The new stage action writes only a new non-overwriting directory below /opt/monday/candidates/polymarket-raw-ops; it does not install global controls, start Gate/shadow, or mutate production. Failure removes only its private staging directory. Existing immutable releases remain untouched.

Summary by CodeRabbit

  • New Features

    • Added a secure staging workflow for validating and publishing immutable release candidates.
    • Added supervised gate controls to release bundles, including installation and status verification.
    • Added cutover support using verified candidate and gate evidence.
  • Documentation

    • Updated deployment guidance with the streamlined staging, gate validation, and cutover process.
  • Tests

    • Added coverage for manifest integrity, tampering, unsafe permissions, source mismatches, archive contents, race conditions, and incomplete staging cleanup.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Polymarket raw-ops staging

Layer / File(s) Summary
Control asset contracts
.github/workflows/acr-publish.yml, deployment/aliyun/polymarket-raw-ops-shadow-gate.sh, deployment/aliyun/polymarket-raw-ops-cutover.sh
Gate control assets are added to release bundles, and staging inputs, candidate paths, and CLI usage are defined.
Atomic candidate staging
deployment/aliyun/polymarket-raw-ops-cutover.sh, deployment/aliyun/README.md
stage_release validates manifests, hashes, source identity, control archives, and filesystem trust before atomically publishing a candidate; README instructions use this staging flow.
Staging contract validation
deployment/aliyun/test-polymarket-raw-ops-stage.sh, deployment/aliyun/test-polymarket-raw-ops-control-plane.sh, .github/workflows/ci.yml
New acceptance and rejection tests cover tampering, mixed controls, insecure files, collisions, races, and partial staging, with the stage tests added to CI and control-plane assertions updated.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant CutoverScript
  participant CandidateRoot
  participant Gate
  Operator->>CutoverScript: Run stage with artifact directory and source revision
  CutoverScript->>CutoverScript: Validate manifest, hashes, controls, and trust
  CutoverScript->>CandidateRoot: Atomically publish immutable candidate
  Gate->>CandidateRoot: Verify release binding
  Operator->>Gate: Install, start, and query terminal status
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the main change: staging exact raw-ops releases.
Linked Issues check ✅ Passed The PR adds an atomic stage command, strict manifest/hash/source validation, README updates, tests, and CI support, matching issue #449.
Out of Scope Changes check ✅ Passed The changes shown are all supporting the new staging flow and do not introduce unrelated scope.
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-raw-ops-stage-449

Warning

Tools execution failed with the following error:

Failed to run tools: 14 UNAVAILABLE: read ECONNRESET


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-raw-ops-stage-449 branch from 8d71119 to b96d700 Compare July 29, 2026 13:45
@proerror77
proerror77 merged commit 9a58ff1 into main Jul 29, 2026
37 of 38 checks passed
@proerror77
proerror77 deleted the codex/polymarket-raw-ops-stage-449 branch July 29, 2026 14:24

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 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-cutover.sh`:
- Around line 261-263: Update both secure_regular_file call sites in the
artifact validation loop and the stage_script validation path to append failure
handling with die, including the specific asset or path in each diagnostic.
Preserve the existing fail-closed behavior and README workflow while making
insecure or symbolic paths identifiable during manual runs.
🪄 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: be554c0b-5dd7-43e2-9283-82a19ad6aef0

📥 Commits

Reviewing files that changed from the base of the PR and between 0fed7a7 and aa5da40.

📒 Files selected for processing (7)
  • .github/workflows/acr-publish.yml
  • .github/workflows/ci.yml
  • deployment/aliyun/README.md
  • deployment/aliyun/polymarket-raw-ops-cutover.sh
  • deployment/aliyun/polymarket-raw-ops-shadow-gate.sh
  • deployment/aliyun/test-polymarket-raw-ops-control-plane.sh
  • deployment/aliyun/test-polymarket-raw-ops-stage.sh

Comment on lines +261 to +263
for asset in "${STAGE_ARTIFACT_ASSETS[@]}"; do
secure_regular_file "$artifact_dir/$asset"
done

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | rg 'deployment/aliyun/polymarket-raw-ops-cutover\.sh|README|test|tests?\.sh' || true

echo "== target file size =="
wc -l deployment/aliyun/polymarket-raw-ops-cutover.sh

echo "== relevant lines =="
sed -n '1,130p' deployment/aliyun/polymarket-raw-ops-cutover.sh
sed -n '230,280p' deployment/aliyun/polymarket-raw-ops-cutover.sh
sed -n '1010,1065p' deployment/aliyun/polymarket-raw-ops-cutover.sh

echo "== secure_regular_file occurrences =="
rg -n 'secure_regular_file|die \('\\''|-e|stage_release|STAGE_ARTIFACT_ASSETS' deployment/aliyun/polymarket-raw-ops-cutover.sh

echo "== test occurrences =="
rg -n 'symbolic artifact member|group/world-writable|artifact member|stage_release|STAGE_ARTIFACT_ASSETS|secure_regular_file|polymarket-raw-ops-cutover' -S .

Repository: proerror77/monday

Length of output: 1920


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== repository availability =="
pwd
git rev-parse --is-inside-work-tree || true
git remote -v || true
git branch -a || true

echo "== files =="
git ls-files | rg '(^|/)deployment/aliyun/polymarket-raw-ops-cutover\.sh$|README|test|tests?\.sh' || true

echo "== target file size =="
wc -l deployment/aliyun/polymarket-raw-ops-cutover.sh

echo "== relevant lines =="
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
  sed -n '1,130p' deployment/aliyun/polymarket-raw-ops-cutover.sh
  sed -n '230,280p' deployment/aliyun/polymarket-raw-ops-cutover.sh
  sed -n '1010,1065p' deployment/aliyun/polymarket-raw-ops-cutover.sh
fi

echo "== secure_regular_file occurrences =="
rg -n 'secure_regular_file|die \('\\''|-e|stage_release|STAGE_ARTIFACT_ASSETS' deployment/aliyun/polymarket-raw-ops-cutover.sh || true

echo "== test occurrences =="
rg -n 'symbolic artifact member|group/world-writable|artifact member|stage_release|STAGE_ARTIFACT_ASSETS|secure_regular_file|polymarket-raw-ops-cutover' -S . || true

Repository: proerror77/monday

Length of output: 1920


Require secure_regular_file to emit a diagnostic on failure.

secure_regular_file "$artifact_dir/$asset" and secure_regular_file "$stage_script" fail closed via errexit, but they do not report which artifact member or path was insecure or symbolic. Add || die '...' to both failure paths so manual runs preserve the existing README workflow with a clear error message.

🤖 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/polymarket-raw-ops-cutover.sh` around lines 261 - 263,
Update both secure_regular_file call sites in the artifact validation loop and
the stage_script validation path to append failure handling with die, including
the specific asset or path in each diagnostic. Preserve the existing fail-closed
behavior and README workflow while making insecure or symbolic paths
identifiable during manual runs.

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 raw-ops: atomically stage an exact immutable release

1 participant