chore(ens-referrals): Update referral program edition defaults#1849
chore(ens-referrals): Update referral program edition defaults#1849
Conversation
🦋 Changeset detectedLatest commit: b350e0f The changes in this PR will be included in the next version bump. This PR includes changesets to release 23 packages
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 |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughUpdated Referral Program default editions to match production: replaced prior entries with three editions ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
.changeset/tough-sites-greet.mdpackages/ens-referrals/src/v1/edition-defaults.ts
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
packages/ens-referrals/README.mdpackages/ens-referrals/src/v1/edition-defaults.test.ts
There was a problem hiding this comment.
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.
Greptile SummaryThis PR updates the Key changes:
Confidence Score: 5/5Safe 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
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
Reviews (1): Last reviewed commit: "Apply ai assistant's suggestions, pt.3" | Re-trigger Greptile |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
packages/ens-referrals/src/v1/edition-defaults.test.ts
…/chore/update-referral-program-edition-defaults
There was a problem hiding this comment.
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.
Lite PR → Update referral program edition defaults
Summary
packages\ens-referrals\src\v1\edition-defaults.ts)packages\ens-referrals\src\v1\edition-defaults.test.ts)packages\ens-referrals\README.mdexample to match new defaultsWhy
Testing
test,typecheck&lintcommands locally to make sure that the changes didn't break anythingNotes for Reviewer
Pre-Review Checklist (Blocking)