Skip to content

feat: mirror claims read "says it mirrors" until the source lists the repo - #371

Merged
PastaPastaPasta merged 7 commits into
masterfrom
feat/e4-mirror-claims
Oct 5, 2026
Merged

PastaPastaPasta merged 7 commits into
masterfrom
feat/e4-mirror-claims

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

What

Part 2 of epic E4 "Who is this" (TS-01, CJ-3): mirror claims can no longer pass as fact.

  • "Says it mirrors". A repo description's Mirror of github.com/o/r now reads "Says it mirrors github.com/o/r" in the rail and on the "Repo not found" page. It is never bold and never ranks a repo higher. The not-found suggestions are ordered by proved star count, then age.
  • Back-link file (new client convention, forge-v2.md §6.4). A source vouches for its mirrors with .dash-forge.json at the root of its default branch: {"mirrors":["<repo id>"]}. The reader rule is shared by forge_core::rules::mirror and lib/rules/mirror-backlink.ts: at most 4,096 bytes and 64 levels of nesting, an object with a mirrors list, exact id match, unknown keys ignored. Both sides are pinned by 21 mirror_backlink* vectors.
  • Optional check with GitHub. The rail has a Check with GitHub button. It reads the file from raw.githubusercontent.com (CORS-open) and compares GitHub's default branch (commits/HEAD) with the mirror's proved default-branch tip. When the source lists the repo, the rail reads "Mirror of …" with green results. Until the viewer asks, nothing is fetched and nothing is green, and a failure reads "couldn't check", never a match. The not-found page has Check mirror claims with GitHub. A repo listed by the very source the address names (github.com/<owner>/<name>) then comes first. A look-alike source listing its own repo does not.
  • Proving a mirror. A maintainer of an unlisted mirror gets a link to GitHub's new-file page with the file prefilled, or to the existing file when it already lists other mirrors. forge-import prints the file after it creates a GitHub mirror.

Why

Anyone can create a repo named dips described as a mirror of github.com/dashpay/dips for about 0.0016 DASH. The not-found page for dashpay/dips, the URL a GitHub user would guess, ranked that claim first in bold. That was the cheapest impersonation path in the trust review. Only someone who can push to the source can add the back-link file, so a listed mirror is one the source's maintainers vouch for.

How tested

  • Vectors run in both Rust and TS: cargo test -p forge-core conformance_vectors and lib/rules/conformance.test.ts.
  • New unit tests:
    • mirror-check.test.ts: listed, not listed, no file, broken file, branch differs, empty repo, network failure, rate limit, body read failure, session cache, look-alike paths.
    • repo-not-found.test.ts: a claim never ranks higher, and a look-alike source can't rank first.
    • mirror-claim.test.tsx: nothing fetched or green before the check, "Mirror of" once listed, a stale answer dropped after navigation, maintainer links.
    • forge-import backlink_hint.
  • Gates: tsc, eslint, cargo fmt, and clippy -D warnings (forge-core, forge-import) are clean.
  • Live check on a static export built for sakura, with real GitHub requests. The dips mirror shows "Says it mirrors github.com/dashpay/dips". After the check it shows "github.com/dashpay/dips lists no Forge mirrors" and "master matches GitHub's default branch at a4d46dd". /repo/?owner=dashpay&name=dips shows "says it mirrors … (not listed there)" after its check.

Screenshots in /Users/pasta/workspace/dash-forge-qa/evidence/p0/e4/:

  • before-mirror-rail.png, after-mirror-rail-unchecked.png, after-mirror-rail-checked.png
  • before-404-suggestions.png, after-404-suggestions.png, after-404-suggestions-checked-dark-390.png

Limits

  • Only GitHub sources are checked. GitLab claims stay "says it mirrors".
  • The file proves that someone who can push to the source named the repo. Freshness is covered only by the default-branch comparison.
  • Owner action: to make the showcase mirrors read "Mirror of", add .dash-forge.json listing their repo ids to dashpay/dips and dashpay/dash. That needs push access to those repositories.
  • Mirror consensus (CJ-12) is not in this PR.

🤖 Generated with Claude Code

PastaPastaPasta and others added 3 commits October 4, 2026 12:30
… repo

A repo description saying it mirrors github.com/o/r is its owner's own word, and anyone can write it for the price of a repo, yet the not-found page ranked such repos first and bolded the claim. Claims now read "says it mirrors" and never rank a repo higher (stars, then age). A source vouches for a mirror with .dash-forge.json listing its repo id (forge-v2.md §6.4; rules::mirror and lib/rules/mirror-backlink.ts, pinned by mirror_backlink vectors). The rail and the not-found page check it with GitHub from the viewer's browser only when asked, and the rail also compares the source's default branch with the mirror's proved tip; nothing is green until checked. Maintainers of an unlisted mirror get a prefilled GitHub new-file link, and forge-import prints the file after creating a GitHub mirror.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Only the GitHub repo the missing address names can rank a mirror first (a look-alike source can list its own repo). A check that lands after the viewer moved on is dropped, a body that fails to read is a failed check and is never cached, and failed checks can be retried. The head check compares the source's default branch (commits/HEAD), a maintainer whose source already lists other mirrors is sent to edit that file, and both readers refuse JSON nested deeper than 64 so Rust and TS agree (vectors).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… under clippy's line limit

Also says in §6.4 that the head check compares the source's default branch (commits/HEAD).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 4, 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 38 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
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cd8dc173-fd15-4f2d-a612-94c00f6eaf33
📥 Commits

Reviewing files that changed from the base of the PR and between 40b9bc1 and b1181b7.

📒 Files selected for processing (37)
  • crates/forge-core/src/rules.rs
  • crates/forge-core/src/rules/mirror.rs
  • crates/forge-import/src/summary.rs
  • docs/contracts/forge-v2.md
  • docs/guides/mirror-a-github-repo.md
  • forge-contracts/vectors/mirror_backlink__at_size_limit.json
  • forge-contracts/vectors/mirror_backlink__brackets_in_strings.json
  • forge-contracts/vectors/mirror_backlink__canonical_file.json
  • forge-contracts/vectors/mirror_backlink__case_sensitive.json
  • forge-contracts/vectors/mirror_backlink__depth_at_limit.json
  • forge-contracts/vectors/mirror_backlink__depth_over_limit.json
  • forge-contracts/vectors/mirror_backlink__empty_file.json
  • forge-contracts/vectors/mirror_backlink__empty_list.json
  • forge-contracts/vectors/mirror_backlink__extra_keys_ignored.json
  • forge-contracts/vectors/mirror_backlink__lists_the_repo.json
  • forge-contracts/vectors/mirror_backlink__mirrors_not_a_list.json
  • forge-contracts/vectors/mirror_backlink__no_mirrors_key.json
  • forge-contracts/vectors/mirror_backlink__non_string_entries_ignored.json
  • forge-contracts/vectors/mirror_backlink__not_json.json
  • forge-contracts/vectors/mirror_backlink__object_entry_not_a_match.json
  • forge-contracts/vectors/mirror_backlink__other_repo_only.json
  • forge-contracts/vectors/mirror_backlink__over_size_limit.json
  • forge-contracts/vectors/mirror_backlink__padded_entry.json
  • forge-contracts/vectors/mirror_backlink__size_in_bytes.json
  • forge-contracts/vectors/mirror_backlink__top_level_array.json
  • forge-contracts/vectors/mirror_backlink__whitespace_around_json.json
  • forge-contracts/vectors/mirror_backlink_file__file_one.json
  • forge-contracts/vectors/mirror_backlink_file__file_two.json
  • forge-web/components/repo/mirror-claim.test.tsx
  • forge-web/components/repo/mirror-claim.tsx
  • forge-web/components/repo/repo-not-found.test.ts
  • forge-web/components/repo/repo-not-found.tsx
  • forge-web/components/repo/repo-rail.tsx
  • forge-web/lib/rules/conformance.test.ts
  • forge-web/lib/rules/mirror-backlink.ts
  • forge-web/lib/view/mirror-check.test.ts
  • forge-web/lib/view/mirror-check.ts
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@PastaPastaPasta
PastaPastaPasta merged commit 366da81 into master Oct 5, 2026
32 checks passed
@PastaPastaPasta
PastaPastaPasta deleted the feat/e4-mirror-claims branch October 5, 2026 04:02
PastaPastaPasta added a commit that referenced this pull request Oct 5, 2026
repo-not-found keeps master's checked-claim ranking (#371) and this branch's auto-open of one clear mirror; short-url reserves both gh/github.com and icons.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PastaPastaPasta added a commit that referenced this pull request Oct 5, 2026
…rror"

Match the wording #371 uses for unchecked mirror claims.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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