Skip to content

fix(prediction): separate AutoFactor discovery by token side - #147

Merged
proerror77 merged 3 commits into
mainfrom
codex/polymarket-side-bound-autofactor
Jul 19, 2026
Merged

fix(prediction): separate AutoFactor discovery by token side#147
proerror77 merged 3 commits into
mainfrom
codex/polymarket-side-bound-autofactor

Conversation

@proerror77

@proerror77 proerror77 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Change contract

Make full-depth 10s/30s repricing AutoFactor discovery consume a mandatory typed ReviewSide, filter rows before matrix/rolling evaluation, and provide a fail-closed side-bound artifact writer that persists under target/<side>/; the legacy pooled writer rejects repricing or side-tagged inputs.

Out of scope

CLI persistence/resume for side-bound artifacts, Alpha Zoo side-aware production and registry migration, candidate-replay identity parsing, Research OS runtime de-duplication, settlement evaluator semantics and legacy settlement-plan fanout, full-tick collection, 15m/1h missions, ECS/runtime rollout, and episode-aware rolling boundaries.

Dependency or merge order

Base: main at 2175a2352a804925b9fbb6e10967e0647b42d7ef from PR #146. No stacked dependency. The later side-bound producer/resume PR depends on this API after merge.

Focused validation

  • Scope: 7 files, 539 additions / 66 deletions = 605 changed lines, below the 750-line assessment threshold
  • git diff --check
  • rustfmt --edition 2021 --check on all five modified Rust files
  • jq empty on both mission JSONs
  • Exact 36-source plus reviewed dependency fingerprint recomputation; both mission pins equal sha256:5d15126651a93b08bfb60922b7a7957ff3bdae4ae31220c43008c41e70b65184
  • Counterexamples cover mixed Up/Down rows, missing requested-side rows, separate Up/Down output paths, wrong-side prior state, and pooled-writer rejection before output creation
  • Rust compile/test runs only in cloud CI per repository workflow constraint

Rollout/rollback impact

Research-only foundation. The evaluator now mines and reports Up/Down repricing lanes independently but deliberately does not persist repricing artifacts until the dependent producer/resume contract is implemented; existing settlement v1 persistence remains unchanged. Revert this PR to restore pooled repricing discovery.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds review-side identity to alpha-factor mining, persisted search artifacts, MCTS state, and evaluator workflows. Side-bound outputs use separate versions and directories with identity validation. Polymarket mission templates also receive updated policy snapshot identifiers.

Changes

Side-bound alpha search

Layer / File(s) Summary
Artifact identity contracts
rust_hft/prediction-markets/crates/ploy-research/src/alpha_search.rs, rust_hft/prediction-markets/crates/ploy-research/src/lib.rs
Artifact and runtime-feedback structures now carry optional side metadata, with public side-bound versioning and identity-mismatch errors.
Side-aware artifact writing and state propagation
rust_hft/prediction-markets/crates/ploy-research/src/alpha_search.rs
Side-bound writers select separate versions and directories, validate target/version/side identity, and propagate side through MCTS and artifact records.
Side-specific repricing mining
rust_hft/prediction-markets/crates/ploy-research/src/autofactor.rs
Full-depth repricing targets carry ReviewSide, filter rows by side, and produce side-labeled reports.
Evaluator identity-aware orchestration
rust_hft/prediction-markets/crates/ploy-research/src/bin/monday-prediction-evaluator.rs
The evaluator parses and validates side-aware plans, state, snapshots, and replay feedback before selecting lane-specific artifact writers.
Compatibility initialization and regression coverage
rust_hft/prediction-markets/crates/ploy-research/examples/persist_research_trace.rs, rust_hft/prediction-markets/crates/ploy-research/src/alpha_search.rs
Existing snapshot construction initializes optional side fields, while tests cover pooled compatibility, side isolation, and wrong-side rejection.

Mission policy snapshot updates

Layer / File(s) Summary
Pinned mission policy identifiers
rust_hft/prediction-markets/config/research_missions/polymarket-*.example.json
BTC and SOL five-minute mission examples use updated search_policy_snapshot_id values.

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

Sequence Diagram(s)

sequenceDiagram
  participant Plan as AlphaSearchPlan
  participant Evaluator as monday-prediction-evaluator
  participant State as MCTSStateAndAlphaZoo
  participant Mining as AutoFactorMining
  participant Writer as SideBoundArtifactWriter

  Plan->>Evaluator: Provide target, version, side, and factor names
  Evaluator->>State: Validate target/version/side identity
  Evaluator->>Mining: Select matching side lane and rows
  Mining-->>Evaluator: Return side-labeled reports and feedback
  Evaluator->>Writer: Write side-bound artifacts
  Writer-->>Evaluator: Return side-specific artifact summary
Loading

Possibly related PRs

  • proerror77/monday#76: Updates the same mission templates with pinned prediction policy identity changes.
  • proerror77/monday#137: Changes the BTC and SOL mission snapshot identifiers in the same example JSON files.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: separating AutoFactor discovery by token side.
Description check ✅ Passed The description mostly matches the template and covers the required contract, scope, validation, rollout, and dependency details.
✨ 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-side-bound-autofactor

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: 3804b17733

ℹ️ 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".

@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
`@rust_hft/prediction-markets/crates/ploy-research/src/bin/monday-prediction-evaluator.rs`:
- Around line 1148-1158: The Alpha Zoo snapshot loader in the alpha_zoo mapping
must stop sending side-less alpha_zoo_snapshot_v1 artifacts through
validate_repricing_input_identity for repricing lanes. Keep such snapshots out
of repricing inputs, or update the Alpha Zoo writer and loader to emit and
accept a side-bound artifact schema with the required version and side before
validation.
🪄 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

Run ID: 0b739db5-106d-43a2-bb06-6a4d7e283c52

📥 Commits

Reviewing files that changed from the base of the PR and between 2175a23 and 3804b17.

📒 Files selected for processing (7)
  • rust_hft/prediction-markets/config/research_missions/polymarket-btc-5m.example.json
  • rust_hft/prediction-markets/config/research_missions/polymarket-sol-5m.example.json
  • rust_hft/prediction-markets/crates/ploy-research/examples/persist_research_trace.rs
  • rust_hft/prediction-markets/crates/ploy-research/src/alpha_search.rs
  • rust_hft/prediction-markets/crates/ploy-research/src/autofactor.rs
  • rust_hft/prediction-markets/crates/ploy-research/src/bin/monday-prediction-evaluator.rs
  • rust_hft/prediction-markets/crates/ploy-research/src/lib.rs

@proerror77 proerror77 changed the title fix(prediction): separate side-bound autofactor artifacts fix(prediction): separate AutoFactor discovery by token side Jul 19, 2026
@proerror77
proerror77 merged commit 80bc542 into main Jul 19, 2026
31 checks passed
@proerror77
proerror77 deleted the codex/polymarket-side-bound-autofactor branch July 19, 2026 07:40
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.

2 participants