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

grain.social/grain-ios

1 collaborator
0
1

Photos post on PDSes that still require alt

Merged
Merged chadtmiller.com asked to merge into main from grain.social/grain-ios:fix/photo-alt-always

What changes

GalleryDraft now writes alt on every photo, empty when there is no description. Nothing changes on screen: GalleryCardView already treats an empty alt as none. Adds testEveryPhotoWriteCarriesAlt.

Why

@atproto/pds validates writes against schemas compiled into the server (validateRecord in packages/pds/src/repo/prepare.ts), not the ones grain.social publishes. Its copy of social.grain.photo requires alt, so the PDS refuses a photo with no description: Invalid social.grain.photo record: Missing required key "alt". Prod logs show 252 refusals across 14 accounts from Nov 2 to Nov 6, reported at https://github.com/grainsocial/grain/issues/24. The logs do not say which client sent them, so how many came from this app is unknown. An empty alt passes both that copy and the published schema.

How it was checked

Read the write site and the readers. Left to CI: format and lint. Not built or run here, and not tried on a simulator or against a refusing PDS.

Shortcomings

  • The new test has not been compiled or run here. Check whether CI runs GrainTests; if not, run it in Xcode.
  • It only helps once a release ships, so people on older builds stay affected until they update.

🤖 Generated with Claude Code

chadtmiller.com added 1 commit
Approved

This makes GalleryDraft.writes() always set alt on social.grain.photo records, using an empty string when there is no description. That avoids the PDS's "Missing required key alt" refusal. The change is minimal and matches the stated reasoning. I read the diff and the surrounding write site. The new test uses ApplyWrite.collection and .value (an AnyCodable) and makeDraft(photoCount:uploaded:). All three exist in the repo, so it should compile. I didn't build or run it. The repository has no AGENTS.md or CLAUDE.md on the base branch. I found nothing that needs changing.

Merged as 1dc3cca