Skip to content

feat(data)!: add range-event activity types - #498

Closed
jwei-pm wants to merge 2 commits into
mainfrom
cursor/module-4-activity-types-4b1a
Closed

jwei-pm wants to merge 2 commits into
mainfrom
cursor/module-4-activity-types-4b1a

Conversation

@jwei-pm

@jwei-pm jwei-pm commented Nov 4, 2026 •

Copy link
Copy Markdown

The Data API now serves four range-event activity types from DirectionalModule (module 4). A strict ActivityType enum rejected those rows and failed the whole activity page.

This change adds the four types and keeps unknown future types as UnknownActivity, so a new type cannot crash clients.

Types

  • DIRECTIONAL_SPLIT / DIRECTIONAL_MERGE: event-level rows. size is pair count (pairs). usdc_size is collateral paid or returned (amount). condition_id on the wire is the event id, not a market. Metadata (title, eventSlug, icon) is optional until the event is listed.
  • THRESHOLD_COMPOSE / THRESHOLD_DECOMPOSE: line-market rows. conditionId is required. size is share count (shares). usdc_size is 0. outcome / outcomeIndex name the line side when present (0 = Yes/ABOVE, 1 = No/BELOW).

Source of the wire contract: polymarket-indexer /v2 activity serving and the DirectionalModule event semantics (split/merge of two lines, compose/decompose of one line).

Unknown types

ActivitySchema accepts any non-empty type string. Types that are not in ActivityType parse as UnknownActivity with type: undefined and the served value in rawType. Exhaustive switches over activity.type need a branch for undefined.

The listActivity type filter still accepts only known ActivityType values.

Tests

Sample payloads cover each new type, empty listing metadata, 29-byte and padded event ids, a missing threshold condition_id, and a mixed page that includes an unknown type.

Open in Web Open in Cursor 

Note

Medium Risk
Changes core activity normalization and widens the Activity union, so downstream type narrowing and display logic must handle new variants and unknown rows; market vs event condition_id handling is easy to get wrong if ignored.

Reviewed by Cursor Bugbot for commit da77d9e. Bugbot is set up for automated code reviews on this repo. Configure here.

Parse DIRECTIONAL_SPLIT, DIRECTIONAL_MERGE, THRESHOLD_COMPOSE and
THRESHOLD_DECOMPOSE rows, and keep unknown future types as
UnknownActivity so a new type cannot fail the page.

Co-authored-by: Jeremy Wei <jwei-pm@users.noreply.github.com>

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 97ae29b. Configure here.

Comment thread packages/bindings/src/data/activity.ts Resolved
Zero-padded 32-byte event ids are not market conditions. Keep
UnknownActivity.conditionId unset for both the 29-byte form and the
padded form already served on directional rows.

Co-authored-by: Jeremy Wei <jwei-pm@users.noreply.github.com>
@jwei-pm

jwei-pm commented Nov 4, 2026

Copy link
Copy Markdown
Author

Closing: not needed for the current staging work.

@jwei-pm jwei-pm closed this Nov 4, 2026
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