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

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

Over-long gallery titles are indexed and cut, and sign-in seeds a profile

Merged
Merged chadtmiller.com asked to merge into feature/rust from grain.social/grain:batch/four

What changes

This brings two approved pulls into feature/rust in one merge, so their checks run once against the combined result. Each pull's own description says what it does and why:

  • Over-long gallery titles (…/3mzbf2zhtwr4z, 0362694). Lexicons::validate_indexed lets a social.grain.gallery past maxLength on its title or description, in Jetstream, backfill and grain-import. The view cuts the title to 100 graphemes and the description to 1000. grain-serve's own writes still refuse long values.
  • A grain profile seeded from Bluesky at web sign-in (…/3mzbfcztrfzsb, fc53a26). In the background after the session is made: when the grain profile is missing or unnamed, it is written from app.bsky.actor.profile/self, through the user's own session, with swapRecord.

Why

Both are behaviour the old server had that grain-serve lacked, found in the import rehearsal for next.grain.social. Six galleries would otherwise vanish at cutover, and new accounts would start with blank profiles.

How it was checked

Each pull passed check, test, rust, lexicons and harness at its own head, and review.knotless.dev approved it. They overlap only in crates/grain-serve/src/login.rs and tests/login.rs, which git merged without conflict. This pull's checks run on the combined tree.

Shortcomings

These are the parts' own:

  • The apps must seed a profile themselves after sign-in.
  • Search still matches words past the cut.
  • Galleries in spaces aren't cut.

🤖 Generated with Claude Code

Approved

This batches two parts. The first lets the index keep galleries whose title or description runs past maxLength, and views cut them to 100 and 1000 graphemes. The second seeds a grain profile from Bluesky in the background after web sign-in.

I found nothing that must change.

  • Gallery lengths: validate_indexed shortens only the gallery's top-level strings, and only inside a clone used for validation. Every other check still applies, and the tests cover that. Writes through Index::check stay strict. Jetstream, backfill and import go through the lenient path. The gallery lexicon sets only maxLength on these two fields, with no maxGraphemes, so truncating to max bytes can't trip another bound. I found no other read path that shows record.title uncut. The view, OG card and notifications all go through gallery_title.
  • Profile seeding: swapRecord is used when a grain profile already exists, and the spawned task logs its failures without touching the login. Because the seed is skipped only when a name already exists, a Bluesky profile with no displayName makes every login write the grain profile again. That is harmless but pointless, so you could skip the write when the result adds nothing.
  • Checks: On this head, check passed and lexicons was skipped. rust, harness and test were still running when I looked. Please wait for them, particularly harness with its coverage gate, before this merges.
Merged as 785dbe4
Part of a stack of 2
  1. Over-long gallery titles are indexed and cut, and sign-in seeds a profile Landed as 785dbe4
  2. main