Skip to content

refactor(selfhost): consolidate triplicated self-repo-default resolver #2911

Description

@JSONbored

Summary

The literal default "JSONbored/gittensory" (as a self-repo fallback, overridable via GITTENSORY_DRIFT_ISSUE_REPO) is independently reimplemented in three separate files, each with its own near-identical constant + resolver function, instead of one shared helper.

Part of #1667.

Context

Found during a 2026-07-04 audit. The three sites:

  • src/config/gittensory-repo-focus-manifest.ts:77-83GITTENSOR_SELF_REPO_DEFAULT / resolveGittensorySelfRepoFullName.
  • src/services/self-dogfood-registration-pack.ts:11,35-39DEFAULT_SELF_DOGFOOD_REPO / resolveSelfDogfoodRepoFullName.
  • src/upstream/ruleset.ts:37,288DEFAULT_DRIFT_ISSUE_REPO.

This is not a harmful hardcoding in the sense of "this breaks other self-hosters" — each only activates as a narrow bootstrapping fallback gated by isGittensorySelfRepo (so it never fires for anyone else's repos), and the default is env-overridable. But per this project's "build modular, not single-repo" principle, the same default+override pattern being hand-copied three times is exactly the kind of drift that should be one shared helper — if GITTENSORY_DRIFT_ISSUE_REPO's semantics or default value ever change, someone has to remember to update three call sites instead of one.

Requirements

  • Export a single resolver (the existing resolveGittensorySelfRepoFullName in gittensory-repo-focus-manifest.ts is a reasonable canonical home, since it's arguably the "most central" of the three) and have self-dogfood-registration-pack.ts and upstream/ruleset.ts import and use it instead of re-declaring their own constant + function.
  • Check for any subtle behavioral difference between the three current implementations before consolidating (e.g. slightly different trimming/normalization) — if they genuinely differ, reconcile deliberately rather than silently picking one.
  • No change in externally-observable behavior — this is a pure consolidation.

Deliverables

  • A PR removing the two duplicate constant+resolver pairs and routing both call sites through the single shared helper, with existing tests for all three sites still passing (and updated import paths where needed).

Expected outcome

GITTENSORY_DRIFT_ISSUE_REPO's default and override behavior lives in exactly one place; a future change to it only requires editing one function.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions