Skip to content

feat(registry): add CustomerPoolAssociation, parallel to RepoPoolAssociation - #7683

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
glorydavid03023:feat/customer-pool-association
Jul 21, 2026
Merged

feat(registry): add CustomerPoolAssociation, parallel to RepoPoolAssociation#7683
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
glorydavid03023:feat/customer-pool-association

Conversation

@glorydavid03023

Copy link
Copy Markdown
Contributor

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). RepoPoolAssociation requires a subnetId, 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 to RepoPoolAssociation rather than overloading it with an optional subnetId, so the two funding models stay structurally distinct. It's threaded through exactly the sites RepoPoolAssociation touches, mirroring #6320's precedent (the checklist the issue points to).

What changed (2 files, the #6320 footprint)

  • src/types.ts — the CustomerPoolAssociation type + an optional customerPoolAssociation?: CustomerPoolAssociation | null on RegistryRepoConfig, with the same null-safety convention poolAssociation uses. Absent = a repo with no customer-funded pool, byte-identical to today.
  • src/registry/normalize.tsparseCustomerPoolAssociation reads the registry's flat pool_id / funder_account fields (both required; a partial one collapses to null, exactly as parsePoolAssociation treats a half-specified subnet association), threaded into normalizeRepo beside parsePoolAssociation; a getCustomerPoolAssociation accessor mirrors getRepoPoolAssociation.

The two associations are independent: a subnet-funded repo (pool_id + subnet_id, no funder_account) parses to a poolAssociation but a null customerPoolAssociation, 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

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves — see the closing reference at the top of this body.

Validation

  • git diff --check
  • npm run typecheck (zero new errors vs base)
  • npm run test:coverage locally; codecov/patch ≥99% of changed lines AND branches
  • npm run ui:openapi:check
  • npm run docs:drift-check
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

Patch coverage: 100% (5/5 executable changed lines, both present and absent branches of the new field).

Tests in test/unit/registry.test.ts mirror #6320's poolAssociation test 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 partial pool-only and a partial funder-only (both null); plus the getCustomerPoolAssociation accessor over present / null / undefined / key-absent configs. All existing registry tests pass unchanged.

If any required check was skipped, explain why:

  • None skipped.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed (no API/OpenAPI surface change — internal registry type; ui:openapi:check confirms no drift).
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section. Not applicable — backend type + parser only.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

Not applicable — a backend type addition plus its registry parser. No UI, frontend, docs, or extension surface is touched.

Notes

  • Optional field, defaults to absent → pure additive change: git diff shows only additions to existing constructs, no change to how any current repo normalizes.
  • funderAccount names the paying customer's account (the funding-source analogue of subnetId); getCustomerPoolAssociation is exported-but-unconsumed for now, exactly as getRepoPoolAssociation was when Extend the repo-registry data model to support subnet-funded pool association #6320 landed — the read seam later Wave-5 pool work consumes.

…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-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.53%. Comparing base (8bcf5be) to head (f7f3e24).
⚠️ Report is 1 commits behind head on main.

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     
Flag Coverage Δ
shard-1 33.27% <40.00%> (+<0.01%) ⬆️
shard-2 36.21% <40.00%> (-0.02%) ⬇️
shard-3 35.96% <40.00%> (+<0.01%) ⬆️
shard-4 40.72% <40.00%> (-0.10%) ⬇️
shard-5 29.41% <40.00%> (+<0.01%) ⬆️
shard-6 31.94% <100.00%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/registry/normalize.ts 100.00% <100.00%> (ø)
src/types.ts 100.00% <ø> (ø)

... and 2 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 21, 2026
@loopover-orb

loopover-orb Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-21 08:11:02 UTC

3 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
The AI review returned non-blocking notes for this change but did not include a separate narrative summary. Review the nits below before deciding this PR.

Nits — 5 non-blocking
  • src/registry/normalize.ts: both `parsePoolAssociation` and `parseCustomerPoolAssociation` read `config.pool_id`, so a repo with `pool_id` + `funder_account` but no `subnet_id` would get a customer association but not a subnet one, and vice versa — worth double-checking this shared-field overlap is intentional per the registry's actual field semantics rather than an accidental collision.
  • src/types.ts: the JSDoc comments on the new type/field are quite long relative to the existing `poolAssociation` doc comment one line above it — could be trimmed for consistency with the surrounding style.
  • The magic issue-number references (Add separate type for customer-funded (non-subnet) pools, parallel to RepoPoolAssociation #7679) embedded in comments are fine per this repo's existing convention (e.g. Design spec: subnet-level onboarding & registration flow (extends #4789's individual-customer pattern) #6099, Extend the repo-registry data model to support subnet-funded pool association #6320 elsewhere) but flagged by the external brief as 'magic numbers' — not an actual defect, just a heuristic false positive.
  • Consider adding a test case where a repo has `pool_id` + `subnet_id` + `funder_account` all present, to explicitly document/verify that both associations populate simultaneously from the shared `pool_id` field.
  • If `pool_id` is meant to be pool-type-specific (subnet pool vs customer pool), consider a comment clarifying that the same registry `pool_id` field is intentionally shared between both association kinds.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #7679
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 210 registered-repo PR(s), 123 merged, 15 issue(s).
Contributor context ✅ Confirmed Gittensor contributor glorydavid03023; Gittensor profile; 210 PR(s), 15 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Addressed
The PR adds a distinct CustomerPoolAssociation type (poolId/funderAccount) parallel to RepoPoolAssociation rather than overloading it, and threads it through the same normalize.ts call sites (parse function, normalizeRepo, accessor) mirroring the RepoPoolAssociation/#6320 pattern, with tests confirming optional/absent behavior stays byte-identical. This satisfies both deliverables and respects the

Review context
  • Author: glorydavid03023
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 210 PR(s), 15 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

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.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 2631e5f into JSONbored:main Jul 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add separate type for customer-funded (non-subnet) pools, parallel to RepoPoolAssociation

1 participant