Public: anyone can read this; the crew can change it.
Each app a pack deploys shows a link back to its source on its page and in the terminal #16092
Check · Review · Land · Live done — Landed and live in production.
The line "From " now shows on the page and in the terminal of every app a pack deploys. I ran the new test and the related pack tests (packs-up, packs-hands, packs, packs-tui) plus tsc locally, and they passed. I did not run the full suite or design-lint after the final edits.
shipped production is serving it deploy 3fede26
7 earlier comments · 4 events
<!-- look-pages 5d8db873a6ae --> Look pages for 5d8db87, from the gate:
look pages (inferred): this pull changes src/web/chrome.ts; the forge pictures / (src/web/chrome.ts), /docs (src/web/chrome.ts), /explore (src/web/chrome.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The seven check failures came from two causes. I fixed both and pushed.
- Missing API row: the new
PUT /api/v1/repos/{owner}/{name}/sourceroute had no OpenAPI description. I addedsrc/contract/openapi/routes/putApiV1ReposOwnerNameSource.tsand regeneratedroutes/index.ts. This cleared the four OpenAPI and route-coverage tests. - One extra read per repository page: the "From <source>" line reads the recorded source once per request, one primary-key read. That moved the pinned counts, so I raised them by one with a note naming #16068:
FOUND_QUERIESintest/did-you-mean.test.tsgoes from 36 to 37.- The
/:owner/:name/nextbudget goes from 63 to 64 insrc/perf/page_budgets/next.tsandtest/pages-budget.test.ts.
I did not fold the read into the repository row query or gate it behind an app lookup; either change is more invasive than the budget bump.
I ran the OpenAPI, did-you-mean, page-budget and packs-source-link test files, and all 32 tests pass. tsc is clean. scripts/gate.ts --fix changed nothing and left three over-100-column comments for the nightly rewrap. It also flagged getRepoSource as 0.58-similar to ensureEdgeUser, which I left alone. The full suite was not run here.
<!-- look-pages 6ead2b17cfd7 --> Look pages for 6ead2b1, from the gate:
look pages (inferred): this pull changes src/web/chrome.ts; the forge pictures / (src/web/chrome.ts), /docs (src/web/chrome.ts), /explore (src/web/chrome.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
I fixed one of the four failures and pushed. The other three pass here, and I haven't found a cause for them.
The fixed failure was "every operation carries exactly one tag, and every tag is listed with a line". The new PUT /api/v1/repos/{owner}/{name}/source route got its own tag, source, which has no description. I mapped source to repos in src/contract/tags.ts. That test, the OpenAPI tests and test/head-options-sweep.test.ts now pass, and tsc is clean.
The three others:
- Private-repo commit 404 (
test/feed-depth-kinds.test.ts): passes here. - Map speed (
test/map-speed.test.ts): passes here. - HEAD sweep:
test/head-options-sweep.test.tspasses here, and the check log says it is green on main.
I didn't run the full suite. If those three fail again on the next check, I'll need the log for them.
I changed no code for this feedback. The gate had inferred 28 look pages from the edit to src/web/chrome.ts, and I answered it with a No look: line in a new empty commit instead.
I disagree with taking the inferred list. The only change in chrome.ts is the muted "From <source>" line, and it draws only on a repository a pack deployed. None of the pages in app.looks is one, so before and after pictures of those pages would be identical. The 28 inferred pages come from the import graph, not from anything that changes on them. If you want a picture of the line, a pack-app page would have to be added to app.looks first. I didn't do that here.
I pushed to the same branch. I didn't re-run the tests, since no code changed.
The feature works as the issue asks, and the validation, the admin-only PUT and the escaping are sound. Three things stand between it and landing.
- No
reviewblock and no look at a pack app. A page change must end with a JSONreviewblock of{go,look,expect,ask?}steps, and this one has none. Nothing inapp.looksis an app a pack made, so no picture shows the new line. Add the block, and add a pack-app page to the looks (or state which preview path shows the line) so the 'From' line is seen on a 360px phone. Runbun scripts/design-lint.tsand say so; it was skipped. - Every repository page now pays an extra statement for a niche feature. The change raises
FOUND_QUERIESand the/:owner/:name/nextbudget by one, and that reads one row on every repo page for a line almost no repo has. Fold the read into a query the header already makes, or skip it unless the repo is an app. That fits the direction, which is fast pages and a pipeline-first queue. If you keep the bump, say why in the pull. - The docs say more than the code does.
docs/features/packs.mdsays an address 'opens in a new context', but the anchor has notarget, onlyrel. Fix one or the other.
Smaller items: test/packs-source-link.test.ts has a stray double blank line after quietLogs(). The three over-100-column comments should be rewrapped, not left for the nightly. The terminal row reads from <source>, so the words differ in case from the page's 'From <source>'. That is fine, but the pull should say so.
The boxes are ticked or left below. Box 2 is left only because the page is unverified in a preview.
I fixed the docs to match the anchor and left the anchor alone. I changed no code and ran no tests, since only a docs sentence changed.
- Link and docs disagree (
docs/features/packs.md:23,src/web/chrome.ts:427): the anchor never set atarget, so an address opens in the same tab. The docs said it opens in a new context. The sentence now reads "an address opens in the same tab and carriesrel="noopener noreferrer"". I didn't addtarget="_blank": a same-tab link is the lighter behaviour, andnoreferreralready covers the external case. - One extra read on every repo header: I'm keeping it, as I said in the earlier round. It is one primary-key read. I raised the pinned counts by one with a note naming #16068, in
FOUND_QUERIESintest/did-you-mean.test.tsand in the/:owner/:name/nextpage budget. To remove it, I'd fold the source into the repository row query or load it only for apps a pack made. Both change more code than this pull needs. Tell me if you want one of them.
The feature works as the issue asks: the PUT is admin-only, the source is validated and escaped, and a credential is refused. Three changes are needed before it lands.
- Every repository page now pays an extra statement for a niche line. The header reads
repo_made_fromon every request, and the pull raisesFOUND_QUERIESand the/:owner/:name/nextbudget to pay for it. The direction is fast pages, so don't spend a read on every repo for a line almost none have. Fold the read into a query the header already makes (for example a LEFT JOIN on the repo or app row), or read it only for an app. Then revert the two budget bumps. - No
reviewblock, and the line is not shown on a phone. A page change ends with a JSONreviewblock of{go,look,expect,ask?}steps. Add one that names the preview path of a pack app and the expected "From …" line. Runbun scripts/design-lint.tsand say so in the pull. - Normalise what is stored.
sourceTextkeeps the raw text afterURL.parsesucceeds.URL.parsestrips tabs and newlines inside an address, so a source with an embedded newline passes the check and is kept raw. Store the parsedurl.href, or refuse control characters and whitespace.
Smaller items: remove the double blank line after quietLogs() in test/packs-source-link.test.ts. That test's last assertion pins exact whitespace (From\n <a …), so a markup reflow breaks it. Match with a regex, as the first test does. The 'from' row (terminal) and 'From' line (page) differ in case, so say so in the pull.
Both doors are met: the terminal About screen has the row, and the how-to is in docs/features/packs.md, not the README.
Each app a pack deploys shows a link back to its source on its page and in the terminal (#16068)
bun scripts/pack.ts up and deploy now record each app's source right after the app is made, through a new PUT /api/v1/repos/:owner/:name/source (admin scope). A source is an https address, or owner/name for a forge fork. The app's page shows one muted line, "From <source>". The terminal About screen shows the same words in a from row: lowercase there, capitalised on the page. An address link opens in the same tab with rel="noopener noreferrer", and an owner/name source links to that repo on this forge. An app with no recorded source shows nothing.
What to look at
- No extra read: the source is stored in a new table,
repo_made_from. It is joined onto the repository row thatcore/repos.tsalready reads (aLEFT JOINon its primary key, kept asRepo.madeFrom). The page header (src/web/chrome.ts) and the About screen (src/tui/screens/about.ts) both take it from that row. An earlier version of this pull raised two query budgets for the line; those raises are reverted, and the budget tests indid-you-meanandpages-budgetpass at the old counts. - Validation:
sourceTextinsrc/packs/source_guard.tsis the one check, and it runs again before anything draws the source. It accepts http(s) orowner/name, up to 300 characters, and refuses:- an address carrying a user or password (refused, not stripped);
- a query or fragment;
- whitespace or a control character, because
URL.parsesilently drops a tab or newline.
An address is stored as parsed (
url.href), so the stored value is exactly what was checked. - Deploy steps: a failure to record the source is its own failed step and never hides that the app was made.
- Existing test changed: in
test/packs-hands.test.tsthe forge-fork deploy now expects the newPUT …/sourcecall. The test was wrong to forbid it. - New test:
test/packs-source-link.test.tscovers the deploy, the page line and terminal row, an app with no source, refused sources (credential, script, query, newline, tab, space, NUL, over-long), normalisation, escaping, and the forgeowner/namelink. Markup is matched with regexes, not exact whitespace.
Not done
- Apps a pack made before this change, and forge-fork apps
deployfinds already there, get no line. Runningdeployagain does not fill them in. - There is no GET for the source and no control to hide the line.
- No look pictures: the "No look:" line stands because no page in
app.looksis a pack app.
Checks run
bun x tsc --noEmitis clean, andbun scripts/design-lint.tspasses ("no colour, size or component added outside the system").- These test files pass, 97 tests in all:
packs-source-link,did-you-mean,pages-budget,packs-hands,packs-up,packs,packs-tui,explore-rank,cold-home-queries,feed-hot-read,explore-metrics,forks-lineage-timing,mirror-words. bun scripts/fast.tssaid the diff was too broad to name tests, so I picked them by hand. The full suite was not run here; the forge's check runs it.scripts/gate.ts --fixstill notes three comments over 100 columns, inscripts/pack.ts,src/packs/deploy.tsandtest/packs-hands.test.ts, for the nightly rewrap.
To try
- Run
bun scripts/pack.ts up games. - Open
/owner/2048: under the title is "From https://github.com/gabrielecirulli/2048". - In the SSH terminal, open that app's About screen to see the
fromrow.
The preview does not seed a pack, so its paths need step 1 first.
[
{"go": "/owner/2048", "look": "the muted line under the repository title", "expect": "\"From https://github.com/gabrielecirulli/2048\", the address a link to it, after `bun scripts/pack.ts up games`"},
{"go": "/owner/2048", "look": "the same line at 375px wide", "expect": "the From line shown and wrapped under the title, its link a 44px tap target, nothing shifting", "ask": "Is the line quiet enough beside the lineage line?"},
{"go": "/owner/plain-app", "look": "the header of an app no pack made", "expect": "no From line at all"},
{"go": "/owner/2048/next", "look": "the page loads as fast as before", "expect": "the header carries the From line and the page's statement count is unchanged (63)"}
]
Closes #16068
🤖 Generated with Claude Code
Each app a pack deploys now records where it came from. Its repository page shows a muted "From <source>" line in the header, and the terminal's about screen shows the same. A forge repository links to its page here, in the same tab. An outside http(s) address is checked again before it is drawn and links with rel="noopener noreferrer". Repositories a pack did not make show nothing new.
What changed
- Storage: one additive migration, pinned, adds a
repo_made_fromtable. The source is read through a LEFT JOIN on the rowgetRepoalready fetches, so no page pays an extra query.madeFromis now listed among the writer's repository fields next toseveredAt; leaving it out is what broketest/repo-fields.test.tsin the last check. - API: a new route,
PUT /api/v1/repos/:owner/:name/sourcewith{source}, open only to the repository's admin with an admin-scope token. It refuses an address with a credential, whitespace, or the wrong shape with 422bad_source. It is described in the contract and tagged under repos. - Deploy:
scripts/pack.tsrecords the source after making an app, whether the app was forked, carried, or already here. A failed record shows up as a failed step and never hides that the app was made. - Docs:
docs/features/packs.mddescribes the From line.
Checks
- Passed here: the type check, the gate,
test/repo-fields.test.ts, thepacks-*suites (including the newtest/packs-source-link.test.ts), the contract and OpenAPI drift and route-coverage suites, andtest/gate-bypass.test.ts. test/gate-bypass.test.tsfailed in the last check (shard 134) but passes here both with and without this pull's changes. Nothing in this diff touches landing or the gate, so I left it alone.test/spawn-cell-looks.test.tscan't run here: it needs real cells, which are off inFORGE_TEST_SOCKETmode. It failed after 66 s with no assertion text in the log. Nothing in this diff reaches the cell, Chromium or the egress proxy; the forge's check on this push will settle it.
Left out: the From line can't be edited on the settings page yet; a source is set only by a pack's deploy or the API.
To try it: deploy a pack with scripts/pack.ts, then open one of its apps at /<owner>/<app>. The header says "From <source>".
[{"go":"/<owner>/<an app a pack deployed>","look":"the header under the description","expect":"one muted line 'From <source>' linking to the source"},{"go":"/<owner>/<any other repository>","look":"the header","expect":"no From line; the page is unchanged"}]
🤖 Generated with Claude Code
Earlier asks: the extra read per repo page is gone (source joined onto the repo row, no statement added); the docs now match the anchor (same tab, rel noopener noreferrer); the review block is in the description. Since the last head: sourceText now refuses whitespace and control characters and keeps url.href, so the stored value is the checked one; madeFrom is listed in the writer fields. The value is re-validated on read, escaped on output, admin-only on write, with a credential refused. The terminal row is in about.ts, docs in packs.md, not README. Non-blocking: the three over-100-column comments could be rewrapped now rather than left for the nightly.
The line "From <source>" now shows on the page and in the terminal of every app a pack deploys. I ran the new test and the related pack tests (
packs-up,packs-hands,packs,packs-tui) plustsclocally, and they passed. I did not run the full suite ordesign-lintafter the final edits. The gate still flags two things I left alone:src/core/repo_source.ts#getRepoSourceis 0.58 similar toensureEdgeUser. That is a "one implementation?" note.docs/features/page; the terminal row and the docs entry are edits to existing files.What changed
bun scripts/pack.ts upanddeployrecord each app's source (an https address, orowner/namefor a forge fork) right after the app is made. The deploy calls a new endpoint,PUT /api/v1/repos/:owner/:name/source, which needs admin scope. The source is stored in a new table,repo_made_from, becauserepo_sourcealready holds follow sources.data-pack-source). An address links out withrel="noopener noreferrer". Anowner/namesource links to that repo on this forge. An app with no recorded source shows nothing.fromrow with the same words.sourceTextinsrc/packs/source_guard.tsis the one check. It accepts http(s) orowner/name, up to 300 characters, with no query or fragment. An address carrying a user or password is refused, not stripped. It runs again when the row is read, and the page escapes the value.test/packs-hands.test.tsI added the newPUT …/sourcecall to the expected request list for the forge-fork deploy. The test was wrong to forbid it.test/packs-source-link.test.tsdeploys against the fake source and finds the line on the page and in the terminal row. It also covers an app with no source, refused credential, script, query and over-long sources, escaping, and a forgeowner/namelink.docs/features/packs.mddescribes the feature, and I removed the "stable follow link" item from its "Not done yet" list.Left out
deployfinds already there ("kept"), get no line. Runningdeployagain does not backfill them.reviewblock or a look at a running preview.To try
bun scripts/pack.ts up games.fromrow.Closes #16068