Skip to content

Friendlier instrument construction errors and compact reprs - #79

Open
Apurv-Salunke wants to merge 1 commit into
mainfrom
feat/instrument-construction-errors
Open

Apurv-Salunke wants to merge 1 commit into
mainfrom
feat/instrument-construction-errors

Conversation

@Apurv-Salunke

Copy link
Copy Markdown
Collaborator

Summary

  • Missing/invalid fields on public instrument types (Index, Equity, Future, Option, …) now raise ConfigurationError with a short usage example instead of a raw Pydantic ValidationError.
  • Compact __repr__ forms: Index(NSE:NIFTY), Future(NFO:NIFTY 2026-03-27), Option(NFO:NIFTY 25000 CE 2026-03-27).
  • Valid construction unchanged; class docstrings include canonical examples.
  • Closes Friendlier instrument construction errors and REPL hints #78.

Test plan

  • make ci locally (ruff, mypy, 361 tests, coverage ≥64%)
  • tests/unit/test_instrument_models.py — missing fields, invalid type wrap, valid construction, reprs
  • Manual REPL: Index() shows example; Index(exchange=Exchange.NSE, symbol="NIFTY") prints Index(NSE:NIFTY)

Risk notes

  • Callers catching bare pydantic.ValidationError around instrument construction will need to catch ConfigurationError / TTConnectError instead. Valid construction and resolve-time behaviour are unchanged.

Made with Cursor

Raise ConfigurationError with a usage example instead of a raw
Pydantic ValidationError when Index/Equity/Future/Option fields are
missing, and tighten __repr__ for REPL readability.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Apurv-Salunke, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a445ca28-3a64-4ad8-b668-b2b0c31e424f

📥 Commits

Reviewing files that changed from the base of the PR and between 15eb5cb and 672c5ea.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • tests/unit/test_instrument_models.py
  • tt_connect/core/models/instruments.py

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.

This branch has not been deployed

No deployments
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.

Friendlier instrument construction errors and REPL hints

1 participant