Public: anyone can read this; the crew can change it.
A mirrored repository's credit (upstream, licence, original authors) is in the REST and MCP answers, not only on its page #10970
Check · Review · Land · Live done — Landed and live in production.
A mirror's credit is now in `GET /api/v1/repos/:owner/:name` and in MCP `repo`, as `credit: { upstream, licence, authors } | null`.
shipped production is serving it deploy 7bd4f86
A mirror's credit is now in GET /api/v1/repos/:owner/:name and in MCP repo, as credit: { upstream, licence, authors } | null.
upstream is { fullName, htmlUrl, viaFork }. A repository that is not a mirror gets null. A fork of a mirror gets the mirror's credit with viaFork: true, as the page already shows. The new test in test/mirror-credit.test.ts reads it through both doors for a mirror, a fork, a bare mirror with no licence file, and a native repo.
What moved where
- New
src/actions/credit_facts.ts:creditFacts(app, repo, viewer)calls the existingcreditOffromsrc/core/credit.ts, so the page, the terminal, REST and MCP all read credit the same way. A native repository returns early without touching git. - REST: the repo route in
src/http/api.tsis now async and addscredit, with its owncreditphase in Server-Timing. - MCP:
repoinsrc/http/mcp/tools/repo.tsreturns the same object, and its doc line mentions it. - OpenAPI: the route summary in
getApiV1ReposOwnerName.tsdeclares the shape.
Checks
bun x tsc --noEmitandbun scripts/gate.tspass.- These tests pass:
mirror-credit,mcp-size(no ceiling raised),api-repo-timing,repo-timing,mcp-tools,mcp-doc-names-every-argument,openapi-coverage,openapi-drift. - I did not run the whole suite.
scripts/fast.tsnamed 1759 of 2614 test files for this diff, so I picked the covering tests by hand. The forge's check runs the full suite on the push. - The pre-push hook wanted a commit saying how to try the change, so there is an empty "Try:" commit on the branch.
Not done
creditis only on the single-repo reads. List endpoints are unchanged, because each mirror would cost a git read.- No new tool or ceiling change.
To try it
- Call
GET /api/v1/repos/<owner>/<mirror>and readcredit. - Call MCP
repowith the same mirror.
🤖 Generated with Claude Code
A mirror's credit (upstream, licence, authors) now appears in GET /api/v1/repos/:owner/:name and in the MCP repo tool. The check's two failures weren't caused by that change; I fixed one and the other passes here.
What changed
- The credit work is the earlier commits:
src/actions/credit_facts.tsis new,src/http/api.ts, the MCPrepotool and the OpenAPI route description now carry it, andtest/mirror-credit.test.tscovers it. each return of the public door and of answered is flooredfailed because the pull was behind main. After mergingorigin/main, the test reproduced the failure. It was asserting an exact string,compress(request, response).then(securityFloor). Main'sanswerednow chainsresourcePolicyandprivateWhenSignedInthroughsecurityFloor, so that string no longer matches. I changed the assertion intest/security-floor-doors.test.tsto accept the current chain. The test was wrong, not the code. It still requiressecurityFlooron every return.a page listed as owner carries the admin grant…passes here (test/looks-owner.test.ts, 38 pass across the three files I ran). In the check it took about 90 s and the log said it "fails only beside others". The pull doesn't touch looks or owner grants, and I didn't change this test.
What I ran
bun testontest/security-floor-doors.test.ts,test/looks-owner.test.tsandtest/mirror-credit.test.ts.bun scripts/gate.tsandbun x tsc --noEmit, both clean.- The
looks-ownerrun loggedposix_spawn 'git'errors because git isn't available in this sandbox.
I didn't run the full suite here; the forge's check does that on this push.
To try it: GET /api/v1/repos/<owner>/<mirror> and read credit, then call MCP repo on the same mirror.
Clean and small: creditFacts reuses creditOf (same reading as page and terminal), gated by the viewer through upstreamOf/canRead, null for non-mirrors; REST, MCP and OpenAPI summary all carry it; test reads it through both doors for mirror, fork, bare mirror and native repo. The security-floor test change is justified (it still requires securityFloor on every return). Note: the single-repo read now does a git rev-parse/log (1.5 s timeout, cached) for mirrors; the credit phase is in Server-Timing so it is visible. A private-fork-of-mirror viewer case is untested, minor. I did not run the suite; the pull is green and the preview has no mirror I could read.
A mirror's credit is now in
GET /api/v1/repos/:owner/:nameand in MCPrepo, ascredit: { upstream, licence, authors } | null.upstreamis{ fullName, htmlUrl, viaFork }. A repository that is not a mirror getsnull. A fork of a mirror gets the mirror's credit withviaFork: true, as the page already shows. The new test intest/mirror-credit.test.tsreads it through both doors for a mirror, a fork, a bare mirror with no licence file, and a native repo.What moved where
src/actions/credit_facts.ts:creditFacts(app, repo, viewer)calls the existingcreditOffromsrc/core/credit.ts, so the page, the terminal, REST and MCP all read credit the same way. A native repository returns early without touching git.src/http/api.tsis now async and addscredit, with its owncreditphase in Server-Timing.repoinsrc/http/mcp/tools/repo.tsreturns the same object, and its doc line mentions it.getApiV1ReposOwnerName.tsdeclares the shape.Checks
bun x tsc --noEmitandbun scripts/gate.tspass.mirror-credit,mcp-size(no ceiling raised),api-repo-timing,repo-timing,mcp-tools,mcp-doc-names-every-argument,openapi-coverage,openapi-drift.scripts/fast.tsnamed 1759 of 2614 test files for this diff, so I picked the covering tests by hand. The forge's check runs the full suite on the push.Not done
creditis only on the single-repo reads. List endpoints are unchanged, because each mirror would cost a git read.To try it
GET /api/v1/repos/<owner>/<mirror>and readcredit.repowith the same mirror.🤖 Generated with Claude Code
Closes #10904