Skip to content

feat(registry): add subnet-funded pool association to the repo model (#6320) - #6333

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
nghetienhiep:fix/issue-6320
Jul 16, 2026
Merged

feat(registry): add subnet-funded pool association to the repo model (#6320)#6333
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
nghetienhiep:fix/issue-6320

Conversation

@nghetienhiep

Copy link
Copy Markdown
Contributor

Summary

This mirrors the existing timeDecay / parseTimeDecayOverrides pattern in the same file (a nullable, defensively-parsed, grouped override that is null when absent). No settlement mechanics, no pricing/allocation, no UI — data model only.

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 (Closes #6320).

Validation

  • git diff --check
  • npm run typecheck
  • npm run test:coverage locally — test/unit/registry.test.ts passes; the diff (both new functions and every ||/?./?? branch) is at 100% line and branch coverage. The only failing suites in the full run are selfhost-ams-reporting, miner-discover-cli, and miner-live-issue-snapshot, which shell out to the sqlite3 CLI binary that is absent from this local sandbox — unrelated to this diff and green on CI.
  • npm run ui:openapi:check (no drift; RegistryRepoSchema is a curated subset that already omits the parallel internal timeDecay field, so poolAssociation follows that precedent and needs no OpenAPI change).
  • New behavior has unit tests for the full association, the organic (no-association) path, both half-populated (partial) paths, and the accessor's null/undefined/absent branches.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized and makes no compensation/optimization claims.
  • No auth/cookie/CORS/session surface touched.
  • No API/OpenAPI/MCP behavior change (verified via ui:openapi:check).
  • No UI change — UI Evidence not applicable (data-model/types only).

Notes

  • Additive and non-breaking: poolAssociation is optional and defaults to null; existing consumers of RegistryRepoConfig are unaffected (repo-wide typecheck clean).

Closes #6320

…SONbored#6320)

JSONbored#6099 models a subnet-funded pool as a distinct entity related to a repo,
but RegistryRepoConfig is entirely repo-keyed with no way to record that a
registered repo is backed by a subnet's reward pool. Add an optional,
additive association so this can be represented without changing anything
about how an organic (non-pool) repo registers.

- New RepoPoolAssociation type (poolId matching JSONbored#6098's SettlementBackend
  shape, plus the funding subnet's netuid) and a nullable poolAssociation
  field on RegistryRepoConfig.
- normalize parses the association from the registry's flat pool_id/subnet_id
  fields; both must be well-formed or the whole association is dropped, so an
  organic repo (and any half-populated one) round-trips byte-identical.
- getRepoPoolAssociation read accessor returns a repo's association or null —
  the single read side JSONbored#6314's PayoutEligibleEvent construction and JSONbored#6099's
  pool-state reporting will consume.

Closes JSONbored#6320
@nghetienhiep
nghetienhiep requested a review from JSONbored as a code owner July 16, 2026 02:28
@superagent-security

Copy link
Copy Markdown
Contributor

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

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

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-16 02:35:37 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
Adds a nullable poolAssociation field to RegistryRepoConfig, a defensive parsePoolAssociation that requires both pool_id and subnet_id to be well-formed or drops to null, and a getRepoPoolAssociation read accessor, mirroring the existing timeDecay pattern in the same file. Logic is correct: organic repos and partial associations parse to null, keeping existing repos byte-identical, and tests cover the full/partial/missing/null/undefined matrix. This is a pure additive data-model change with no consumers wired up yet, consistent with its stated scope.

Nits — 4 non-blocking
  • normalize.ts: parsePoolAssociation silently drops a subnet_id of 0 as invalid since numberValue likely treats falsy/non-finite specially — worth confirming numberValue(0) returns 0 and not null, since netuid 0 is a valid Bittensor subnet id.
  • types.ts: the RepoPoolAssociation JSDoc references Epic: Bittensor-native subnet-funded reward-pool track (Wave 5.1) #6101 and Design spec: settlement-backend interface (gittensor-owned or self-built, pluggable either way) #6098 without those issues being part of this PR's diff context — consider double-checking those issue numbers are accurate before merge.
  • src/registry/normalize.ts: if numberValue treats 0 as falsy anywhere in this codebase's convention, add an explicit test case for subnet_id: 0 to lock in correct handling of the root subnet.
  • test/unit/registry.test.ts: consider also asserting that an association with subnet_id as a non-finite value (e.g. NaN-producing input) is dropped, matching the 'finite subnet netuid' claim in the docstring.

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 #6320
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ❌ 8/20 High 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: 112 registered-repo PR(s), 64 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor nghetienhiep; Gittensor profile; 112 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The PR adds a nullable RepoPoolAssociation (poolId + subnetId) to RegistryRepoConfig, parses it defensively from raw payload fields with organic repos falling back to null, and exposes getRepoPoolAssociation as the read accessor — matching both acceptance criteria and staying within the stated data-model-only boundaries.

Review context
  • Author: nghetienhiep
  • 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: 112 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 1 step in the Signals table above.
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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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://gittensory.aethereal.dev/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 7e57c5c into JSONbored:main Jul 16, 2026
13 checks passed
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.60%. Comparing base (7ab6071) to head (15c62b5).
⚠️ Report is 36 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6333   +/-   ##
=======================================
  Coverage   95.60%   95.60%           
=======================================
  Files         596      596           
  Lines       47135    47140    +5     
  Branches    15006    15008    +2     
=======================================
+ Hits        45063    45068    +5     
  Misses       1290     1290           
  Partials      782      782           
Flag Coverage Δ
shard-1 43.96% <40.00%> (-0.18%) ⬇️
shard-2 36.81% <40.00%> (+0.29%) ⬆️
shard-3 32.45% <40.00%> (+0.04%) ⬆️
shard-4 33.93% <100.00%> (-0.65%) ⬇️
shard-5 31.58% <40.00%> (-0.10%) ⬇️
shard-6 45.18% <40.00%> (+0.41%) ⬆️

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% <ø> (ø)

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.

Extend the repo-registry data model to support subnet-funded pool association

1 participant