Skip to content

Conversation

@mvadari
Copy link
Collaborator

@mvadari mvadari commented Oct 29, 2025

High Level Overview of Change

Fix the definitions generation script so that it better handles formatting changes, like adding new lines

Context of Change

Some newlines were introduced in transactions.macro, which weren't properly captured by the regex

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Did you update CHANGELOG.md?

  • No, this change does not impact library users

Test Plan

Works locally.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

Warning

Rate limit exceeded

@mvadari has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 18 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ffab72e and b78b1b6.

📒 Files selected for processing (1)
  • tools/generate_definitions.py (5 hunks)

Walkthrough

Broadened multiple parser regexes to accept optional spaces/newlines between tokens and updated binary codec definitions JSON by adding Int32/Int64 types and two new fields, removing one transaction result key, and reordering some transaction type entries.

Changes

Cohort / File(s) Summary
Parser regex relaxations
tools/generate_definitions.py
Broadened several regex patterns (STYPE, TYPED_SFIELD, LEDGER_ENTRY, TER parsing, TRANSACTION) to permit optional whitespace (spaces/newlines) between tokens and separators while preserving captured groups and output shape.
Binary codec definitions updates
xrpl/core/binarycodec/definitions/definitions.json
Added new field entries MutableFlags and DummyInt32; introduced Int32 and Int64 types; removed tedADDRESS_COLLISION from TRANSACTION_RESULTS; resequenced TRANSACTION_TYPES entries (VaultCreate/VaultDeposit) and added Int32/Int64 references.

Sequence Diagram(s)

sequenceDiagram
    participant Tool as generate_definitions.py
    participant Spec as Source spec/text
    participant Parser as Regex parser
    participant JSON as definitions.json

    Note over Tool,Spec: Input spec or source lines
    Tool->>Parser: Apply relaxed regexes (STYPE, TYPED_SFIELD,\nLEDGER_ENTRY, TER, TRANSACTION)
    alt Match
        Parser-->>Tool: Extracted tokens/groups
        Tool->>JSON: Emit/augment fields and types (Int32, Int64, MutableFlags, DummyInt32)
        JSON-->>Tool: Updated definitions.json
    else No match
        Parser-->>Tool: Skip or warn
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay special attention to each adjusted regex (STYPE, TYPED_SFIELD, LEDGER_ENTRY, TER, TRANSACTION) to ensure no unintended over-matching.
  • Validate new TYPES and FIELDS entries in definitions.json for correct schema fields (nth values, types, flags).
  • Confirm removal of tedADDRESS_COLLISION does not break downstream consumers or references.

Possibly related PRs

Suggested reviewers

  • ckeshava
  • khancode
  • pdp2121

Poem

🐰 I hopped through patterns, gentle and spry,
Spaces now welcome where tokens lie,
New integers added, fields snug and bright,
Definitions updated — I twitched with delight! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix: better formatting handling in definitions script" clearly reflects the main objective of the pull request. It directly aligns with the author's stated goal to fix the definitions generation script to handle formatting changes (specifically newlines) that were not previously captured by regex patterns. The title is concise, specific, and avoids vague terminology or noise, making it easy for reviewers to understand the primary change at a glance.
Description Check ✅ Passed The pull request description follows the required template structure and includes all major sections: a clear High Level Overview explaining the fix, Context of Change describing the root cause, Type of Change correctly identifying it as a bug fix, and confirmation that CHANGELOG.md does not need updating. However, the Test Plan section is minimal ("Works locally.") and lacks the specific details requested in the template about which tests were run and instructions for reproduction, making it difficult for reviewers to understand exactly how the changes were validated or to reproduce the tests themselves.

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a5e54c and 5028d56.

📒 Files selected for processing (1)
  • tools/generate_definitions.py (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: ckeshava
PR: XRPLF/xrpl-py#759
File: xrpl/models/transactions/credential_delete.py:57-68
Timestamp: 2024-10-30T20:34:35.451Z
Learning: Consistent implementation patterns are preferred in the `xrpl-py` codebase, especially in transaction models under `xrpl/models/transactions/`. When suggesting refactoring that affects multiple transactions, consider the impact on overall consistency and propose comprehensive changes when appropriate.

@mvadari mvadari changed the title Fix definitions script fix: better formatting handling in definitions script Oct 29, 2025
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