Skip to content

Add deterministic Polymarket recording and replay - #16

Merged
howdymary merged 2 commits into
mainfrom
codex/packet-5-recorder-replay
Jul 15, 2026
Merged

Add deterministic Polymarket recording and replay#16
howdymary merged 2 commits into
mainfrom
codex/packet-5-recorder-replay

Conversation

@howdymary

@howdymary howdymary commented Jul 14, 2026

Copy link
Copy Markdown
Owner

What changed

  • adds an immutable autopredict.recording v1 capture contract for Gamma metadata, CLOB books, public trades, explicit gaps, and later resolution
  • separates point-in-time snapshot capture from resolution capture and restores identity/completeness state across restarts
  • validates Gamma market IDs, condition IDs, YES token IDs, CLOB market/asset identities, paginated trade filters, hashes, sequence continuity, and source timestamps
  • adds deterministic replay into the canonical dataset contract with sticky partial-completeness semantics
  • publishes capture/replay companion files through exact temporary-candidate validation and atomic directory rename
  • constrains the default public transport to official HTTPS Polymarket hosts, GET-only behavior, no redirects, no ambient credentials, and strict public query/header allowlists
  • adds official-shaped immutable fixtures, adversarial lifecycle/transport/atomicity tests, and recorder documentation

Why / root cause

AutoPredict had no first-party point-in-time recorder, so realistic evaluation and shadow replay could not distinguish complete evidence from polling gaps. Venue identifiers and public transport state also needed an explicit fail-closed boundary before captured data could be treated as reproducible evidence.

User and developer impact

Developers can capture public Polymarket observations, append resolution later, verify immutable hashes and completeness warnings, and replay the result deterministically. Partial or malformed captures remain ineligible for performance claims; no market data or missing sequence is fabricated.

Schema and migration

Introduces versioned recording/capture contracts and a documented replay projection into autopredict.dataset.v1. Existing evaluation datasets are unchanged. Recorder artifacts with unsupported completeness values, identity mismatches, discontinuities, or conflicting immutable targets are rejected with actionable errors.

Verification

  • independent reviewer: APPROVED after repeated adversarial review
  • focused recorder suite: 42 passed
  • full Packet 5 suite before stack: 372 passed
  • post-rebase Packet 4 + Packet 5 suite: 389 passed
  • Black, compileall, scoped mypy, and git diff --check: passed
  • sdist/wheel build: passed
  • clean-wheel 98-module import audit: passed
  • no authenticated request, live order, or production credential was used

Residual risks

  • REST offset pagination cannot prove a transactionally frozen upstream trade set; artifacts therefore record polling sequence completeness as unavailable and surface truncation/gaps explicitly
  • publication is atomic at directory-rename level but does not claim fsync durability or protection against a malicious local symlink race
  • public recording remains read-only and is not evidence that live execution is safe

Tracks #2
Closes #9

Depends on #15.

@howdymary
howdymary force-pushed the codex/packet-4-forecast-provider branch from 11c7cd8 to d49bc39 Compare July 15, 2026 00:06
@howdymary
howdymary force-pushed the codex/packet-5-recorder-replay branch from 081ff9e to 7880ebf Compare July 15, 2026 00:06
@howdymary
howdymary changed the base branch from codex/packet-4-forecast-provider to main July 15, 2026 00:15
@howdymary
howdymary marked this pull request as ready for review July 15, 2026 00:15
@howdymary
howdymary merged commit 0718141 into main Jul 15, 2026
12 checks passed
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.

Packet 5: build a point-in-time Polymarket recorder and deterministic replay

1 participant