Skip to content

feat: adapt check exchange policy for bundle offers#999

Merged
levalleux-ludo merged 22 commits intomainfrom
998-check-exchangepolicy-for-bundle
Feb 13, 2026
Merged

feat: adapt check exchange policy for bundle offers#999
levalleux-ludo merged 22 commits intomainfrom
998-check-exchangepolicy-for-bundle

Conversation

@levalleux-ludo
Copy link
Member

@levalleux-ludo levalleux-ludo marked this pull request as ready for review February 12, 2026 18:00
Copilot AI review requested due to automatic review settings February 12, 2026 18:00
Copy link
Contributor

Copilot AI left a comment

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 updates the exchange policy validation flow to support Bundle offers by allowing multiple Yup schema templates (selected by metadata.type) and adds core-sdk tests/fixtures to cover bundle validation.

Changes:

  • Extend exchange policy rules format to support metadataType and additional schemas via yupSchemas (e.g. BUNDLE, ITEM_PRODUCT_V1).
  • Update core-sdk checkExchangePolicy to select the appropriate schema based on offer metadata type and to validate bundle items.
  • Update react-kit defaults/storybook config to use the new rules template IPFS hash and adjust rules-template placeholder replacement for multiple schemas.

Reviewed changes

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

Show a summary per file
File Description
packages/react-kit/src/stories/widgets/Commit.stories.tsx Updates Storybook stories to use the new exchange policy rules IPFS hash.
packages/react-kit/src/hooks/useCheckExchangePolicy.ts Applies placeholder replacements across the base schema and additional yupSchemas (but includes leftover debug/commented code).
packages/react-kit/src/components/boson/BosonProvider.tsx Updates the default fairExchangePolicyRules IPFS hash.
packages/core-sdk/tests/exchangePolicy/exchangePolicyRules.testing.json Adds metadataType + additional schemas for bundle/item validation and updates an error message.
packages/core-sdk/tests/exchangePolicy/examples/validBundle.json Adds a valid bundle fixture for tests.
packages/core-sdk/tests/exchangePolicy/examples/invalidBundle.json Adds an invalid bundle fixture for tests.
packages/core-sdk/tests/check-exchange-policy.test.ts Adds bundle validation test cases and updates expected error messaging.
packages/core-sdk/src/offers/checkExchangePolicy.ts Implements schema selection by metadata type + bundle item validation logic.
data/ipfs.txt Records the new IPFS hash for traceability.
data/exchangePolicies/exchangePolicyRules.template.json Updates the IPFS template to include bundle/item schemas and metadataType.

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

levalleux-ludo and others added 6 commits February 13, 2026 10:48
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

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 11 out of 11 changed files in this pull request and generated 3 comments.


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

levalleux-ludo and others added 3 commits February 13, 2026 11:17
…ls.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

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 11 out of 11 changed files in this pull request and generated 4 comments.


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

Copy link
Contributor

Copilot AI left a comment

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 11 out of 11 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.

Copy link
Contributor

Copilot AI left a comment

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 11 out of 11 changed files in this pull request and generated 8 comments.


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

levalleux-ludo and others added 2 commits February 13, 2026 12:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
levalleux-ludo and others added 3 commits February 13, 2026 12:06
…ls.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Feb 13, 2026

@levalleux-ludo I've opened a new pull request, #1000, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Feb 13, 2026

@levalleux-ludo I've opened a new pull request, #1001, to work on those changes. Once the pull request is ready, I'll request review from you.

#1000)

* Initial plan

* Add type checking for Yup ValidationError before accessing inner property

Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>

* Fix spacing in function call

Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ levalleux-ludo
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

…ling (#1001)

* Initial plan

* Add error type checking for Yup ValidationError handling

Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>

* Refactor: extract error validation logic into helper function

Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>

* Improve error property extraction to be more explicit

Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>

* Improve type safety in error extraction helper

Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>

* Add comprehensive JSDoc documentation for error extraction helper

Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>

* fix lint

* fix test

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>
Co-authored-by: Ludovic Levalleux <levalleux_ludo@hotmail.com>
Copy link
Contributor

Copilot AI left a comment

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 13 out of 14 changed files in this pull request and generated 3 comments.


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

@levalleux-ludo
Copy link
Member Author

Results in Storybook:
image
image
image

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 84.61538% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.93%. Comparing base (4ad460d) to head (a5dfa8d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ackages/core-sdk/src/offers/checkExchangePolicy.ts 86.53% 7 Missing ⚠️
.../core-sdk/src/offers/renderContractualAgreement.ts 76.92% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #999      +/-   ##
==========================================
- Coverage   90.98%   90.93%   -0.06%     
==========================================
  Files         176      176              
  Lines        7190     7247      +57     
  Branches     1322     1355      +33     
==========================================
+ Hits         6542     6590      +48     
- Misses        648      657       +9     
Flag Coverage Δ
common 92.59% <ø> (ø)
core-sdk 56.66% <84.61%> (+0.25%) ⬆️
e2e 85.71% <46.15%> (-0.37%) ⬇️
eth-connect-sdk 95.06% <ø> (ø)
ethers-sdk 74.45% <ø> (ø)
ipfs-storage 91.75% <ø> (ø)
metadata 94.70% <ø> (ø)
unittests 60.94% <84.61%> (+0.18%) ⬆️

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@levalleux-ludo levalleux-ludo merged commit 6799fb5 into main Feb 13, 2026
8 of 11 checks passed
@levalleux-ludo levalleux-ludo deleted the 998-check-exchangepolicy-for-bundle branch February 13, 2026 15:44
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.

Check ExchangePolicy rules is not working with Bundle offer

3 participants