Sponsored Content
Skip to content

feat(test): add file/line to Env - #6276

Merged
bthomee merged 11 commits into
XRPLF:developfrom
mvadari:env-file-loc
Feb 6, 2026
Merged

feat(test): add file/line to Env#6276
bthomee merged 11 commits into
XRPLF:developfrom
mvadari:env-file-loc

Conversation

@mvadari

@mvadari mvadari commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

High Level Overview of Change

This PR uses std::source_location to add to test Env error output the file and line location of the call that triggered the failed transaction.

There is no change to the source code.

Context of Change

Improved test logging, easier debugging

Type of Change

  • New feature (non-breaking change which adds functionality)

API Impact

N/A

Test Plan

I used this commit to help me debug a test failure in another branch.

Copilot AI review requested due to automatic review settings January 23, 2026 21:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances test debugging by adding source location information (file and line number) to test environment error messages using C++20's std::source_location. When test transactions fail, the error output will now include the exact file and line where the test was invoked.

Changes:

  • Adds std::source_location parameters to submit(), sign_and_submit(), and postconditions() methods to capture call site location
  • Introduces WithSourceLoc wrapper struct to enable implicit conversion with source location capture for variadic template methods
  • Updates error messages to include file and line information in the format (filename:line)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/test/jtx/Env.h Adds WithSourceLoc wrapper struct and updates method signatures to accept source location parameters
src/test/jtx/impl/Env.cpp Implements source location threading through submission methods and formats location info in error messages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/test/jtx/Env.h Outdated
Comment thread src/test/jtx/impl/Env.cpp Outdated
@codecov

codecov Bot commented Jan 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.9%. Comparing base (677758b) to head (f411ccd).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #6276   +/-   ##
=======================================
  Coverage     79.9%   79.9%           
=======================================
  Files          840     840           
  Lines        65483   65483           
  Branches      7255    7251    -4     
=======================================
+ Hits         52311   52319    +8     
+ Misses       13172   13164    -8     

see 3 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings January 28, 2026 21:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/test/jtx/impl/Env.cpp Outdated
Comment thread src/test/jtx/impl/Env.cpp Outdated
Comment thread src/test/jtx/impl/Env.cpp Outdated
Comment thread src/test/jtx/impl/Env.cpp
Comment thread src/test/jtx/impl/Env.cpp
@mvadari mvadari added the Needs additional review PR requires at least one more code review approval before it can be merged label Jan 28, 2026
@mvadari
mvadari requested a review from Copilot January 28, 2026 22:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/test/jtx/Env.h Outdated
Comment thread src/test/jtx/impl/Env.cpp Outdated
Comment thread src/test/jtx/Env.h Outdated
Comment on lines +66 to +72
WithSourceLoc(Json::Value v, std::source_location l = std::source_location::current()) : value(std::move(v)), loc(l)
{
}

WithSourceLoc(JTx v, std::source_location l = std::source_location::current()) : value(std::move(v)), loc(l)
{
}

Copilot AI Jan 28, 2026

Copy link

Choose a reason for hiding this comment

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

Both constructors can be implemented more concisely on a single line since the bodies are empty. Consider: WithSourceLoc(Json::Value v, std::source_location l = std::source_location::current()) : value(std::move(v)), loc(l) {}

Suggested change
WithSourceLoc(Json::Value v, std::source_location l = std::source_location::current()) : value(std::move(v)), loc(l)
{
}
WithSourceLoc(JTx v, std::source_location l = std::source_location::current()) : value(std::move(v)), loc(l)
{
}
WithSourceLoc(Json::Value v, std::source_location l = std::source_location::current()) : value(std::move(v)), loc(l) {}
WithSourceLoc(JTx v, std::source_location l = std::source_location::current()) : value(std::move(v)), loc(l) {}

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the need for this in a61c815

@bthomee
bthomee requested a review from a1q123456 January 30, 2026 12:41

@a1q123456 a1q123456 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some suggestions

Comment thread src/test/jtx/Env.h Outdated
namespace test {
namespace jtx {

class Env; // Forward declaration

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this is needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed in a61c815

Comment thread src/test/jtx/Env.h Outdated
Comment thread src/test/jtx/Env.h Outdated
Json::Value or JTx, allowing implicit conversion without template
argument deduction issues.
*/
struct WithSourceLoc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

May be worth making it a template class so that you don't need to use std::variant and it's clearer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copilot AI review requested due to automatic review settings February 5, 2026 18:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/test/jtx/Env.h Outdated
@mvadari
mvadari requested a review from a1q123456 February 5, 2026 19:24
Copilot AI review requested due to automatic review settings February 5, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mvadari mvadari added Needs additional review PR requires at least one more code review approval before it can be merged and removed Needs additional review PR requires at least one more code review approval before it can be merged labels Feb 5, 2026

@a1q123456 a1q123456 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@a1q123456

Copy link
Copy Markdown
Contributor

Oh I thought I didn't approve it. Sorry for the noise.

Copilot AI review requested due to automatic review settings February 6, 2026 14:49
@bthomee bthomee removed the Needs additional review PR requires at least one more code review approval before it can be merged label Feb 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/test/jtx/impl/Env.cpp Outdated
Comment thread src/test/jtx/Env.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 6, 2026 15:25
@mvadari mvadari added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label Feb 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings February 6, 2026 16:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bthomee
bthomee enabled auto-merge (squash) February 6, 2026 17:25
@bthomee
bthomee merged commit f5208fc into XRPLF:develop Feb 6, 2026
3 checks passed
@mvadari
mvadari deleted the env-file-loc branch March 12, 2026 17:09
@mvadari mvadari added this to the 3.2.0 milestone May 20, 2026
beartec-jpg pushed a commit to beartec-jpg/FalconLedger that referenced this pull request Jun 1, 2026
This change uses `std::source_location` to output the file and line location of the call that triggered a failed transaction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants