Skip to content

Add configurable JSONPath lookup options with lazy-tracking-aware caching#535

Merged
daveshanley merged 2 commits intopb33f:mainfrom
andreyyudin:feat/jsonpath-lookup-options-and-cache-key
Feb 26, 2026
Merged

Add configurable JSONPath lookup options with lazy-tracking-aware caching#535
daveshanley merged 2 commits intopb33f:mainfrom
andreyyudin:feat/jsonpath-lookup-options-and-cache-key

Conversation

@andreyyudin
Copy link
Copy Markdown
Contributor

Summary

This PR updates JSONPath lookup in utils to be configuration-aware and safe with recent https://github.com/pb33f/jsonpath behavior, especially around WithLazyContextTracking().
Different lookup scenarios need different execution behavior and safety constraints. This keeps existing behavior by default while allowing explicit control and preventing incorrect cache reuse across different JSONPath engine settings.

Changes

  1. Added JSONPathLookupOptions to control:
  • Timeout (defaults to 500ms when <= 0)
  • LazyContextTracking (defaults to enabled when nil)
  1. Refactored JSONPath lookup internals:
  • Added getJSONPathWithOptions(...)
  • Kept getJSONPath(...) as a default-options wrapper
  • Cache key now includes lazy mode (<path>::lazy=<bool>) to avoid cross-mode cache collisions
  1. Added a new public API:
  • FindNodesWithoutDeserializingWithOptions(...)
  1. Updated timeout-based API:
  • FindNodesWithoutDeserializingWithTimeout(...) now delegates to options-based logic
  1. Added/updated tests for:
  • Lazy tracking toggle behavior
  • Cache key separation by lazy mode
  • Zero-value options falling back to defaults

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.60%. Comparing base (20f64b7) to head (9b88e87).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #535   +/-   ##
=======================================
  Coverage   99.60%   99.60%           
=======================================
  Files         193      193           
  Lines       24041    24073   +32     
=======================================
+ Hits        23946    23978   +32     
  Misses         59       59           
  Partials       36       36           
Flag Coverage Δ
unittests 99.60% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Copy link
Copy Markdown
Member

@daveshanley daveshanley left a comment

Choose a reason for hiding this comment

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

Looks great!

I am pushing hard now on memory tuning, so every allocation counts. a single thing to fix.

Copy link
Copy Markdown
Member

@daveshanley daveshanley left a comment

Choose a reason for hiding this comment

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

LGTM

@daveshanley daveshanley merged commit b46b39b into pb33f:main Feb 26, 2026
2 checks passed
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