Skip to content

Conversation

@limitofzero
Copy link
Contributor

@limitofzero limitofzero commented Dec 12, 2025

Summary by CodeRabbit

  • New Features
    • Added support for app data schema version 1.11.0 with expanded metadata structure
    • Introduced user consents metadata tracking (v0.1.0) for recording user consent records with terms and acceptance dates

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Walkthrough

This PR introduces support for app data schema version 1.11.0 and adds a new user consents metadata schema (v0.1.0). It includes updated type definitions, new JSON schema files, and modifications to the compilation script to handle the new userConsents metadata type.

Changes

Cohort / File(s) Summary
Schema version upgrade
packages/app-data/src/generatedTypes/index.ts, packages/app-data/src/generatedTypes/latest.ts
Updated version references from v1.10.0 to v1.11.0; added LATEST_USER_CONSENTS_METADATA_VERSION constant; updated type unions to include v1_11_0.AppDataRootSchema
Generated type definitions
packages/app-data/src/generatedTypes/v1.11.0.ts
New auto-generated TypeScript file containing type aliases and interfaces for app data schema v1.11.0, including primitive types, complex unions (PartnerFee), and structured entities (AppDataRootSchema, Metadata, Referrer, Quote, OrderClass, CoWHook, Bridging, Flashloan, UserConsents)
JSON schema definitions
packages/app-data/src/schemas/v1.11.0.json, packages/app-data/src/schemas/userConsents/v0.1.0.json
New schema files: v1.11.0 defines the root AppData structure with required version and metadata; userConsents/v0.1.0 defines array schema for user consent records with terms and acceptedDate fields
Build script updates
packages/app-data/src/scripts/compile.ts
Extended getLatestMetadataDocVersion() function signature to accept 'userConsents' as an option; added latestUserConsentsVersion collection and export wiring

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Auto-generated types file with repetitive, homogeneous structure
  • Straightforward schema additions with clear structure
  • Simple compilation script enhancement following established patterns

Areas requiring attention:

  • Verify v1.11.0 schema structure aligns with intended metadata model
  • Confirm userConsents v0.1.0 schema validation rules (required fields, type constraints)
  • Check that compilation script correctly wires userConsents through all export paths

Possibly related PRs

Suggested labels

v7

Suggested reviewers

  • alfetopito
  • shoom3301
  • jeffersonBastos

Poem

🐰 A new schema hops along the way,
Consents and bridges bundled, hooray!
From 1.10 to 1.11 we leap with glee,
Types aligned in harmony, you see! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions 'rwa consent' but the actual changes implement generic 'userConsents' schema (v0.1.0) with version 1.11.0 support, not specifically RWA-related consent. Update the title to accurately reflect the changes, such as 'feat: add userConsents metadata schema v0.1.0' or 'feat: add generic user consents support to app data'.
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 (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-rwa-consent

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.

@github-actions
Copy link
Contributor

📦 GitHub Packages Published

Last updated: Dec 12, 2025, 08:37:18 PM UTC

The following packages have been published to GitHub Packages with pre-release version pr-747-b68e698e:

  • @cowprotocol/cow-sdk@7.2.5-pr-747-b68e698e.0
  • @cowprotocol/sdk-app-data@4.3.6-pr-747-b68e698e.0
  • @cowprotocol/sdk-bridging@0.12.0-pr-747-b68e698e.0
  • @cowprotocol/sdk-common@0.4.0-pr-747-b68e698e.0
  • @cowprotocol/sdk-composable@0.1.21-pr-747-b68e698e.0
  • @cowprotocol/sdk-config@0.6.2-pr-747-b68e698e.0
  • @cowprotocol/sdk-contracts-ts@0.8.1-pr-747-b68e698e.0
  • @cowprotocol/sdk-cow-shed@0.2.8-pr-747-b68e698e.0
  • @cowprotocol/sdk-ethers-v5-adapter@0.3.0-pr-747-b68e698e.0
  • @cowprotocol/sdk-ethers-v6-adapter@0.3.0-pr-747-b68e698e.0
  • @cowprotocol/sdk-flash-loans@1.6.1-pr-747-b68e698e.0
  • @cowprotocol/sdk-order-book@0.4.4-pr-747-b68e698e.0
  • @cowprotocol/sdk-order-signing@0.1.21-pr-747-b68e698e.0
  • @cowprotocol/sdk-subgraph@0.2.6-pr-747-b68e698e.0
  • @cowprotocol/sdk-trading@0.7.1-pr-747-b68e698e.0
  • @cowprotocol/sdk-viem-adapter@0.3.0-pr-747-b68e698e.0
  • @cowprotocol/sdk-weiroll@0.1.11-pr-747-b68e698e.0

Installation

These packages require authentication to install from GitHub Packages. First, create a .npmrc file:

# Create .npmrc file in your project root
echo "@cowprotocol:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN" >> .npmrc

To get your GitHub token:

  1. Go to https://github.com/settings/tokens
  2. Click "Generate new token (classic)"
  3. Check only the "read:packages" scope
  4. Copy the token and replace YOUR_GITHUB_TOKEN in the .npmrc file

Then install any of the packages above, either by exact version (i.e. @cowprotocol/cow-sdk@7.2.5-pr-747-b68e698e.0) or more conveniently by using the tag (@cowprotocol/cow-sdk@pr-747):

# Yarn
yarn add npm:@cowprotocol/cow-sdk@pr-747

# pnpm
pnpm install npm:@cowprotocol/cow-sdk@pr-747

# NPM
npm install npm:@cowprotocol/cow-sdk@pr-747

Update to the latest version (only if you used the tag)

Every commit will publish a new package. To upgrade to the latest version, run:

# Yarn
yarn upgrade @cowprotocol/cow-sdk

# pnpm
pnpm update @cowprotocol/cow-sdk

# NPM
npm update @cowprotocol/cow-sdk

View Packages

You can view the published packages at: https://github.com/cowprotocol/cow-sdk/packages

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: 0

🧹 Nitpick comments (2)
packages/app-data/src/scripts/compile.ts (1)

108-133: Avoid silently collapsing rejected metadata lookups into '' without identifying which doc failed.
Promise.allSettled(...).map(...) loses the rejection reason and the doc name, which makes failures hard to debug (esp. when adding new metadata docs like userConsents). Consider iterating results with the corresponding doc name and logging rejected reasons.

-        const metadataResults = await Promise.allSettled([
-          getLatestMetadataDocVersion('quote'),
-          getLatestMetadataDocVersion('referrer'),
-          getLatestMetadataDocVersion('orderClass'),
-          getLatestMetadataDocVersion('utm'),
-          getLatestMetadataDocVersion('hooks'),
-          getLatestMetadataDocVersion('signer'),
-          getLatestMetadataDocVersion('widget'),
-          getLatestMetadataDocVersion('partnerFee'),
-          getLatestMetadataDocVersion('replacedOrder'),
-          getLatestMetadataDocVersion('userConsents'),
-        ])
+        const metadataDocNames = [
+          'quote',
+          'referrer',
+          'orderClass',
+          'utm',
+          'hooks',
+          'signer',
+          'widget',
+          'partnerFee',
+          'replacedOrder',
+          'userConsents',
+        ] as const
+
+        const metadataResults = await Promise.allSettled(
+          metadataDocNames.map((name) => getLatestMetadataDocVersion(name)),
+        )
 
-        const [
-          latestQuoteVersion,
-          latestReferrerVersion,
-          latestOrderClassVersion,
-          latestUtmVersion,
-          latestHooksVersion,
-          latestSignerVersion,
-          latestWidgetVersion,
-          latestPartnerFeeVersion,
-          latestReplacedOrderVersion,
-          latestUserConsentsVersion,
-        ] = metadataResults.map((result) => (result.status === 'fulfilled' ? result.value : ''))
+        const resolved = metadataResults.map((result, i) => {
+          if (result.status === 'rejected') {
+            console.warn(`Failed to resolve latest metadata version for ${metadataDocNames[i]}:`, result.reason)
+            return ''
+          }
+          return result.value
+        })
+        const [
+          latestQuoteVersion,
+          latestReferrerVersion,
+          latestOrderClassVersion,
+          latestUtmVersion,
+          latestHooksVersion,
+          latestSignerVersion,
+          latestWidgetVersion,
+          latestPartnerFeeVersion,
+          latestReplacedOrderVersion,
+          latestUserConsentsVersion,
+        ] = resolved
packages/app-data/src/generatedTypes/v1.11.0.ts (1)

93-126: Generated PartnerFee type is quite complex—consider simplifying the underlying schema if possible.
This isn’t actionable in this generated file, but if consumers struggle with this union, schema tweaks (or explicit named definitions) can materially improve the emitted TS surface.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 110c279 and c63c437.

📒 Files selected for processing (6)
  • packages/app-data/src/generatedTypes/index.ts (4 hunks)
  • packages/app-data/src/generatedTypes/latest.ts (1 hunks)
  • packages/app-data/src/generatedTypes/v1.11.0.ts (1 hunks)
  • packages/app-data/src/schemas/userConsents/v0.1.0.json (1 hunks)
  • packages/app-data/src/schemas/v1.11.0.json (1 hunks)
  • packages/app-data/src/scripts/compile.ts (4 hunks)
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: jeffersonBastos
Repo: cowprotocol/cow-sdk PR: 327
File: packages/app-data/src/schemas/v0.3.0.json:1-10
Timestamp: 2025-06-10T03:06:46.146Z
Learning: Schema versions v0.1.0 through v0.7.0 in the app-data package are intentionally designed to allow additional properties (no "additionalProperties": false constraint), while versions v0.8.0 and later enforce strict validation. This represents a deliberate design evolution and historical schema versions should not be modified to add stricter validation.
Learnt from: jeffersonBastos
Repo: cowprotocol/cow-sdk PR: 327
File: packages/app-data/src/schemas/v1.1.0.json:10-14
Timestamp: 2025-06-10T02:39:24.134Z
Learning: In the CoW Protocol app-data schemas, v1.0.0.json and v1.1.0.json both intentionally use default version "0.11.0" rather than matching their filenames. This is a deliberate versioning design, not an error.
Learnt from: jeffersonBastos
Repo: cowprotocol/cow-sdk PR: 327
File: packages/app-data/src/schemas/hooks/v0.2.0.json:14-14
Timestamp: 2025-06-10T03:06:45.755Z
Learning: In the CoW Protocol app-data schemas, there are two different version concepts: the schema version (indicated by the filename like v0.2.0.json) represents the schema structure/capability version, while the default version field represents the content/data version for backward compatibility. When new schema versions add optional fields, the default version can remain the same to ensure existing implementations don't break.
📚 Learning: 2025-06-10T02:39:24.134Z
Learnt from: jeffersonBastos
Repo: cowprotocol/cow-sdk PR: 327
File: packages/app-data/src/schemas/v1.1.0.json:10-14
Timestamp: 2025-06-10T02:39:24.134Z
Learning: In the CoW Protocol app-data schemas, v1.0.0.json and v1.1.0.json both intentionally use default version "0.11.0" rather than matching their filenames. This is a deliberate versioning design, not an error.

Applied to files:

  • packages/app-data/src/generatedTypes/latest.ts
  • packages/app-data/src/schemas/v1.11.0.json
  • packages/app-data/src/generatedTypes/index.ts
📚 Learning: 2025-06-10T03:06:53.585Z
Learnt from: jeffersonBastos
Repo: cowprotocol/cow-sdk PR: 327
File: packages/app-data/src/schemas/v0.2.0.json:34-39
Timestamp: 2025-06-10T03:06:53.585Z
Learning: In the CoW Protocol app-data schemas, nested schema references are intentionally kept at stable versions (like v0.1.0) even when the root schema version increases, to maintain backward compatibility when the referenced schemas have breaking changes.

Applied to files:

  • packages/app-data/src/generatedTypes/latest.ts
  • packages/app-data/src/schemas/v1.11.0.json
  • packages/app-data/src/generatedTypes/index.ts
📚 Learning: 2025-06-10T03:06:45.755Z
Learnt from: jeffersonBastos
Repo: cowprotocol/cow-sdk PR: 327
File: packages/app-data/src/schemas/hooks/v0.2.0.json:14-14
Timestamp: 2025-06-10T03:06:45.755Z
Learning: In the CoW Protocol app-data schemas, there are two different version concepts: the schema version (indicated by the filename like v0.2.0.json) represents the schema structure/capability version, while the default version field represents the content/data version for backward compatibility. When new schema versions add optional fields, the default version can remain the same to ensure existing implementations don't break.

Applied to files:

  • packages/app-data/src/generatedTypes/latest.ts
  • packages/app-data/src/schemas/v1.11.0.json
  • packages/app-data/src/generatedTypes/index.ts
📚 Learning: 2025-06-10T03:06:46.146Z
Learnt from: jeffersonBastos
Repo: cowprotocol/cow-sdk PR: 327
File: packages/app-data/src/schemas/v0.3.0.json:1-10
Timestamp: 2025-06-10T03:06:46.146Z
Learning: Schema versions v0.1.0 through v0.7.0 in the app-data package are intentionally designed to allow additional properties (no "additionalProperties": false constraint), while versions v0.8.0 and later enforce strict validation. This represents a deliberate design evolution and historical schema versions should not be modified to add stricter validation.

Applied to files:

  • packages/app-data/src/schemas/v1.11.0.json
  • packages/app-data/src/schemas/userConsents/v0.1.0.json
  • packages/app-data/src/generatedTypes/index.ts
  • packages/app-data/src/generatedTypes/v1.11.0.ts
📚 Learning: 2025-06-09T23:25:56.909Z
Learnt from: jeffersonBastos
Repo: cowprotocol/cow-sdk PR: 327
File: packages/app-data/src/schemas/quote/v1.0.0.json:2-2
Timestamp: 2025-06-09T23:25:56.909Z
Learning: In the CoW Protocol app-data schemas, the $id field in JSON schema files doesn't always match the filename version. When schema versions maintain the same fundamental structure, they preserve the same $id as the version that introduced that structure for compatibility purposes. For example, quote schemas v0.3.0, v1.0.0, and v1.1.0 all reference "#quote/v0.2.0.json" in their $id field because they maintain the same core structure as v0.2.0.

Applied to files:

  • packages/app-data/src/schemas/v1.11.0.json
📚 Learning: 2025-04-14T20:37:56.543Z
Learnt from: anxolin
Repo: cowprotocol/cow-sdk PR: 267
File: src/bridging/BridgingSdk/getCrossChainOrder.ts:44-46
Timestamp: 2025-04-14T20:37:56.543Z
Learning: The decoding of bridge appData (using provider.decodeBridgeHook) in the getCrossChainOrder function was intentionally left as a TODO comment for implementation in a future PR.

Applied to files:

  • packages/app-data/src/generatedTypes/v1.11.0.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build Package
  • GitHub Check: Publish to GitHub Packages
  • GitHub Check: test
  • GitHub Check: eslint
🔇 Additional comments (7)
packages/app-data/src/generatedTypes/latest.ts (1)

3-3: Latest schema pointer updated correctly to v1.11.0.
This keeps the “latest” barrel export aligned with the new schema version.

packages/app-data/src/generatedTypes/index.ts (1)

17-45: v1.11.0 wiring + new LATEST_USER_CONSENTS_METADATA_VERSION export is coherent.
Imports, constants, LatestAppDataDocVersion, and the union update are consistent.

packages/app-data/src/schemas/v1.11.0.json (1)

29-75: metadata.additionalProperties: false + explicit userConsents entry is a good strictness upgrade—confirm ref target schema enforces date-time if required.
Root integration of userConsents looks correct; main gap is that the referenced schema currently doesn’t validate date-time unless you add format.

packages/app-data/src/generatedTypes/v1.11.0.ts (1)

190-229: UserConsents typing matches the current schema, but you probably want stronger schema validation for acceptedDate.
TS will stay string either way, but schema-side "format": "date-time" is what enforces correctness at validation time.

packages/app-data/src/schemas/userConsents/v0.1.0.json (2)

8-11: No action needed—additionalProperties: false aligns with existing v0.1.0 metadata schema conventions.

Analysis of 14 v0.1.0 metadata schemas shows this pattern is neither unusual nor inconsistent: 7 schemas enforce additionalProperties: false (bridging, flashloan, hook, hooks, partnerFee, replacedOrder, widget), while 7 allow additional properties. The userConsents schema's strict validation on its items object matches the established pattern used by comparable schemas like partnerFee and replacedOrder.


1-26: Add format: "date-time" for acceptedDate (currently only described, not validated).
Right now acceptedDate is just a string; if you want actual ISO-8601 date-time validation, add "format": "date-time".

       "acceptedDate": {
         "$id": "#/properties/acceptedDate",
         "type": "string",
         "description": "ISO 8601 date-time when user accepted the terms in the UI",
+        "format": "date-time",
         "examples": ["2025-11-11T23:00:00Z"]
       }
⛔ Skipped due to learnings
Learnt from: jeffersonBastos
Repo: cowprotocol/cow-sdk PR: 327
File: packages/app-data/src/schemas/v0.3.0.json:1-10
Timestamp: 2025-06-10T03:06:46.146Z
Learning: Schema versions v0.1.0 through v0.7.0 in the app-data package are intentionally designed to allow additional properties (no "additionalProperties": false constraint), while versions v0.8.0 and later enforce strict validation. This represents a deliberate design evolution and historical schema versions should not be modified to add stricter validation.
packages/app-data/src/scripts/compile.ts (1)

204-216: Signature extension for 'userConsents' looks fine—verify downstream callers/types are regenerated together.
Since this is a public union change, ensure any consumers compile against the regenerated generatedTypes/* output.

json-schema-to-typescript compileFromFile options: does it support draft-07 "format": "date-time" in a way that affects generated TS (or is it validation-only)?

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