0
2
grain-import's test reads imported space invites as grain-serve does
Closed Approved
This changes only the grain-import test. The invite fixtures now use the real at://<did>/space/social.grain.privateGallery/<skey> URI. The test then reads the imported rows back through Index::invites, grain::space::of_kind and Index::space_support.
I checked the new calls against feature/rust:
Index::invites(&str, usize)returnsInvite { space, author, .. }.of_kindandPRIVATE_GALLERYexist, andNamed.authorityis a public field.space_supportreturnsOption<(Support, i64)>withsupportedandmissing.grain-importalready depends on bothgrainandgrain-serve.
The URI parses as a private gallery with authority did:plc:alice, so the assertions should hold. The test, harness, rust and check runs were still queued when I looked, so I didn't see them pass. Please confirm they go green before merging.
Landed on feature/rust in batch/three (…/3mzbdo7hmjf2b, 236806f), with its head c415344 unchanged.
What changes
grain-import already copies
_space_invitesintospace_inviteand_space_supportintospace_support, so no schema migration or import code changes here. What does change is the import test. Its invite rows now use the URI the old server actually stored,at://<author>/space/social.grain.privateGallery/<skey>(thespaceUriinserver/spaces/client.ts), where before they used a made-upats://…/social.grain.space/…. After the import, the test reads the rows back through grain-serve's own index calls:Index::inviteslists the gallery shared with bob, with alice as its author.grain::space::of_kindreads that space as a private gallery. This is the parselistSharedPrivateGalleriesmakes before it asks for a credential.Index::space_supportgives back each PDS'ssupportedandmissingassupport::supportkeeps them.Why
Asked to make grain-import carry
_space_invitesand_space_support, I found both already carried:Keptentries incrates/grain-import/src/lib.rs, tables incrates/grain-serve/src/index/schema.rs, and row-for-row checks in the import test. The test had one gap. With a URI in a shape grain-serve never writes, a mismatch would not show up. The rows would import,listSharedPrivateGallerieswould skip each one becauseof_kindrefuses it, and nobody would see a shared gallery. The test now covers that whole path.This mirrors no knotless code. knotless has no older server to import from, and keeps no invite hint: a reader there finds a space through its member list, and grain cannot do that because being added leaves no trace on the member's PDS.
How it was checked
This changes the test only. It runs in the
testandharnesschecks on this pull. It was not run on this machine.Shortcomings
The fixture's record in a space (the
social.grain.galleryrow whosespacecolumn is skipped on import) still uses the made-upats://URI. The import never parses that column, so nothing depends on its shape.🤖 Generated with Claude Code