chadtmiller.com/knotless
git that lives in your Atmosphere account
1
10
Private repositories speak the October 29 spaces alpha
.changeset/spaces-memberspace.mdnew+7−0
| @@ -0,0 +1,7 @@ | ||
--- | ||
default: patch | ||
--- | ||
| ||
# Private repositories work on the October 29 spaces alpha | ||
| ||
The spaces alpha of October 29 moved spaces from `com.atproto.simplespace` to a policy on `com.atproto.space`, and creating a private repository or sharing one failed against a PDS running it. knotless now creates each private repository's space under the memberspace policy and manages its members with `com.atproto.memberspace`. A PDS on an older alpha can't create private repositories with this version. | ||
.knotless/workflows/scenarios.yml+1−1
| @@ -25,7 +25,7 @@ cache: [target, /usr/local/cargo/registry, /usr/local/rustup, /opt/node, /opt/at | ||
env: | ||
TRACKS: contribution mentions moderation owners private review revert solo team | ||
# As test.yml's, for the tracks that need the spaces alpha. | ||
ATPROTO_COMMIT: e03c77fc8341189119bea1bdae0f045d006c8d2a | ||
ATPROTO_COMMIT: 11c5d98cd50261c5e1201fedc5c6c05a7b8d1ccf | ||
ALPHA_BUILD: "2" | ||
steps: | ||
- name: node | ||
.knotless/workflows/test.yml+1−1
| @@ -24,7 +24,7 @@ cache: [target, /usr/local/cargo/registry, /usr/local/rustup, /opt/node, /opt/to | ||
env: | ||
# The spaces alpha the tests run against, as KNOTLESS_DEV_ENV names a | ||
# checkout of it locally. | ||
ATPROTO_COMMIT: ac0c9f15392f6f0298d71dc52aa88c05036150be | ||
ATPROTO_COMMIT: 11c5d98cd50261c5e1201fedc5c6c05a7b8d1ccf | ||
# Bumped when the steps that build the alpha change, to build it again. | ||
ALPHA_BUILD: "2" | ||
LLVM_COV_VERSION: 0.9.1 | ||
crates/knotless/src/space.rs+9−13
| @@ -482,17 +482,16 @@ impl Admin<'_> { | ||
/// Creates the space of type `space_type` keyed `skey`, readable and | ||
/// writable by its member list, keeping one that exists. | ||
pub async fn create_of(&self, space_type: &str, skey: &str) -> Result<(String, bool)> { | ||
let member_list = json!({"$type": "com.atproto.simplespace.defs#memberListPolicy"}); | ||
// The memberspace policy's defaults: no public reads or writes, and | ||
// any app may read. | ||
let res = self | ||
.xrpc | ||
.procedure::<serde::de::IgnoredAny>( | ||
"com.atproto.simplespace.createSpace", | ||
"com.atproto.space.createSpace", | ||
Some(&json!({ | ||
"spaceType": space_type, | ||
"skey": skey, | ||
"readPolicy": member_list, | ||
"writePolicy": member_list, | ||
"appAccess": {"$type": "com.atproto.simplespace.defs#open"}, | ||
"policy": {"$type": "com.atproto.memberspace.policy"}, | ||
})), | ||
Some(&self.auth()), | ||
) | ||
| @@ -509,11 +508,8 @@ impl Admin<'_> { | ||
} | ||
| ||
pub async fn delete(&self, uri: &str) -> Result<()> { | ||
self.call( | ||
"com.atproto.simplespace.deleteSpace", | ||
json!({ "space": uri }), | ||
) | ||
.await | ||
self.call("com.atproto.space.deleteSpace", json!({ "space": uri })) | ||
.await | ||
} | ||
| ||
/// Adds `did` to the space. Every member writes to their own repo | ||
| @@ -528,7 +524,7 @@ impl Admin<'_> { | ||
/// not read still reads its own. | ||
pub async fn put_member_as(&self, uri: &str, did: &str, read: bool, write: bool) -> Result<()> { | ||
self.call( | ||
"com.atproto.simplespace.putMember", | ||
"com.atproto.memberspace.putMember", | ||
json!({ "space": uri, "did": did, "read": read, "write": write }), | ||
) | ||
.await | ||
| @@ -536,7 +532,7 @@ impl Admin<'_> { | ||
| ||
pub async fn remove_member(&self, uri: &str, did: &str) -> Result<()> { | ||
self.call( | ||
"com.atproto.simplespace.removeMember", | ||
"com.atproto.memberspace.removeMember", | ||
json!({ "space": uri, "did": did }), | ||
) | ||
.await | ||
| @@ -544,7 +540,7 @@ impl Admin<'_> { | ||
| ||
pub async fn members(&self, uri: &str) -> Result<Vec<Member>> { | ||
let params = [("space", uri), ("limit", "1000")]; | ||
self.every("com.atproto.simplespace.listMembers", ¶ms, "members") | ||
self.every("com.atproto.memberspace.listMembers", ¶ms, "members") | ||
.await | ||
} | ||
| ||
docs/design/access.md+2−2
| @@ -69,8 +69,8 @@ not published. A PDS without spaces drops the scope it does not know. | ||
## Private repositories | ||
| ||
A private repository is the space | ||
`at://<owner>/space/dev.knotless.space/<name>`, created with open app access | ||
and member-list read and write policies. Its records are the same as a | ||
`at://<owner>/space/dev.knotless.space/<name>`, governed by the alpha's | ||
memberspace policy: only its members read and write, with any app. Its records are the same as a | ||
public repository's, written with the space's `applyWrites` into the | ||
owner's repo inside the space. A create on an existing key fails there too, | ||
so the claim [compare-and-swap](storage.md#compare-and-swap-through-claims) works | ||