Skip to content

fix(polymarket): retain fresh pre-open references - #99

Merged
proerror77 merged 1 commit into
mainfrom
codex/polymarket-preopen-reference
Jul 17, 2026
Merged

fix(polymarket): retain fresh pre-open references#99
proerror77 merged 1 commit into
mainfrom
codex/polymarket-preopen-reference

Conversation

@proerror77

@proerror77 proerror77 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Change contract

Treat typed BTC/SOL Chainlink references whose source timestamp is in [event_start - 30 seconds, event_end) as belonging to the event while preserving their original arrival clocks, and disclose that exact half-open window in the immutable evidence manifest.

Out of scope

  • Contract selection or event boundaries.
  • Quote, trade, or settlement inclusion windows.
  • Reference source validation, derived labels, evaluators, snapshots, execution, collectors, deployment, gate, or cutover.

Dependency / merge order

Depends on the immutable evidence manifest publisher from #98, which is merged into main. No outstanding stacked dependency remains.

Focused validation

  • cargo test --locked -p hft-collector polymarket_research_normalize::tests -- --nocapture (9 passed)
  • cargo test --locked -p hft-collector (180 passed, 2 ignored)
  • cargo clippy --locked -p hft-collector --all-targets -- -D warnings
  • cargo fmt --package hft-collector -- --check
  • git diff --check
  • Counterexamples cover start-minus-30 acceptance, start-minus-31 rejection, event-end rejection through market_rows, late available_at without backdating, completeness with only the pre-open reference, and exact manifest disclosure.
  • Matt Standards/Spec review: no P0-P2 findings; the sole P3 test gap was addressed and revalidated.

Rollout / rollback impact

This changes only normalized research-evidence membership and its manifest disclosure. It does not change collection or execution. Rollback removes the 30-second pre-open membership and restores the previous event-only reference window; previously published content-addressed evidence remains immutable.

Scope evidence

  • 2 changed files, 127 insertions, 4 deletions.
  • One Research-domain behavior and one rollback unit.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Chainlink reference price handling for Polymarket evidence.
    • Reference prices recorded up to 30 seconds before an event now qualify for inclusion.
    • Preserved the original availability timestamp for pre-event reference prices.
    • Improved evidence completeness when valid pre-event references are present.

@proerror77

Copy link
Copy Markdown
Owner Author

@codex review current head 3d8c6bf

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 43dd3e51-1e07-4063-9abe-73ba325c800f

📥 Commits

Reviewing files that changed from the base of the PR and between 687c3d9 and 3d8c6bf.

📒 Files selected for processing (2)
  • rust_hft/tools/collector/src/polymarket_evidence_artifact.rs
  • rust_hft/tools/collector/src/polymarket_research_normalize.rs

📝 Walkthrough

Walkthrough

Chainlink reference prices recorded up to 30 seconds before an event are now eligible for normalization. The manifest recording semantics and tests document and validate the half-open [event_start - 30 seconds, event_end) window.

Changes

Chainlink reference window

Layer / File(s) Summary
Reference window logic and validation
rust_hft/tools/collector/src/polymarket_research_normalize.rs
Adds the 30-second lookback predicate, uses it when filtering reference_price rows, and tests boundary handling, available_at, and surface completeness.
Manifest semantics disclosure
rust_hft/tools/collector/src/polymarket_evidence_artifact.rs
Updates the serialized references description and its test assertion to state the expanded timestamp range.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: preserving fresh pre-open Polymarket references.
Description check ✅ Passed The description covers the required contract, out-of-scope items, dependency, validation, rollout, and scope details, with only a minor template heading mismatch.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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-preopen-reference

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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 3d8c6bf1cf

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

@proerror77
proerror77 merged commit 9164495 into main Jul 17, 2026
17 checks passed
@proerror77
proerror77 deleted the codex/polymarket-preopen-reference branch July 17, 2026 15:05
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.

1 participant