Skip to content

feat: web origin and top-up link follow the network - #691

Merged
PastaPastaPasta merged 1 commit into
masterfrom
launch/network-web-origin
Nov 24, 2026
Merged

PastaPastaPasta merged 1 commit into
masterfrom
launch/network-web-origin

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

The Rust clients hard-code one web origin (https://forge.dashhq.org) and a bare top-up URL (https://bridge.thepasta.org, which opens on testnet). At launch, mainnet's web app is https://forge.dashhq.org and testnet's moves to https://testnet-forge.dashhq.org. That host is a sibling, not a child, so it can't claim mainnet's WebAuthn rpId. Without this change, testnet links, the storage CORS probe and the CORS document dg prints would all name the mainnet app, and a mainnet E401 would send users to the bridge's testnet mode.

Change

  • Network::web_origin(): testnet gives https://testnet-forge.dashhq.org. Mainnet and devnets give https://forge.dashhq.org, since a devnet has no web app of its own. Network::top_up_url(): https://bridge.thepasta.org/?network=mainnet|testnet; a devnet gets the bare URL.
  • Repo and commit links (web_url, repo_link, commit_web_url, the push done-line) take the network.
  • storage::cors drops PROBE_ORIGIN. dg storage test, the storage wizard and dg doctor probe from the web origin of the network in use, and the CORS document they print names that origin.
  • E401: ErrorContext gains an optional network, with a fallback that dg, git-remote-dash and forge-import set for the whole process once they resolve their network. This also covers error paths that classify with a default context. check_funds and check_affordable take the network instead of testnet: bool, and the testnet faucet hint names the testnet web app.
  • forge-relay: the default web_base_url is the target network's web origin. --web-base-url and the config-file key still win.
  • Live e2e scenarios 13 and 35 now expect the origin of the network they run on (a web_origin helper in e2e/cli/lib.sh).
  • Docs: the storage and CORS guides (a new "CORS origins: mainnet and testnet" section) and the E401 text in docs/errors.md.

Not in this PR

  • The managed IPFS node (dg ipfs up) still allows only https://forge.dashhq.org by default, and its pairing link opens there. The guide tells testnet users to run dg ipfs up --origin https://testnet-forge.dashhq.org.
  • The --web-base-url default row in the forge-relay README, and other docs that say forge.dashhq.org serves testnet (quick start, networks.md, the Action): left for the launch docs pass.
  • testnet-forge.dashhq.org must be live before a dg release that includes this change ships.

Tests
Run on a boat.dev sandbox with toolchain 1.98.0: cargo fmt --check and cargo clippy --all-targets -D warnings passed for forge-core, dg, git-remote-dash, forge-relay and forge-import. In cargo test --no-fail-fast for those crates, everything passed except three tests that depend on git's fsck behaviour: build_pack_fsck::history_no_clone_takes_is_refused_before_it_is_stored and two git::tests::*malformed_idents*. The sandbox has git 2.43, and this PR doesn't touch that code.

🤖 Generated with Claude Code

Mainnet's web app is https://forge.dashhq.org; testnet's moves to the
sibling host https://testnet-forge.dashhq.org. The clients hard-coded one
origin and a bare bridge URL, which opens on testnet.

- Network::web_origin() and Network::top_up_url() (bridge ?network=mainnet
  or ?network=testnet; devnets keep forge.dashhq.org and the bare bridge).
- Repo, commit and done-line links, the storage CORS probe and the CORS
  document dg prints use the web origin of the network in use.
- E401's fix opens the bridge on the command's network: ErrorContext
  carries it, with a process-wide fallback set once dg, git-remote-dash
  and forge-import resolve their network. The testnet faucet hint names
  the testnet web app.
- forge-relay links to its network's web app unless --web-base-url is set.
- Live e2e scenarios expect the origin of the network they run on.
- Storage/CORS guides and docs/errors.md say which origin to allow.

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 1 minute.

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: 833b6e1e-f48b-440e-aa2f-d2267ce4d600
Commits

Reviewing files that changed from the base of the PR and between 515059f and 8c437c6.

Files selected for processing: 26

  • crates/dg/src/ci.rs
  • crates/dg/src/doctor.rs
  • crates/dg/src/ipfs/mod.rs
  • crates/dg/src/main.rs
  • crates/dg/src/publish.rs
  • crates/dg/src/storage.rs
  • crates/dg/src/storage_wizard.rs
  • crates/forge-core/src/ci.rs
  • crates/forge-core/src/network.rs
  • crates/forge-core/src/storage/cors.rs
  • crates/forge-core/src/user_error.rs
  • crates/forge-import/src/main.rs
  • crates/forge-relay/src/config.rs
  • crates/forge-relay/src/main.rs
  • crates/forge-relay/src/payload.rs
  • crates/git-remote-dash/src/helper.rs
  • crates/git-remote-dash/src/main.rs
  • crates/git-remote-dash/src/policy.rs
  • crates/git-remote-dash/src/progress.rs
  • docs/errors.md
  • docs/guides/bring-your-own-storage.md
  • docs/guides/home-nas-storage.md
  • docs/guides/run-your-own-ipfs-node.md
  • e2e/cli/lib.sh
  • e2e/cli/scenarios/13-init-push.sh
  • e2e/cli/scenarios/35-ci-runner-report.sh
  • 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: approve

I read the full diff against master at 8c437c6 and traced every caller. Nothing blocks the merge.

Threading. No call site still uses the old constants. In Rust code outside tests, forge.dashhq.org now appears only in MAINNET_WEB_ORIGIN and in dg ipfs's DEFAULT_ORIGIN, which the PR body lists as out of scope. bridge.thepasta.org now appears only in TOP_UP_BRIDGE.

  • Every caller of repo_link, web_url, web_page_url, short_repo_base and commit_web_url (dg ci report/status, dg init/repo create, the helper's done-line) gets its network from ctx.network() or Helper::network().
  • dg resolves its network once, in Ctx::resolve (flags, then the repo's git config, then the environment, then the key). Nothing resolves it later.
  • Network::kind() returns mainnet or testnet. The bridge reads ?network= in mainnet-bridge src/main.ts stateFromUrl() (default testnet), so the deep link is a real bridge feature. A devnet still gets the bare bridge URL, as before.

Process-wide fallback. It is a OnceLock: the first set_network wins, later calls are ignored, and there is no data race. Each binary calls it once, right after it resolves its network: dg main.rs:2827, git-remote-dash main.rs:204, and forge-import main.rs:242 (only the import path writes). An explicit ErrorContext::network takes precedence (ctx.network.or_else(|| PROCESS_NETWORK.get())). No test calls set_network, so top_up(None) is not polluted today.

forge-relay. The precedence is still --web-base-url, then the config file, then target.network.web_origin(). target is resolved before that line, and the new asserts cover the explicit value, testnet and mainnet.

CORS check. The probe origin can't be empty in practice: web_origin() always returns a non-empty &'static str. The !origin.is_empty() guard only blocks the case where an empty origin would equal a missing header. Behaviour is otherwise unchanged.

e2e. config.sh allows only DASH_FORGE_NETWORK = devnet or testnet. web_origin() in e2e/cli/lib.sh covers both. The dot escaping in scenario 13's grep -E is correct. The json-fixtures check shapes, not values, so the old URLs there don't matter.

Merging before the testnet site is live. This is safe, since no release ships until v0.3.0 and the flip is today. Only source builds, the Action with install: 'source', and the nightly are affected:

  • Their testnet links would point at a host that doesn't resolve yet.
  • dg storage test and dg doctor would probe with the testnet origin. A bucket whose read rule is * passes either way, and the e2e/infra bucket uses *. Only a read rule restricted to https://forge.dashhq.org would fail by mistake.
  • The CORS document printed on testnet names testnet-forge in its write rule. Applied before the flip, it would stop browser pushes from today's testnet site.
  • The nightly only compares strings. verify-app still targets forge.dashhq.org.

CI and the 3 git-version tests. On master, rust build + test (run 45329408553, git 2.56.1) runs and passes all three: history_no_clone_takes_is_refused_before_it_is_stored, git::tests::real_histories_with_malformed_idents_index and git::tests::many_malformed_idents_index_without_hanging. This PR doesn't touch that code, so the sandbox failures come from its git 2.43. This PR's own rust build + test was still pending when I posted this; it needs to go green before merge. no-devnet-copy.sh passes locally on the PR head.

Findings (all nits, none blocking)

  1. nit, crates/forge-core/src/user_error.rs:686: no production code ever sets ErrorContext::network to Some. Every E401 goes through the process fallback, so the field only serves tests. Either keep it as the documented override, or drop it and test insufficient through a small helper that takes the fallback as an argument.
  2. nit, crates/forge-core/src/user_error.rs:3677: top_up(None) expects the bare bridge, which holds only while no test in the forge-core lib binary calls set_network. A future test that does would make it order-dependent. A one-line comment next to PROCESS_NETWORK would prevent that.
  3. nit, docs/guides/bring-your-own-storage.md (new "CORS origins" section): "check from the origin of the network they run on (--network)". The network can also come from the repo's dash.network, the environment or the key. Suggest "the network dg resolves (--network, the repo's dash.network, …)".
  4. nit, crates/dg/src/ipfs/mod.rs:278-283: verify now takes the origin, but the managed-node profile has public_gateway: None, so check_public_read/probe_cors never runs there. The argument has no effect on that path. Harmless, and correct if the profile ever gains a public gateway.
  5. Follow-up, outside this PR's Rust scope but visible at the flip: action/summary.sh:81 hard-codes "Renew at forge.dashhq.org/…", and the Action's default network is testnet. After the flip, testnet mirror users get a renew link to the mainnet app. action/README.md and action.yml also still say forge.dashhq.org serves testnet. This belongs in the launch docs pass, together with the forge-relay README default row and dg ipfs's DEFAULT_ORIGIN, which the PR body already lists.

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

@PastaPastaPasta
PastaPastaPasta merged commit 9ce446c into master Nov 24, 2026
25 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