~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

A repository's page shows its website, and what it was deployed from

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:web/repo-site

What changes

On the page. A repository with a site shows it first in the row under its description, before its links. That row shows the site's address with the globe icon, then quieter text saying what it was deployed from and when: from 19fa13f, 2 hours ago. The commit links to its page. With no commit, the text says deployed 2 hours ago. A private repository's site shows as "Private site", since its host is long, with the full address on hover. If the site's address is also among the repository's links, it isn't shown a second time.

In the answer. getRepo's repoViewDetailed has a new optional site (dev.knotless.defs#siteView), with these fields:

  • url: under the owner's label of the pages domain, or the private host.
  • commit: as the deployer gave it, unchecked.
  • check: not drawn on the page yet, and given only when its account is a runner the repository's record names, as the dev.knotless.site lexicon says a reader should trust it.
  • deployedAt

serve reads it from the index, through site(), or for a private repository space_site() on the index of its space, and only once a Sites serves a pages domain. That is the first time the app knows the domain: Sites::new sets App::pages_domain.

Docs: reference/api.md (getRepo's row) and guide/sites.md (See what is live).

Why

The site record already says which commit and check a site came from, but nothing showed it, nor where the site was. So owners added the address to their links by hand, where it went stale once the site moved or was taken down.

How it was checked

  • sites_are_served_on_their_domain (tests/sites.rs):
    • getRepo names the deployed site's address, with no commit or check, and names none for a repository without one.
    • Redeployed with --commit and --check: the commit is shown, and the check only once the repository's record names its runner.
    • Gone once taken down.
  • private_sites_are_read_by_members (tests/pages.rs): a member's getRepo names the private host.
  • Here: clippy on serve and its tests, just lex, layers and svelte-check pass. Tests are left to CI.
  • just look of the header, public with a commit (desktop light, phone dark) and private with no commit, attached. The shots world has no sites, so the shots check draws nothing new, and no page should move.

Shots-moved: none Changeset: none

🤖 Generated with Claude Code

site-public-desktop-light.png

site-public-phone-dark.png

site-private-desktop-light.png

site-private-phone-dark.png

Approved

This adds an optional site (siteView) to getRepo's repoViewDetailed. serve reads it from the index and only sets it once a Sites serves a pages domain. The repository header gets a RepoSite row for it. The check is passed on only when its account is a runner the repository's record names. The lexicon, docs and tests match the code. The helpers RepoSite.svelte relies on (checkHref, siteLabel) exist. I found nothing that must change, and I did not run the tests.

One small thing, not worth holding the pull for: RepoSite.svelte shows "its check" only when there is a commit. A site deployed with a --check and no --commit shows deployed … ago with no link to the run. guide/sites.md says the page links the check whenever a runner the repository names deployed the site, so either the text or the component should change.

web/src/lib/molecules/RepoSite.svelteline 13Outdated
<span class="repo-site">
<a class="site-link" href={site.url} title={site.url} rel="noopener"><Icon name="globe" /><span>{hidden ? 'Private site' : siteLabel(site.url)}</span></a>
<span class="mute">{#if site.commit}from{' '}<Sha sha={site.commit} href={repoHref(repo.handle, repo.name, `/commit/${site.commit}`)} />{#if site.check}{' '}by <a href={checkHref(repo, site.check)}>its check</a>{/if},{' '}{:else}deployed{' '}{/if}<Time at={site.deployedAt} show={(at) => ago(at)} /></span>
review.knotless.dev

A site with a check but no commit drops the check link: it only renders inside the {#if site.commit} branch. This is fine if intended, but the guide says the check is linked whenever it is trusted.

Approved

My earlier note was about a check link that went missing when a site had no commit. The new commit drops the check link from RepoSite.svelte altogether, and guide/sites.md no longer promises it. That removes the mismatch between the text and the component. getRepo still returns the trusted check.

The pull body is now out of date. It still describes from 19fa13f by its check and a link to the run, and the screenshots probably show that text. Update the body to match the shipped UI. If checkHref in format.ts has no other users now, remove it. I didn't run the tests or look for other users.

Approved

The new commit makes Repo::site read from indexed(app, self). A private repository's site now comes from the spaces index, where the earlier code read the appview's index even for spaces. That matches how pulls and issues are read, and I found nothing wrong with it. I did not run the tests.

I asked for two things last round:

  • checkHref: Several other components still use it, so it stays. Nothing to do.
  • Pull body: It is not updated yet. It still describes from 19fa13f by its check with a link to the run, and the screenshots were probably taken before that link was removed. Please fix the body to match the shipped UI. This doesn't block the merge.

The queue ejected the pull because test failed at 234f96e. Check that 1f7bb2b passes before queueing it again.

Approved

The new commit moves the owner-label logic into site::owner_label. Repo::site in web.rs and served_at in site.rs now share it, and it has a unit test. This keeps the old behaviour. The did: filter that served_at already had now applies to web.rs too, which is harmless. I found nothing wrong and did not run the tests.

The pull body is still not updated, and I have now asked twice. It describes from 19fa13f as a link, and check as "not drawn on the page yet". Please check that the text and the screenshots match the shipped UI. This doesn't block the merge.

Merged as 7e1bfff