Skip to content

Event snapshot time, slimmed event detail type, and fast tests (2.3.3) - #53

Merged
jpenasosa merged 4 commits into
mainfrom
events-snapshot-and-fast-tests
Oct 1, 2026
Merged

jpenasosa merged 4 commits into
mainfrom
events-snapshot-and-fast-tests

Conversation

@jpenasosa

@jpenasosa jpenasosa commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Prepares the CLI for the slimmed GET /predictions/events/{event_ticker} (the event as of one run, with report and trust content moved to the Reports API), shows when event numbers were captured, and speeds up the test suite. Releases 2.3.3.

Faster tests

Three Reports API retry tests each waited a real 5s backoff. They now run on Bun fake timers through a small settle() helper (src/__tests__/fake-timers.ts). No production code changes.

Suite time: ~19s → ~4s, same tests passing.

Event detail type

  • fetchOctagonEventDirect now returns OctagonEventDetail: the list row without its report prose and Trust Index fields, plus event_url and markets[] (each outcome's quote and normalized status from the same run).
  • The /events list type is unchanged.
  • A test checks that report still resolves its title, analysis time and market ticker from a slimmed response.

Snapshot time on events

  • Detail opens with Snapshot 2026-09-23 17:53 UTC (7d ago). It adds · analysis from <date> when the analysis is over a day older than the capture, the same rule as the web report page.
  • List gains a Captured column (3h, 7d).
  • parseUtcTimestamp reads zone-less API timestamps as UTC rather than local time.
  • Adds the first events command tests.

Test plan

  • bun run typecheck && bun test: 577 pass
  • kalshi events <KX…> / kalshi events against the live API: the Snapshot line and Captured column match the web report page

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Event lists now show how long ago each snapshot was captured. Event details include the capture time and age, and show the analysis date when it is more than a day older than the snapshot.
  • Bug Fixes
    • Event timestamps without a timezone are interpreted as UTC, and invalid capture times no longer produce misleading snapshot details.

jpenasosa and others added 4 commits October 1, 2026 17:24
Three Reports API retry tests each waited a real 5s backoff. Drive them
with Bun fake timers through a small settle() helper instead; no
production code changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
/predictions/events/{event_ticker} is being slimmed to the event as of one
run. fetchOctagonEventDirect now returns OctagonEventDetail: the list row
without its report prose and trust fields, plus event_url and markets[]
(per-market quotes and a normalized status from the same run). The list
type is unchanged. A test pins that report still resolves its title,
analysis time and market from a slimmed response.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
events presented probabilities with no time attached, though they are a
snapshot from captured_at that can be weeks old. The detail now opens with
"Snapshot <time> UTC (<age>)", adding the analysis date when a refresh
carried an analysis over a day older forward (the web report page's rule),
and the list gains a Captured column.

parseUtcTimestamp reads a zone-less API timestamp as UTC rather than local
time, since analysis_last_updated is an untyped string in the API schema.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (2)
AGENTS.md — auto-discovered
CLAUDE.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 9b352484-6b39-4675-a0ee-2ca7fb866227

📥 Commits

Reviewing files that changed from the base of the PR and between e22bb8a and f4fd4d3.

📒 Files selected for processing (10)
  • package.json
  • src/__tests__/fake-timers.ts
  • src/commands/__tests__/events.test.ts
  • src/commands/__tests__/report.test.ts
  • src/commands/events.ts
  • src/commands/report.ts
  • src/scan/__tests__/octagon-reports-api.test.ts
  • src/scan/octagon-events-api.ts
  • src/utils/__tests__/time.test.ts
  • src/utils/time.ts

Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Walkthrough

The change adds typed event-detail responses, timestamp parsing, and snapshot timing in event output. Report handling adopts the detail type. Tests cover snapshot formatting and use a fake-timer helper for retry cases.

Changes

Event Detail and Test Updates

Layer / File(s) Summary
Event detail contract and report handling
src/scan/octagon-events-api.ts, src/commands/report.ts, src/commands/__tests__/report.test.ts
The direct event endpoint returns OctagonEventDetail. Report handling and its test use an event-detail fixture without report prose or trust fields.
Timestamp parsing and provenance
src/utils/time.ts, src/utils/__tests__/time.test.ts
Adds UTC timestamp parsing and a check for analysis timestamps more than 24 hours before capture. Tests cover supported timestamp forms and missing or invalid values.
Event snapshot output
src/commands/events.ts, src/commands/__tests__/events.test.ts
Event list rows show capture age. Event details show a snapshot line for parseable capture timestamps, including an older analysis date when applicable. Tests cover these output cases.
Retry test timing and release version
src/__tests__/fake-timers.ts, src/scan/__tests__/octagon-reports-api.test.ts, package.json
Adds a helper to advance fake timers while awaiting a promise. Retry tests use the helper and restore real timers. The package version changes to 2.3.3.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: melvinmt

Merge Risk: ⚪ Minimal · up to f4fd4

The change adds snapshot timing to event output, introduces a slimmer event-detail type and speeds up retry tests. No concrete merge-blocking risk was found. The live API behavior has not been exercised yet, so a quick manual check after merge is sensible.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 9 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main changes: event snapshot timing, the slimmed event detail type, faster tests, and the version update.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 9 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@jpenasosa
jpenasosa merged commit fcba2ff into main Oct 1, 2026
3 checks passed
@jpenasosa
jpenasosa deleted the events-snapshot-and-fast-tests branch October 1, 2026 23:54
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