fix: add new fields to server_definitions#3227
Conversation
WalkthroughAdded five new fields to the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/xrpl/test/integration/requests/serverDefinitions.test.ts (1)
157-163: Consider updating the "with same hash" test to also check for the absence of the new fields.For consistency with the type's second union branch (which has
neverguards for all 10 optional fields), this assertion should verify that the 5 new fields are also absent in the cached response.Proposed fix
assert.doesNotHaveAnyKeys(result, [ 'FIELDS', 'LEDGER_ENTRY_TYPES', 'TRANSACTION_RESULTS', 'TRANSACTION_TYPES', 'TYPES', + 'ACCOUNT_SET_FLAGS', + 'LEDGER_ENTRY_FLAGS', + 'LEDGER_ENTRY_FORMATS', + 'TRANSACTION_FLAGS', + 'TRANSACTION_FORMATS', ])Based on learnings: While rippled server behaviors are tested upstream, this change would ensure the test's assertions remain consistent with the updated TypeScript type definitions.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/xrpl/test/integration/requests/serverDefinitions.test.ts` around lines 157 - 163, Update the "with same hash" test assertion that checks cached responses to also assert the absence of the five new fields: add the new field names to the assert.doesNotHaveAnyKeys call against the result variable in the "with same hash" test in serverDefinitions.test.ts so the array currently containing 'FIELDS','LEDGER_ENTRY_TYPES','TRANSACTION_RESULTS','TRANSACTION_TYPES','TYPES' is extended to include the five additional optional field names to match the TypeScript union branch that uses never guards.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/xrpl/test/integration/requests/serverDefinitions.test.ts`:
- Around line 157-163: Update the "with same hash" test assertion that checks
cached responses to also assert the absence of the five new fields: add the new
field names to the assert.doesNotHaveAnyKeys call against the result variable in
the "with same hash" test in serverDefinitions.test.ts so the array currently
containing
'FIELDS','LEDGER_ENTRY_TYPES','TRANSACTION_RESULTS','TRANSACTION_TYPES','TYPES'
is extended to include the five additional optional field names to match the
TypeScript union branch that uses never guards.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d22cc320-50f3-4eb6-b734-e7ab5bb6a939
📒 Files selected for processing (2)
packages/xrpl/src/models/methods/serverDefinitions.tspackages/xrpl/test/integration/requests/serverDefinitions.test.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/xrpl/test/integration/requests/serverDefinitions.test.ts (1)
147-153: Consider adding new fields to the "same hash" test.The
doesNotHaveAnyKeysassertion only checks the original 5 definition fields. For consistency, consider also verifying the new fields are absent when a matching hash is provided:assert.doesNotHaveAnyKeys(result, [ 'FIELDS', 'LEDGER_ENTRY_TYPES', 'TRANSACTION_RESULTS', 'TRANSACTION_TYPES', 'TYPES', + 'ACCOUNT_SET_FLAGS', + 'LEDGER_ENTRY_FLAGS', + 'LEDGER_ENTRY_FORMATS', + 'TRANSACTION_FLAGS', + 'TRANSACTION_FORMATS', ])Based on learnings, rippled's behavior is already tested in rippled's own test suite, so this is a minor consistency improvement.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/xrpl/test/integration/requests/serverDefinitions.test.ts` around lines 147 - 153, Update the assertion in serverDefinitions.test.ts that calls assert.doesNotHaveAnyKeys(result, [...]) so it also includes any new definition keys added in this codebase (i.e., extend the array passed to assert.doesNotHaveAnyKeys to include the additional fields introduced alongside FIELDS, LEDGER_ENTRY_TYPES, TRANSACTION_RESULTS, TRANSACTION_TYPES, and TYPES); locate the assertion by the variable name result and the assert.doesNotHaveAnyKeys call and add the new field names to that array to ensure they are also verified absent when a matching hash is provided.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/xrpl/test/integration/requests/serverDefinitions.test.ts`:
- Around line 147-153: Update the assertion in serverDefinitions.test.ts that
calls assert.doesNotHaveAnyKeys(result, [...]) so it also includes any new
definition keys added in this codebase (i.e., extend the array passed to
assert.doesNotHaveAnyKeys to include the additional fields introduced alongside
FIELDS, LEDGER_ENTRY_TYPES, TRANSACTION_RESULTS, TRANSACTION_TYPES, and TYPES);
locate the assertion by the variable name result and the
assert.doesNotHaveAnyKeys call and add the new field names to that array to
ensure they are also verified absent when a matching hash is provided.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2dbaedfa-f8e3-4c18-8d8a-484672f3567a
📒 Files selected for processing (3)
packages/xrpl/HISTORY.mdpackages/xrpl/src/models/methods/serverDefinitions.tspackages/xrpl/test/integration/requests/serverDefinitions.test.ts
High Level Overview of Change
Next rippled release will introduce new fields to
server_definitions(already merged todevelop):TRANSACTION_FORMATS: Describes the fields and their optionality for each transaction type, including common fields shared across all transactions.LEDGER_ENTRY_FORMATS: Describes the fields and their optionality for each ledger entry type, including common fields shared across all ledger entries.TRANSACTION_FLAGS: Maps transaction type names to their supported flags and flag values.LEDGER_ENTRY_FLAGS: Maps ledger entry type names to their flags and flag values.ACCOUNT_SET_FLAGS: Maps AccountSet flag names (asf flags) to their numeric values.See feat: Add Formats and Flags to server_definitions
This will allow our CI tests to pass.
Type of Change
Did you update HISTORY.md?
Test Plan
All CI tests pass.
Future Tasks
Update our scripts to fetch this data from rippled codebase into
definitions.json