feat(registry): add repoOrigin (BYOR/APR) to RegistryRepoConfig#7645
Conversation
…bored#7636) Mirrors JSONbored#6320's poolAssociation exactly: a new OPTIONAL field on RegistryRepoConfig that is absent for every repo predating it, so an unmarked repo round-trips byte-identical to today. No behavior changes. - types.ts: `RepoOrigin = { kind: "byor" } | { kind: "apr"; hostingOrg: string }` and `repoOrigin?: RepoOrigin | null` on RegistryRepoConfig, with the same null-safety doc convention poolAssociation uses. Absent means "pre-dates this field / not yet known" -- deliberately NOT assumed BYOR, per the issue. - registry/normalize.ts: `parseRepoOrigin` reads the registry's flat `repo_origin` (+ `hosting_org` for APR) fields and is threaded into normalizeRepo alongside parsePoolAssociation; a `getRepoOrigin` accessor mirrors getRepoPoolAssociation. An absent marker, an unrecognized string, or an `apr` marker missing its hosting org all parse to null -- the same "a partial one is treated as none" collapse parsePoolAssociation already uses, never a half-populated object. Type-and-plumbing only: no repo-creation, GitHub API, or provisioning logic (that is JSONbored#7590's scope). Tests (registry.test.ts, mirroring JSONbored#6320's poolAssociation test): a BYOR marker, a full APR origin, an unmarked repo (null, byte-identical), a malformed apr-without-hosting-org (null), and an unrecognized origin (null); plus the getRepoOrigin accessor over present/null/undefined configs. Both the present and absent branches of the new field are 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 #7645 +/- ##
==========================================
- Coverage 88.51% 88.50% -0.02%
==========================================
Files 724 724
Lines 76001 76008 +7
Branches 22619 22625 +6
==========================================
- Hits 67272 67268 -4
- Misses 7681 7688 +7
- Partials 1048 1052 +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 06:29:07 UTC
Review summary Nits — 4 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 #7636
Summary
Adds an optional
repoOriginfield toRegistryRepoConfig, mirroringpoolAssociation's exact null-safety convention from #6320. A repo that predates this field carries no origin and round-trips byte-identical to today — there is no behavior change for any existing repo.RepoOrigindistinguishes BYOR (a customer's own pre-existing repo) from APR (a loopover-provisioned repo), the representation the BYOR+APR epic (#7589) needs so downstream consumers know which provisioning path a repo took.What changed (2 files, mirroring #6320's footprint exactly)
src/types.ts—RepoOrigin = { kind: "byor" } | { kind: "apr"; hostingOrg: string }, andrepoOrigin?: RepoOrigin | nullonRegistryRepoConfig, with the same doc-comment conventionpoolAssociationuses. Per the issue, absent means "pre-dates this field / not yet known" — deliberately not assumed BYOR.src/registry/normalize.ts—parseRepoOrigin(config)reads the registry's flatrepo_origin(+hosting_orgfor APR) fields and is threaded intonormalizeReporight besideparsePoolAssociation; agetRepoOriginaccessor mirrorsgetRepoPoolAssociation.An absent marker, an unrecognized origin string, or an
aprmarker missing its hosting org all parse tonull— the same "a partial one is treated as none" collapseparsePoolAssociationalready uses for a half-specified pool association, never a half-populated object.Type-and-plumbing only. No repo-creation, GitHub API, or provisioning logic — that is #7590's scope, explicitly excluded here.
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 engine-parity:drift-checknpm run docs:drift-checknpm audit --audit-level=moderatePatch coverage: 100% (7/7 executable changed lines, both branches of the new field — present and absent).
Tests in
test/unit/registry.test.tsmirror #6320'spoolAssociationtest exactly: abyormarker →{ kind: "byor" }; a full APR origin →{ kind: "apr", hostingOrg }; an unmarked repo →null(byte-identical); a malformedapr-without-hosting-org →null; an unrecognized origin →null; plus thegetRepoOriginaccessor 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 — this is 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 modification to how any current repo normalizes.getRepoOriginis exported-but-unconsumed for now, exactly asgetRepoPoolAssociationwas when Extend the repo-registry data model to support subnet-funded pool association #6320 landed — it is the read seam later APR work will consume.