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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

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.

Notes

shipped production is serving it deploy 3fede26

opened this

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) plus tsc locally, and they passed. I did not run the full suite or design-lint after the final edits. The gate still flags two things I left alone:

  • Similarity warning: src/core/repo_source.ts#getRepoSource is 0.58 similar to ensureEdgeUser. That is a "one implementation?" note.
  • Both-doors rule: the push carried a "No door:" line saying the PUT route is only for the pack deploy. It adds no new terminal screen or docs/features/ page; the terminal row and the docs entry are edits to existing files.

What changed

  • Recording: bun scripts/pack.ts up and deploy record each app's source (an https address, or owner/name for 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, because repo_source already holds follow sources.
  • Repository page: one muted line, "From <source>", in the repo header (data-pack-source). An address links out with rel="noopener noreferrer". An owner/name source links to that repo on this forge. An app with no recorded source shows nothing.
  • Terminal: the About screen has a from row with the same words.
  • Validation: sourceText in src/packs/source_guard.ts is the one check. It accepts http(s) or owner/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.
  • Deploy steps: a failure to record shows as its own failed step and never hides that the app was made. A success adds no step, so the existing "kept / already here" expectations still hold.
  • Existing test changed: in test/packs-hands.test.ts I added the new PUT …/source call to the expected request list for the forge-fork deploy. The test was wrong to forbid it.
  • New test: test/packs-source-link.test.ts deploys 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 forge owner/name link.
  • Docs: docs/features/packs.md describes the feature, and I removed the "stable follow link" item from its "Not done yet" list.

Left out

  • Apps a pack made before this change, and forge-fork apps that deploy finds already there ("kept"), get no line. Running deploy again does not backfill them.
  • No GET for the source and no control to hide the line.
  • The line draws on every repo page that uses the shared header, so it is not tied to the About tab. I did not get to a review block or a look at a running preview.

To try

  1. Run bun scripts/pack.ts up games.
  2. Open any deployed app's page: the line "From <source>" appears under the title.
  3. In the SSH terminal, open that app's About screen to see the from row.

Closes #16068

8 earlier comments · 4 events
commented

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) plus tsc locally, and they passed. I did not run the full suite or design-lint after the final edits. The gate still flags two things I left alone:

  • Similarity warning: src/core/repo_source.ts#getRepoSource is 0.58 similar to ensureEdgeUser. That is a "one implementation?" note.
  • Both-doors rule: the push carried a "No door:" line saying the PUT route is only for the pack deploy. It adds no new terminal screen or docs/features/ page; the terminal row and the docs entry are edits to existing files.

What changed

  • Recording: bun scripts/pack.ts up and deploy record each app's source (an https address, or owner/name for 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, because repo_source already holds follow sources.
  • Repository page: one muted line, "From <source>", in the repo header (data-pack-source). An address links out with rel="noopener noreferrer". An owner/name source links to that repo on this forge. An app with no recorded source shows nothing.
  • Terminal: the About screen has a from row with the same words.
  • Validation: sourceText in src/packs/source_guard.ts is the one check. It accepts http(s) or owner/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.
  • Deploy steps: a failure to record shows as its own failed step and never hides that the app was made. A success adds no step, so the existing "kept / already here" expectations still hold.
  • Existing test changed: in test/packs-hands.test.ts I added the new PUT …/source call to the expected request list for the forge-fork deploy. The test was wrong to forbid it.
  • New test: test/packs-source-link.test.ts deploys 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 forge owner/name link.
  • Docs: docs/features/packs.md describes the feature, and I removed the "stable follow link" item from its "Not done yet" list.

Left out

  • Apps a pack made before this change, and forge-fork apps that deploy finds already there ("kept"), get no line. Running deploy again does not backfill them.
  • No GET for the source and no control to hide the line.
  • The line draws on every repo page that uses the shared header, so it is not tied to the About tab. I did not get to a review block or a look at a running preview.

To try

  1. Run bun scripts/pack.ts up games.
  2. Open any deployed app's page: the line "From <source>" appears under the title.
  3. In the SSH terminal, open that app's About screen to see the from row.
commented

<!-- 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
commented

The seven check failures came from two causes. I fixed both and pushed.

  • Missing API row: the new PUT /api/v1/repos/{owner}/{name}/source route had no OpenAPI description. I added src/contract/openapi/routes/putApiV1ReposOwnerNameSource.ts and regenerated routes/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_QUERIES in test/did-you-mean.test.ts goes from 36 to 37.
    • The /:owner/:name/next budget goes from 63 to 64 in src/perf/page_budgets/next.ts and test/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.

commented

<!-- 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
commented

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.ts passes 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.

commented

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.

Changes requested — before the latest push

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.

  1. No review block and no look at a pack app. A page change must end with a JSON review block of {go,look,expect,ask?} steps, and this one has none. Nothing in app.looks is 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. Run bun scripts/design-lint.ts and say so; it was skipped.
  2. Every repository page now pays an extra statement for a niche feature. The change raises FOUND_QUERIES and the /:owner/:name/next budget 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.
  3. The docs say more than the code does. docs/features/packs.md says an address 'opens in a new context', but the anchor has no target, only rel. 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.

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

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 a target, 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 carries rel="noopener noreferrer"". I didn't add target="_blank": a same-tab link is the lighter behaviour, and noreferrer already 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_QUERIES in test/did-you-mean.test.ts and in the /:owner/:name/next page 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.
Changes requested — before the latest push

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.

  1. Every repository page now pays an extra statement for a niche line. The header reads repo_made_from on every request, and the pull raises FOUND_QUERIES and the /:owner/:name/next budget 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.
  2. No review block, and the line is not shown on a phone. A page change ends with a JSON review block of {go,look,expect,ask?} steps. Add one that names the preview path of a pack app and the expected "From …" line. Run bun scripts/design-lint.ts and say so in the pull.
  3. Normalise what is stored. sourceText keeps the raw text after URL.parse succeeds. URL.parse strips tabs and newlines inside an address, so a source with an embedded newline passes the check and is kept raw. Store the parsed url.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.

commented

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 that core/repos.ts already reads (a LEFT JOIN on its primary key, kept as Repo.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 in did-you-mean and pages-budget pass at the old counts.
  • Validation: sourceText in src/packs/source_guard.ts is the one check, and it runs again before anything draws the source. It accepts http(s) or owner/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.parse silently 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.ts the forge-fork deploy now expects the new PUT …/source call. The test was wrong to forbid it.
  • New test: test/packs-source-link.test.ts covers 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 forge owner/name link. Markup is matched with regexes, not exact whitespace.

Not done

  • Apps a pack made before this change, and forge-fork apps deploy finds already there, get no line. Running deploy again 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.looks is a pack app.

Checks run

  • bun x tsc --noEmit is clean, and bun scripts/design-lint.ts passes ("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.ts said 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 --fix still notes three comments over 100 columns, in scripts/pack.ts, src/packs/deploy.ts and test/packs-hands.test.ts, for the nightly rewrap.

To try

  1. Run bun scripts/pack.ts up games.
  2. Open /owner/2048: under the title is "From https://github.com/gabrielecirulli/2048".
  3. In the SSH terminal, open that app's About screen to see the from row.

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

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

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_from table. The source is read through a LEFT JOIN on the row getRepo already fetches, so no page pays an extra query. madeFrom is now listed among the writer's repository fields next to severedAt; leaving it out is what broke test/repo-fields.test.ts in the last check.
  • API: a new route, PUT /api/v1/repos/:owner/:name/source with {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 422 bad_source. It is described in the contract and tagged under repos.
  • Deploy: scripts/pack.ts records 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.md describes the From line.

Checks

  • Passed here: the type check, the gate, test/repo-fields.test.ts, the packs-* suites (including the new test/packs-source-link.test.ts), the contract and OpenAPI drift and route-coverage suites, and test/gate-bypass.test.ts.
  • test/gate-bypass.test.ts failed 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.ts can't run here: it needs real cells, which are off in FORGE_TEST_SOCKET mode. 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

Approved

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.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs