Skip to content

fix(github): honor PUBLIC_SITE_ORIGIN in the PR footer and repo-doc render - #4668

Merged
JSONbored merged 1 commit into
mainfrom
fix/selfhoster-branding-footer-repodoc-4613
Jul 10, 2026
Merged

fix(github): honor PUBLIC_SITE_ORIGIN in the PR footer and repo-doc render#4668
JSONbored merged 1 commit into
mainfrom
fix/selfhoster-branding-footer-repodoc-4613

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • gittensoryFooter (src/github/footer.ts) hardcoded GITTENSORY_SITE_URL (https://gittensory.aethereal.dev) in the "Checked by Gittensory" attribution line that's appended to every reviewed PR comment, even for self-hosted deployments with their own PUBLIC_SITE_ORIGIN configured. The sibling maintainerControlPanelUrl in the same file already resolved env.PUBLIC_SITE_ORIGIN ?? GITTENSORY_SITE_URL correctly — gittensoryFooter now does the same, so it takes an env param and threads it through.
  • renderRepoDocContent (src/review/repo-doc-render.ts) hardcoded the same URL in the generated AGENTS.md content committed to a self-hoster's own repo. It now takes a siteUrl string param resolved by its one caller (openRepoDocPullRequest in src/github/repo-doc-pr.ts) from the same env.PUBLIC_SITE_ORIGIN ?? GITTENSORY_SITE_URL fallback — preserving the function's pure/deterministic contract (same (profile, siteUrl) always renders the same output) that generated-doc-refresh.ts's byte-for-byte diff-aware refresh depends on.
  • Default behavior (no PUBLIC_SITE_ORIGIN configured) is unchanged — both still fall back to GITTENSORY_SITE_URL.

Every gittensoryFooter(/footerEarnUrl( call site was threaded, grepped exhaustively before and after:

  • src/signals/engine.tsbuildPublicPrIntelligenceComment (×1 call) and buildMinimalInviteComment (×1 call), both gained an env field on their args
  • src/github/commands.tsbuildPublicAgentCommandComment (×1 call), gained an env field on its args
  • src/review/planner.tsbuildIssuePlanComment (×1 call), gained an env field on its args
  • src/review/e2e-test-gen-render.tsbuildE2eTestGenCommentBody (×3 internal calls), gained an env field on E2eTestGenCommentInput
  • src/queue/processors.ts — 10 direct gittensoryFooter( call sites updated to pass env (already in scope — every enclosing function already takes env: Env), plus the 4 wrapper-function calls above (buildPublicPrIntelligenceComment via commentArgs, buildE2eTestGenCommentBody ×2, buildIssuePlanComment, buildPublicAgentCommandComment) updated to pass env through
  • src/signals/settings-preview.tsbuildSamplePreviewComment and buildRepoSettingsPreview (the settings-preview UI's sample-comment builder) threaded env down to buildPublicPrIntelligenceComment
  • src/api/routes.ts — the /v1/repos/:owner/:repo/settings-preview route passes c.env; buildCommandPreview (the maintainer command-preview UI) threaded env down to buildPublicAgentCommandComment

footerEarnUrl itself (in engine.ts) doesn't reference GITTENSORY_SITE_URL — it resolves a Gittensor-network earn-CTA URL (gittensorRepoEarnUrl/GITTENSOR_HOME_URL), a separate, shared network that's never rebranded per-deployment — so it needed no signature change, only env in scope in the same calling functions (which it now has).

Scope

Validation

  • git diff --check
  • npm run actionlint (no workflow files changed)
  • npm run typecheck
  • npm run test:coverage locally, scoped to every changed source file (footer.ts, repo-doc-render.ts, repo-doc-pr.ts, e2e-test-gen-render.ts, planner.ts, commands.ts, engine.ts, settings-preview.ts, processors.ts, routes.ts) plus their full owning unit/integration test files — 100% line+branch on every changed line; see Notes for detail
  • npm run test:workers (no Cloudflare-pool-specific code touched)
  • npm run build:mcp (no MCP package changes)
  • npm run test:mcp-pack (no MCP package changes)
  • npm run ui:openapi:check
  • npm run ui:lint (no UI changes)
  • npm run ui:typecheck (no UI changes)
  • npm run ui:build (no UI changes)
  • npm audit --audit-level=moderate (no dependency changes)
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

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. (N/A — no auth/CORS surface touched)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (no request/response shape changed; env is internal plumbing only)
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. (N/A — no UI changes)
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

Notes

  • Coverage detail: src/github/footer.ts, src/review/repo-doc-render.ts, src/github/repo-doc-pr.ts, src/review/e2e-test-gen-render.ts, and src/review/planner.ts are each at 100%/100% line+branch on their scoped test runs. src/github/commands.ts and src/signals/settings-preview.ts show 100% lines with no uncovered lines; their sub-100% branch % is entirely pre-existing/unrelated to this diff (verified line-by-line against git diff). src/signals/engine.ts and src/queue/processors.ts are large files with substantial pre-existing coverage gaps elsewhere; every line/branch this PR actually changed in both files was individually cross-checked against the coverage data and is fully hit. src/api/routes.ts's two touched call sites were verified covered via test/integration/api.test.ts.
  • Two new regression tests specifically exercise the env.PUBLIC_SITE_ORIGIN ?? GITTENSORY_SITE_URL branch pair in src/github/repo-doc-pr.ts: createTestEnv() defaults PUBLIC_SITE_ORIGIN to a truthy value, so a dedicated test explicitly delete env.PUBLIC_SITE_ORIGINs to exercise the true nullish/fallback side.

…ender

gittensoryFooter and renderRepoDocContent hardcoded gittensory.aethereal.dev
in every reviewed PR's public footer and every generated AGENTS.md, so a
self-hoster's own deployment still attributed both surfaces to JSONbored's
product instead of their own domain.

gittensoryFooter now takes an env param and resolves
env.PUBLIC_SITE_ORIGIN ?? GITTENSORY_SITE_URL, matching the sibling
maintainerControlPanelUrl in the same file; the env is threaded through
every call site across engine.ts, commands.ts, planner.ts,
e2e-test-gen-render.ts, processors.ts, settings-preview.ts, and routes.ts.

renderRepoDocContent now accepts a siteUrl parameter resolved by its one
caller (repo-doc-pr.ts) from the same env.PUBLIC_SITE_ORIGIN fallback,
preserving the function's pure/deterministic contract that
generated-doc-refresh.ts's byte-for-byte diff depends on.

Fixes #4613
@superagent-security

Copy link
Copy Markdown
Contributor

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

@JSONbored JSONbored self-assigned this Jul 10, 2026
@JSONbored
JSONbored merged commit 7e76b2e into main Jul 10, 2026
7 checks passed
@JSONbored
JSONbored deleted the fix/selfhoster-branding-footer-repodoc-4613 branch July 10, 2026 11:06
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.13%. Comparing base (5ae3c59) to head (13143ea).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4668   +/-   ##
=======================================
  Coverage   94.13%   94.13%           
=======================================
  Files         434      434           
  Lines       38554    38555    +1     
  Branches    14053    14055    +2     
=======================================
+ Hits        36291    36292    +1     
  Misses       1604     1604           
  Partials      659      659           
Files with missing lines Coverage Δ
src/api/routes.ts 94.26% <100.00%> (ø)
src/github/commands.ts 98.16% <ø> (ø)
src/github/footer.ts 100.00% <100.00%> (ø)
src/github/repo-doc-pr.ts 100.00% <100.00%> (ø)
src/queue/processors.ts 95.29% <100.00%> (ø)
src/review/e2e-test-gen-render.ts 100.00% <ø> (ø)
src/review/planner.ts 100.00% <ø> (ø)
src/review/repo-doc-render.ts 100.00% <ø> (ø)
src/signals/engine.ts 97.45% <100.00%> (ø)
src/signals/settings-preview.ts 98.54% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

JSONbored added a commit that referenced this pull request Jul 10, 2026
…and reference link (#4684)

The @gittensory help command's rendered command-reference section linked
to a hardcoded GITTENSORY_SITE_URL/docs/gittensory-commands -- the same
self-hoster branding gap PR #4668 (#4613) fixed for gittensoryFooter and
renderRepoDocContent, just left out of that PR's scope. A self-hoster with
PUBLIC_SITE_ORIGIN configured still got a link to
gittensory.aethereal.dev in their own @gittensory help output instead of
their own domain.

Threads env through commandSections -> helpSections (the only command that
renders this link), mirroring the gittensoryFooter(env, ...) pattern.
Extracted a small commandReferenceUrl(env) helper using new URL(path,
origin) -- the same idiom footer.ts's maintainerControlPanelUrl already
uses -- rather than naive string concatenation, since a PUBLIC_SITE_ORIGIN
with a trailing slash would otherwise produce a double slash.

Fixes #4670
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Self-hoster branding: gittensoryFooter + repo-doc-render honor PUBLIC_SITE_ORIGIN

1 participant