Skip to content

chore(ens-referrals): Update referral program edition defaults#1849

Open
Y3drk wants to merge 11 commits intomainfrom
y3drk/chore/update-referral-program-edition-defaults
Open

chore(ens-referrals): Update referral program edition defaults#1849
Y3drk wants to merge 11 commits intomainfrom
y3drk/chore/update-referral-program-edition-defaults

Conversation

@Y3drk
Copy link
Copy Markdown
Contributor

@Y3drk Y3drk commented Mar 31, 2026

Lite PR → Update referral program edition defaults

Summary

  • Updated the Referral Program edition defaults to match the production configuration (see packages\ens-referrals\src\v1\edition-defaults.ts)
  • Added unit tests that verify the general correctness of the edition defaults as well as them being up-to-date with the production config (see packages\ens-referrals\src\v1\edition-defaults.test.ts)
  • Adapted a packages\ens-referrals\README.md example to match new defaults

Why


Testing

  • Ran the test, typecheck & lint commands locally to make sure that the changes didn't break anything
  • Confirmed the above with our CI workflow in this PR
  • The code changes were validated against the production data in https://ensawards.org/production-editions.json
  • Self-review of code changes after pushing to remote
  • Added unit tests should further validate the new changes

Notes for Reviewer

  • Appreciate advice on how to test such changes in general (local deployments of ENSApi? I'm not really sure) cc: @Goader @lightwalker-eth

Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

@Y3drk Y3drk self-assigned this Mar 31, 2026
Copilot AI review requested due to automatic review settings March 31, 2026 13:42
@Y3drk Y3drk added the ensanalytics ENSAnalytics related label Mar 31, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: b350e0f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages
Name Type
@namehash/ens-referrals Major
ensapi Major
ensindexer Major
ensadmin Major
ensrainbow Major
fallback-ensapi Major
enssdk Major
enscli Major
enskit Major
ensskills Major
@ensnode/datasources Major
@ensnode/ensrainbow-sdk Major
@ensnode/ensdb-sdk Major
@ensnode/ensnode-react Major
@ensnode/ensnode-sdk Major
@ensnode/ponder-sdk Major
@ensnode/ponder-subgraph Major
@ensnode/shared-configs Major
@docs/ensnode Major
@docs/ensrainbow Major
@docs/mintlify Major
@namehash/namehash-ui Major
@ensnode/integration-test-env Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Updated Referral Program default editions to match production: replaced prior entries with three editions (2025-12, 2026-04, 2026-05), adjusted rules URLs and rev-share limits, added Changesets, updated README example, and added Vitest coverage validating defaults against production JSON.

Changes

Cohort / File(s) Summary
Changesets Entry
\.changeset/tough-sites-greet.md, \.changeset/loose-news-sin.md
Added Changeset files declaring minor bumps for @namehash/ens-referrals noting alignment with production edition settings and that tests were added.
Edition Defaults Configuration
packages/ens-referrals/src/v1/edition-defaults.ts
Replaced prior edition array with three editions: 2025-12, 2026-04 (was 2026-03, rev-share limit reduced), and new 2026-05; updated rules URLs, rev-share values, date windows, local variable names, and return order.
Documentation Example
packages/ens-referrals/README.md
Updated README example to reference edition slugs ["2025-12", "2026-04"].
Tests
packages/ens-referrals/src/v1/edition-defaults.test.ts
Added Vitest suite that optionally fetches production-editions.json and asserts local defaults match production slugs and key fields, validates structural invariants, and checks unsupported-namespace error handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

ensnode-internal

Poem

🐰 I hopped through configs, neat and spry,

April rose where March waved goodbye,
May arrived with rules in tow,
URLs set and rev-shares low,
A tiny thump — editions aligned, hi-ho!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating referral program edition defaults in the ens-referrals package.
Description check ✅ Passed The PR description follows the template with complete sections: Summary (3 bullets), Why (with issue reference), Testing (multiple verification methods), Notes for Reviewer, and Pre-Review Checklist (both items checked).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch y3drk/chore/update-referral-program-edition-defaults

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.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
admin.ensnode.io Skipped Skipped Apr 1, 2026 5:59am
ensnode.io Skipped Skipped Apr 1, 2026 5:59am
ensrainbow.io Skipped Skipped Apr 1, 2026 5:59am

Copy link
Copy Markdown
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

Updates the @namehash/ens-referrals v1 default referral program edition configuration set so local/default behavior matches the current production editions configuration used by ENS Awards.

Changes:

  • Renamed and adjusted the default edition configs (updated slugs, display names, rule URLs, and parameters).
  • Removed the prior “2026-03” default and added “2026-04” and “2026-05” rev-share-limit editions with updated pool/qualification values.
  • Added a Changesets entry to publish the update.

Reviewed changes

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

File Description
packages/ens-referrals/src/v1/edition-defaults.ts Updates the built-in default edition set (editions, dates, rule URLs, and award parameters).
.changeset/tough-sites-greet.md Declares the release bump for the defaults update.

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

Copy link
Copy Markdown
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ens-referrals/src/v1/edition-defaults.ts`:
- Around line 75-79: Add a unit-level parity test that calls
buildReferralProgramEditionConfigSet with the production namespace editions
(e.g., december2025Edition, april2026Edition, may2026Edition) and compares the
resulting config set against a checked-in JSON fixture: assert slug,
startTimestamp, endTimestamp, award values, and rules URL(s) match exactly;
store the expected output as a fixture (committed) and fail the test on any
drift so changes to edition-defaults.ts can be verified locally and in CI
without deploying ENSApi.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: dd812cf4-a8a2-411a-8dbd-032d75ff2ffa

📥 Commits

Reviewing files that changed from the base of the PR and between ab1750c and f02d544.

📒 Files selected for processing (2)
  • .changeset/tough-sites-greet.md
  • packages/ens-referrals/src/v1/edition-defaults.ts

Copy link
Copy Markdown
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

Additional Suggestion:

Documentation examples reference removed edition slug "2026-03" which no longer exists in the default edition configuration

Fix on Vercel

@vercel vercel bot temporarily deployed to Preview – ensnode.io March 31, 2026 14:55 Inactive
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io March 31, 2026 14:55 Inactive
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io March 31, 2026 14:55 Inactive
Copilot AI review requested due to automatic review settings March 31, 2026 14:56
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io March 31, 2026 14:56 Inactive
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io March 31, 2026 14:57 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io March 31, 2026 14:57 Inactive
Copy link
Copy Markdown
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 5 out of 5 changed files in this pull request and generated 3 comments.


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

Copy link
Copy Markdown
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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ens-referrals/src/v1/edition-defaults.test.ts`:
- Around line 14-34: The test suite calls fetchProductionEditions which performs
a live HTTP fetch from PRODUCTION_EDITIONS_URL and hard-fails on network errors;
replace that live dependency with a pinned fixture: add a JSON fixture (e.g.,
test/fixtures/production-editions.json) and modify the suite to load that
fixture instead of calling fetchProductionEditions; keep fetchProductionEditions
for any separate integration check but move the live parity comparison into a
separate scheduled/integration test (or mark it with a tag like `@integration`)
and remove the top-level throw so unit tests use only the local fixture when
invoking getDefaultReferralProgramEditionConfigSet.
- Around line 29-31: The describe callback is async and awaits
fetchProductionEditions, which breaks Vitest collection; make the describe
callback synchronous, declare a top-level mutable variable (e.g., let
productionEditions) inside the describe, add a beforeAll hook that awaits
fetchProductionEditions and assigns its result to that variable, and update
existing tests to use the variable; specifically remove async/await from the
describe block that references fetchProductionEditions and move the async call
into beforeAll so fetchProductionEditions runs during setup instead of during
test collection.
- Line 20: Replace the unsafe cast to ReferralProgramEditionConfig[] by parsing
the JSON through the Zod-backed deserializer: import
deserializeReferralProgramEditionConfigSetArray from "./api/deserialize" (or
named import) and return deserializeReferralProgramEditionConfigSetArray(await
response.json()) from fetchProductionEditions (the location currently doing "as
ReferralProgramEditionConfig[]") so runtime validation and clear errors are
produced instead of an unchecked type cast.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4d712c31-923d-4ef6-9a7e-46cc2b31844d

📥 Commits

Reviewing files that changed from the base of the PR and between f02d544 and 621556e.

📒 Files selected for processing (2)
  • packages/ens-referrals/README.md
  • packages/ens-referrals/src/v1/edition-defaults.test.ts

@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io March 31, 2026 15:33 Inactive
Copy link
Copy Markdown
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 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.

@Y3drk Y3drk marked this pull request as ready for review March 31, 2026 16:00
@Y3drk Y3drk requested a review from a team as a code owner March 31, 2026 16:00
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 31, 2026

Greptile Summary

This PR updates the @namehash/ens-referrals default referral program edition configuration to match the current production configuration. The March 2026 edition is replaced by April 2026 (with a corrected minQualifiedRevenueContribution of $100 and the proper rules URL), a new May 2026 edition is added, the December 2025 rules URL is corrected, and variable names are made more descriptive. A new test file validates both structural correctness and production parity (with graceful skip when the remote URL is unreachable). The README example is updated to reference a currently active edition slug.

Key changes:

  • edition-defaults.ts: Replaced edition1/edition2 with named constants; removed 2026-03, added 2026-04 and 2026-05; updated December 2025 rulesUrl from the generic holiday URL to the edition-specific one.
  • edition-defaults.test.ts: New test suite covering production parity (live fetch + skip), structural invariants (slug format, endTime >= startTime, recognized award models, valid HTTPS rulesUrls), and error handling.
  • README.md: Example updated from "2026-01" to "2026-04" to reflect the new active edition.
  • Two minor changesets added for the defaults update and the new tests.

Confidence Score: 5/5

Safe to merge — changes are data/config updates aligned with the live production config, backed by a well-structured test suite.

All changes are straightforward config updates with no logic alterations. The new test file gracefully handles network unavailability and covers the key structural invariants. The only finding is a P2 style suggestion (redundant new URL() wrapping) that does not affect correctness or runtime behavior.

No files require special attention.

Important Files Changed

Filename Overview
packages/ens-referrals/src/v1/edition-defaults.ts Updated edition defaults: removed March 2026, added April and May 2026 editions, improved variable naming, and corrected rulesUrl for December 2025.
packages/ens-referrals/src/v1/edition-defaults.test.ts New test file covering production parity (via live network fetch with graceful skip), structural validity, and error handling; one minor redundancy in the rulesUrl assertion.
packages/ens-referrals/README.md Updated example edition slugs to match the new defaults (2026-01 → 2026-04).
.changeset/loose-news-sin.md Changeset for added unit tests, correctly tagged as minor.
.changeset/tough-sites-greet.md Changeset for updated edition defaults, correctly tagged as minor.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[getDefaultReferralProgramEditionConfigSet] --> B{ensNamespaceId}
    B -- Mainnet --> C[getEthnamesSubregistryId]
    B -- unsupported --> ERR[throw Error]
    C --> D[december2025Edition\n slug: 2025-12\n model: PieSplit\n pool: $10 000\n max: 10 referrers]
    C --> E[april2026Edition\n slug: 2026-04\n model: RevShareLimit\n pool: $10 000\n min contribution: $100]
    C --> F[may2026Edition\n slug: 2026-05\n model: RevShareLimit\n pool: $30 000\n min contribution: $100]
    D & E & F --> G[buildReferralProgramEditionConfigSet]
    G --> H[ReferralProgramEditionConfigSet\n Map slug to config]

    subgraph Tests
        T1[fetchProductionEditions\nhttps://ensawards.org/production-editions.json] -- ok --> T2[deserializeReferralProgramEditionConfigSetArray]
        T1 -- network error / non-ok --> T3[return null - skip tests]
        T2 --> T4[Compare count, slugs\nand per-field values\nagainst local configSet]
        H --> T4
    end
Loading

Reviews (1): Last reviewed commit: "Apply ai assistant's suggestions, pt.3" | Re-trigger Greptile

Copy link
Copy Markdown
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ens-referrals/src/v1/edition-defaults.test.ts`:
- Around line 118-133: The RevShareLimit branch in the test (inside the if
checking rules.awardModel === ReferralProgramAwardModels.RevShareLimit)
currently asserts only minQualifiedRevenueContribution and
qualifiedRevenueShare; add an assertion that rules.disqualifications strictly
equals expected.rules.disqualifications (cast expected.rules to
ReferralProgramRulesRevShareLimit) using expect(...).toStrictEqual(...) with a
clear failure message referencing expected.slug so any mismatch in
disqualifications fails the parity check.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f8824f6b-7d96-442f-a135-74d37d7997ee

📥 Commits

Reviewing files that changed from the base of the PR and between 03dc906 and 08dca2d.

📒 Files selected for processing (1)
  • packages/ens-referrals/src/v1/edition-defaults.test.ts

@vercel vercel bot temporarily deployed to Preview – ensrainbow.io March 31, 2026 16:14 Inactive
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io March 31, 2026 16:14 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io March 31, 2026 16:15 Inactive
@Y3drk Y3drk linked an issue Mar 31, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@Y3drk Hey overall looks good to me 👍 @Goader Could you please review the tests and share your advice on any changes? @Goader Please take the lead to approve this PR to be merged when you are ready.

Copy link
Copy Markdown
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 5 out of 5 changed files in this pull request and generated 2 comments.


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

@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io April 1, 2026 05:59 Inactive
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io April 1, 2026 05:59 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io April 1, 2026 05:59 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ensanalytics ENSAnalytics related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Referral Program Edition Defaults

3 participants