Skip to content

feat(web): link the mainnet and testnet sites to each other - #685

Merged
PastaPastaPasta merged 5 commits into
masterfrom
launch/web-network-switch
Nov 24, 2026
Merged

PastaPastaPasta merged 5 commits into
masterfrom
launch/web-network-switch

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Problem

Forge launches on mainnet with two sites: the mainnet build at forge.dashhq.org and the testnet build at testnet-forge.dashhq.org. Each web build targets one network at build time, and neither site links to the other. Someone who lands on testnet has nothing telling them that mainnet is live, or where to find it.

Change

  • NEXT_PUBLIC_MAINNET_SITE_URL / NEXT_PUBLIC_TESTNET_SITE_URL, set from the Pages variables PAGES_MAINNET_SITE_URL / PAGES_TESTNET_SITE_URL, are optional. Only an https origin is accepted; any other value is ignored (forge-web/lib/network-sites.ts: siteUrlFor, otherNetworkSite).
  • /networks: each live network other than this build's gets an "Open Forge on " link when its site URL is set.
  • Testnet/devnet builds: a dismissible banner on every page reads "You're on Forge testnet: DASH here is test money. Forge is live on mainnet → forge.dashhq.org". It only renders once the bundled mainnet.json record is live and the mainnet URL is set. The dismissal is kept in localStorage, with try/catch. The banner also hides itself when served from the mainnet origin, so a testnet build still at forge.dashhq.org won't link to itself.
  • Mainnet build: the header badge stays hidden. A discreet "Testnet" footer link appears when the testnet URL is set and testnet is live.
  • Header badge: it already links to /networks on master, so it is unchanged.
  • Workflow and docs: pages.yml passes both variables and unsets them when empty. Both are documented in the workflow header and in docs/hosting.md, and listed in the verify-the-app rebuild env. Added a CHANGELOG entry.

Network selection and storage are unchanged. mainnet.json has no v2 record today, so nothing new shows on the current testnet build until mainnet registration lands.

Rollout

Set PAGES_MAINNET_SITE_URL=https://forge.dashhq.org and PAGES_TESTNET_SITE_URL=https://testnet-forge.dashhq.org only once each origin serves its own network's build.

Verified

Done in a boat.dev sandbox:

Local checks: tsc --noEmit, next lint (no new warnings) and copy-lint are clean.

🤖 Generated with Claude Code

PastaPastaPasta and others added 2 commits November 24, 2026 06:45
Each web build targets one network, and the mainnet and testnet builds
are separate sites, so nothing pointed from one to the other.
NEXT_PUBLIC_MAINNET_SITE_URL / NEXT_PUBLIC_TESTNET_SITE_URL (https
origins, from the PAGES_MAINNET_SITE_URL / PAGES_TESTNET_SITE_URL
repository variables) add an "Open Forge on <Network>" link on
/networks for a live network, a dismissible "Forge is live on mainnet"
banner on test-network builds once the bundled mainnet record is live,
and a footer "Testnet" link on the mainnet build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The banner hides itself on the mainnet site's own origin, the testnet
link needs the testnet record live like the mainnet one, and the
hosting doc says to set the variables only once each origin serves its
network's build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 380dbe9b-94d3-4d24-8a17-d592f9f9311e
Commits

Reviewing files that changed from the base of the PR and between bda9369 and 5493652.

Files selected for processing: 11

  • .github/workflows/pages.yml
  • CHANGELOG.md
  • docs/guides/verify-the-app.md
  • docs/hosting.md
  • forge-web/app/networks/page.tsx
  • forge-web/components/app-footer.tsx
  • forge-web/components/app-shell.tsx
  • forge-web/components/mainnet-live-banner.test.tsx
  • forge-web/components/mainnet-live-banner.tsx
  • forge-web/lib/network-sites.test.ts
  • forge-web/lib/network-sites.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Verdict: changes requested

The web change is sound. I'd approve it as is once the branch only carries it and CI has run on it. Right now the PR can't merge (GitHub reports CONFLICTING) and no CI job has run on it: the only check is CodeRabbit, and it was rate limited.

Blocking

1. Medium: the branch carries two commits from #676, which causes the conflict and stops CI. .github/workflows/contracts.yml:248, forge-contracts/scripts/launch-network.{mjs,test.mjs}, docs/deploying-to-a-network.md

  • 15c6a7b2 and d735746f are #676's first two commits. #676's later fix cf515d46 (the dry run fails on a warning and checks the signed sums) is not on this branch.
  • git merge-tree origin/master pr685 conflicts in contracts.yml. Because of that conflict, vitest, tsc, copy-lint and the CSP-hash check have not run on this PR in CI.
  • Whoever resolves that conflict could also land the pre-fix launch-network.mjs under a web PR's title.
  • Fix: rebase onto master and drop those two commits, so #676 lands them on its own. Then let CI go green. pages.yml already auto-merges cleanly with #677's guard changes, and the unset loop keeps both new variables.

Non-blocking

2. Nit (copy / style guide §C rule 3, a11y): forge-web/components/mainnet-live-banner.tsx:64

  • The copy is "You’re on Forge testnet: DASH here is test money. Forge is live on mainnet → forge.dashhq.org".
  • The colon doesn't introduce a value or a list, which rule 3 requires.
  • The header already says "test DASH, no cash value", so "test money" adds a second term for the same fact.
  • Screen readers read "→" aloud as "right arrow".
  • Suggested copy: You’re on Forge testnet, where DASH has no cash value. Forge is live on mainnet at <a>forge.dashhq.org</a>. Update the test string and the PR/CHANGELOG wording to match. copy-lint passes either version, because none of these is a banned term.

3. Nit (style guide rule 5, one banner): forge-web/components/app-shell.tsx:63

  • On a devnet build, MainnetLiveBanner can stack under DevnetNoticeBanner or PagesNoticeBanner.
  • Consider rendering it only when neither of those strips shows. It's rare enough to leave as is.

4. Nit: forge-web/app/networks/page.tsx:25

  • The banner hides itself on the mainnet origin, but SiteLink and the footer link have no such check.
  • So a test build still served at forge.dashhq.org, with PAGES_MAINNET_SITE_URL set, links to itself from /networks.
  • docs/hosting.md already says to set the variables only after the hosts move, so that's enough. Just keep that order today.

5. Nit (tests): forge-web/components/mainnet-live-banner.test.tsx

  • No test covers the path where storage refuses the dismissal (setItem throws → memoryDismissed).
  • One test with a localStorage.setItem spy that throws would cover it.

Checked, no issues

  • URL validation (lib/network-sites.ts siteOrigin):
    • Only https: is accepted.
    • A path, query, hash or userinfo is rejected.
    • javascript:, http: and a bare host are rejected.
    • A trailing slash and surrounding whitespace are normalised.
    • The default port drops out through URL.origin.
    • The tests cover each case.
  • Visibility rules:
    • otherNetworkSite returns null unless forgeV2Ids(DEPLOYMENTS[key]) is non-null. forgeV2Ids needs core, collab, community and the group all registered, and a recorded forge-meta must also be registered.
    • Today's mainnet.json has only dapiAddresses, so nothing shows until a v2 record is committed and the testnet site is rebuilt.
    • A mainnet build never renders the banner.
    • The banner hides on window.location.origin === site.url.
    • The Networks page's standing === 'live' uses the same forgeV2Ids, so the page and the banner agree.
    • network-sites.test.ts covers partial records, a missing file and a missing URL, plus devnet → mainnet.
  • Hydration:
    • The banner uses the same useSyncExternalStore pattern as DevnetNoticeBanner. The server snapshot is "hidden", so the static HTML is empty and the banner appears only after mount. There is no mismatch, and nobody who dismissed it sees a flash.
    • The renderToString(...) === '' test pins this.
    • Storage reads and writes are in try/catch, with a fallback for the current page only.
  • CSP: no inline <script> or style= is added. Only Tailwind classes are used, and coarse: exists in tailwind.config.js. Plain same-tab <a href> links to an https origin need no CSP change, and csp-hashes.mjs is unaffected.
  • Accessibility:
    • role="status" matches the devnet banner, so it doesn't interrupt on every navigation.
    • The icons have aria-hidden.
    • The dismiss button has an aria-label.
    • The link gets a 44px tap target on coarse pointers.
  • pages.yml:
    • Both variables are passed in, and both are in the empty → unset loop, so Next never inlines "".
    • The workflow header and docs/guides/verify-the-app.md list the new rebuild inputs.

🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Verdict: approve

The earlier blocker is resolved. The branch now carries only the web change, and it merges cleanly with master.

What I checked

  1. The diff holds only this PR. git diff origin/master...origin/launch/web-network-switch touches 11 files: pages.yml, CHANGELOG.md, docs/hosting.md, docs/guides/verify-the-app.md, app/networks/page.tsx, app-footer.tsx, app-shell.tsx, lib/network-sites{,.test}.ts and mainnet-live-banner{,.test}.tsx. It has no launch-network.mjs, contracts.yml or deploying-to-a-network.md edits. origin/master.. has 5 commits: 178c36a, 97ffc09, 0589fdf, the merge and the new test. #676's 15c6a7b and d735746 are gone.

  2. The merge is clean. git show --remerge-diff cc21cc53 is empty, so the merge has no hand edits. git merge-tree against the current master is also clean, and GitHub reports MERGEABLE. pages.yml keeps all of #677's changes: the header note on confirm_network, the confirm_network dispatch input, and the Network guard step (pages-network-guard.mjs with PAGES_CONFIRM: ${{ inputs.confirm_network }}). It also keeps this PR's NEXT_PUBLIC_MAINNET_SITE_URL and NEXT_PUBLIC_TESTNET_SITE_URL, and both are still in the empty → unset loop.

  3. The new test is sound. It spies on Storage.prototype.setItem with a mock that throws, clicks dismiss, and asserts both that the banner is gone and that getItem returns null. The test can't pass by accident: if the spy didn't intercept the write, getItem would return '1', and if the memoryDismissed fallback were missing, the listeners would re-render the banner. mockRestore sits in finally. The test is placed last, with a comment explaining why: memoryDismissed is module state and would hide the banner in later tests. The vitest config sets no shuffle or concurrency, so file order holds. npx vitest run components/mainnet-live-banner.test.tsx passes 6 of 6 tests. This also closes the earlier nit 5.

  4. Nothing regressed from the earlier "checked, no issues" list:

    • siteOrigin still accepts only https and rejects a path, query, hash, userinfo or a bare host.
    • Visibility still depends on forgeV2Ids.
    • The banner still uses the useSyncExternalStore pattern with a "hidden" server snapshot, which the renderToString === '' test pins.
    • The banner still hides on the mainnet origin.
    • role="status", aria-hidden icons, the dismiss aria-label and the coarse:min-h-11 link are all still there.
    • There is still no inline script or style.

    Nit 2 was also addressed (0589fdf). The copy now reads "You’re on Forge testnet, where DASH has no cash value. Forge is live on mainnet at ", with no colon and no arrow, and the test matches it.

Nits deliberately left (acceptable)

  • 3. Banner stacking. The banner can stack only on a devnet build whose deploy sets PAGES_MAINNET_SITE_URL while mainnet is live and a devnet or operator notice shows. That is rare and harmless. Fine to leave.
  • 4. Self-link before the hosts move. docs/hosting.md now says to set the variables only after each origin serves its own network. It also notes that the banner hides itself on that origin. That's an adequate guard for an operator-controlled variable. Fine to leave.

Note

CI was still queued when I checked (web, changes (contracts) and the others). It needs to go green before merge, but I don't expect it to fail.


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

@PastaPastaPasta
PastaPastaPasta merged commit 2226810 into master Nov 24, 2026
20 checks passed
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.

1 participant