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

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

grain-import's test reads imported space invites as grain-serve does

Closed
Closed chadtmiller.com asked to merge into feature/rust from grain.social/grain:gaps/import-spaces

What changes

grain-import already copies _space_invites into space_invite and _space_support into space_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> (the spaceUri in server/spaces/client.ts), where before they used a made-up ats://…/social.grain.space/…. After the import, the test reads the rows back through grain-serve's own index calls:

  • Index::invites lists the gallery shared with bob, with alice as its author.
  • grain::space::of_kind reads that space as a private gallery. This is the parse listSharedPrivateGalleries makes before it asks for a credential.
  • Index::space_support gives back each PDS's supported and missing as support::support keeps them.

Why

Asked to make grain-import carry _space_invites and _space_support, I found both already carried: Kept entries in crates/grain-import/src/lib.rs, tables in crates/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, listSharedPrivateGalleries would skip each one because of_kind refuses 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 test and harness checks on this pull. It was not run on this machine.

Shortcomings

The fixture's record in a space (the social.grain.gallery row whose space column is skipped on import) still uses the made-up ats:// URI. The import never parses that column, so nothing depends on its shape.

🤖 Generated with Claude Code

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) returns Invite { space, author, .. }.
  • of_kind and PRIVATE_GALLERY exist, and Named.authority is a public field.
  • space_support returns Option<(Support, i64)> with supported and missing.
  • grain-import already depends on both grain and grain-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.