chadtmiller.com/knotless
git that lives in your Atmosphere account
1
10
The appview's gateway is the one its DID document names
.changeset/gateway-from-did-document.mdnew+7−0
| @@ -0,0 +1,7 @@ | ||
--- | ||
default: patch | ||
--- | ||
| ||
# The appview's gateway is the one its DID document names | ||
| ||
`knotless share --write`, `knotless delegate` with no gateway named, and a runner landing a merge queue through the gateway now ask the appview for its DID instead of making one from `KNOTLESS_APPVIEW`'s address. A runner that reaches its appview at an internal address, as one beside it does, lands its queue again rather than failing to reach a gateway that does not exist. | ||
crates/knotless/src/gateway.rs+6−11
| @@ -152,7 +152,7 @@ pub async fn push( | ||
.is_some_and(|r| r.value.is_runner(&me.did)); | ||
let gateway = match gateway_of(ctx, remote, snap).await { | ||
Ok(gateway) => gateway, | ||
Err(_) if runner => appview(ctx)?, | ||
Err(_) if runner => appview(ctx).await?, | ||
Err(err) => return Err(err), | ||
}; | ||
let gateway = gateway.as_str(); | ||
| @@ -429,21 +429,16 @@ fn gateway_path(ctx: &Ctx, did: &str) -> std::path::PathBuf { | ||
.join(did.replace(':', "_")) | ||
} | ||
| ||
/// The appview's DID, for delegating to it as a gateway: the `did:web` | ||
/// of its host. | ||
pub fn appview(ctx: &Ctx) -> Result<String> { | ||
/// The appview's DID, for delegating to it as a gateway: the one its DID | ||
/// document names, read from it, not made from its address, which may be | ||
/// one only those beside it reach, as a runner's `http://serve:2590`. | ||
pub async fn appview(ctx: &Ctx) -> Result<String> { | ||
let base = ctx | ||
.env | ||
.appview | ||
.as_deref() | ||
.context("name a gateway's DID: KNOTLESS_APPVIEW is set empty")?; | ||
let host = base | ||
.split_once("://") | ||
.map_or(base, |(_, rest)| rest) | ||
.split('/') | ||
.next() | ||
.unwrap_or_default(); | ||
Ok(format!("did:web:{}", host.replace(':', "%3A"))) | ||
crate::moderation::appview_did(ctx, base).await | ||
} | ||
| ||
/// The gateway `did` last delegated to. | ||
crates/knotless/src/manage.rs+1−1
| @@ -341,7 +341,7 @@ pub async fn share_delegating<W: std::io::Write + ?Sized>( | ||
if !undelegated { | ||
return shared.map(|()| None); | ||
} | ||
let gateway = gateway::appview(ctx).context(NO_GATEWAY)?; | ||
let gateway = gateway::appview(ctx).await.context(NO_GATEWAY)?; | ||
let owner = Remote::open(ctx, url).await?; | ||
let me = session::ensure(ctx, &owner.identity).await?; | ||
gateway::delegate(ctx, &me, &gateway, out).await?; | ||
crates/knotless-mcp/src/lib.rs+1−1
| @@ -2690,7 +2690,7 @@ impl Server { | ||
async { | ||
let gateway = match p.gateway { | ||
Some(did) => did, | ||
None => gateway::appview(&self.ctx)?, | ||
None => gateway::appview(&self.ctx).await?, | ||
}; | ||
let me = knotless::session::me(&self.ctx).await?; | ||
// stdout carries the protocol; the link to approve goes to stderr. | ||
docs/design/merge-queue.md+4−1
| @@ -102,7 +102,10 @@ readers show its checks. Any other runner leaves the queues alone. | ||
The owner's runner pushes to the owner's PDS directly. A collaborator's | ||
pushes through the owner's gateway; see [gateway.md](gateway.md). A runner | ||
the repository names that may not push lands through the gateway too: the | ||
one sharing for writing recorded, or else the appview's. The gateway | ||
one sharing for writing recorded, or else the appview's, as the DID | ||
document at `KNOTLESS_APPVIEW` names it. A runner beside the appview reaches | ||
it at an address of their own, `http://serve:2590` in deploy/, which is no | ||
gateway's DID; the document names its public one. The gateway | ||
writes for the owner only once they have delegated writes to it, and takes | ||
from such a runner a batch of queued pulls and nothing else (see | ||
[gateway.md](gateway.md#runners-landing-a-queue)). Until the owner | ||