feat(registry): add CustomerPoolAssociation, parallel to RepoPoolAssociation - #7683
Conversation
…ciation (JSONbored#7679) Wave 5's "two demographics" (JSONbored#4778) includes customer-funded pools — a paying customer, not necessarily a Bittensor subnet — that still pay out to gittensor-registered contributors as emissions. RepoPoolAssociation requires a `subnetId`, which is meaningless for a non-subnet customer, so a customer-funded pool has no data-model representation today. Adds a separate `CustomerPoolAssociation = { poolId; funderAccount }`, parallel to RepoPoolAssociation rather than overloading it with an optional subnetId, so the two funding models stay structurally distinct (different funding source, same payout mechanism). Threaded through exactly the sites RepoPoolAssociation touches, mirroring JSONbored#6320's precedent: - types.ts: the new type + an OPTIONAL `customerPoolAssociation?` on RegistryRepoConfig, with the same null-safety convention poolAssociation uses — absent = a repo with no customer-funded pool, byte-identical to today. - registry/normalize.ts: parseCustomerPoolAssociation reads the flat `pool_id`/`funder_account` fields (both required; a partial one collapses to null, like parsePoolAssociation), threaded into normalizeRepo beside parsePoolAssociation; a getCustomerPoolAssociation accessor mirrors getRepoPoolAssociation. The two stay independent: a subnet-funded repo (pool_id + subnet_id, no funder_account) parses to a poolAssociation but a null customerPoolAssociation, and vice-versa. Type-and-plumbing only, no economics or payout logic. Tests (registry.test.ts, mirroring JSONbored#6320's poolAssociation test): a full customer association; a subnet-funded repo confirmed to have NO customer association (distinctness); an organic repo (null); partial pool-only and funder-only (both null); and the getCustomerPoolAssociation accessor over present/null/undefined/key-absent configs. Both present and absent branches covered.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7683 +/- ##
==========================================
- Coverage 88.54% 88.53% -0.02%
==========================================
Files 725 725
Lines 76170 76175 +5
Branches 22671 22673 +2
==========================================
- Hits 67446 67440 -6
- Misses 7680 7687 +7
- Partials 1044 1048 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-21 08:11:02 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Closes #7679
Summary
Wave 5's "two demographics" (#4778) includes customer-funded pools — a paying customer, not necessarily a Bittensor subnet — which still pay out to gittensor-registered contributors as emissions (same payout mechanism, different funding source).
RepoPoolAssociationrequires asubnetId, which is meaningless for a non-subnet customer, so a customer-funded pool has no data-model representation today. This is purely that representation gap.Adds a separate
CustomerPoolAssociation = { poolId; funderAccount }, parallel toRepoPoolAssociationrather than overloading it with an optionalsubnetId, so the two funding models stay structurally distinct. It's threaded through exactly the sitesRepoPoolAssociationtouches, mirroring #6320's precedent (the checklist the issue points to).What changed (2 files, the #6320 footprint)
src/types.ts— theCustomerPoolAssociationtype + an optionalcustomerPoolAssociation?: CustomerPoolAssociation | nullonRegistryRepoConfig, with the same null-safety conventionpoolAssociationuses. Absent = a repo with no customer-funded pool, byte-identical to today.src/registry/normalize.ts—parseCustomerPoolAssociationreads the registry's flatpool_id/funder_accountfields (both required; a partial one collapses tonull, exactly asparsePoolAssociationtreats a half-specified subnet association), threaded intonormalizeRepobesideparsePoolAssociation; agetCustomerPoolAssociationaccessor mirrorsgetRepoPoolAssociation.The two associations are independent: a subnet-funded repo (
pool_id+subnet_id, nofunder_account) parses to apoolAssociationbut anullcustomerPoolAssociation, and a customer-funded repo the reverse. Type-and-plumbing only — no economics or payout logic (the issue confirms the payout mechanism is unchanged; this is a data-representation gap).Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run typecheck(zero new errors vs base)npm run test:coveragelocally;codecov/patch≥99% of changed lines AND branchesnpm run ui:openapi:checknpm run docs:drift-checknpm audit --audit-level=moderatePatch coverage: 100% (5/5 executable changed lines, both present and absent branches of the new field).
Tests in
test/unit/registry.test.tsmirror #6320'spoolAssociationtest exactly: a full customer association; a subnet-funded repo confirmed to carry no customer association (proving the two stay distinct); an organic repo (null); a partialpool-onlyand a partialfunder-only(bothnull); plus thegetCustomerPoolAssociationaccessor over present /null/undefined/ key-absent configs. All existing registry tests pass unchanged.If any required check was skipped, explain why:
Safety
ui:openapi:checkconfirms no drift).UI Evidencesection. Not applicable — backend type + parser only.UI Evidence
Not applicable — a backend type addition plus its registry parser. No UI, frontend, docs, or extension surface is touched.
Notes
git diffshows only additions to existing constructs, no change to how any current repo normalizes.funderAccountnames the paying customer's account (the funding-source analogue ofsubnetId);getCustomerPoolAssociationis exported-but-unconsumed for now, exactly asgetRepoPoolAssociationwas when Extend the repo-registry data model to support subnet-funded pool association #6320 landed — the read seam later Wave-5 pool work consumes.