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

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

next: Delete account in Settings, asking no new scope; Identity & data and Instagram import gone

Merged
Merged chadtmiller.com asked to merge into feature/hud from grain.social/grain:next/delete-data

What changes

Delete account. Settings has a destructive Delete account above Sign out, in the account section. It asks with grain.social's words and makes you type your handle to confirm. HUD then asks social.grain.server.getAccountDeletionPlan for a page of deletes and commits each page at the account's PDS in one applyWrites, repeating until nothing is left, with a count on the button. It then calls social.grain.server.deleteAccount with the account's DID, so grain forgets the account (preferences, notification state, push tokens, mutes, story views), and signs the account out. The atproto account and other apps' records are untouched.

Gone: the rows opening grain.social's Identity & data and Import from Instagram pages.

No new scope at sign-in. Delete account's collections are the ten social.grain.* collections Grain's views already write, so sign-in asks exactly what next.grain.social asks today and nobody is asked to consent again. Groups' collections (social.grain.group.{decline,item,submission}) are left out, because groups don't work yet. If an account has group records, HUD stops at the plan that names them and deletes none of that plan. It never calls deleteAccount or signs out, and it says "Some records can't be deleted here yet: social.grain.group.item. Signing in doesn't ask to delete them, so nothing more was deleted." The web shows that under the button, iOS in an alert. A later change can ask for the group scopes at deletion time only.

vendor/hud at 42d0f76. HUD's Action deletes (a73ef12, the gallery's) gains repeat, then and collections (836baa7). 42d0f76 adds the refusal naming what is left. It also moves an Action's failure in a Stack to right under its button: on the web it had been drawn after everything in Settings, out of sight. Only the operator's own clients can run a repeating plan.

Why

Under HUD, grain-serve holds no session for the account, so its cookie path can't delete the records. Instead the app deletes them at the PDS, as a gallery's Delete does with getDeletionPlan. grain-serve, asked with a service token, forgets the account once its PDS lists no social.grain.* collection.

How it was checked

End to end against HUD's reference PDS. The throwaway alice.test was seeded with 219 Grain records: 8 galleries of 8 photos, each photo with EXIF and a gallery item, plus favorites, comments, a follow, a story and a profile. HUD served Grain's next/ as its pages, at its public origin over a Cloudflare quick tunnel, so that Grain's web is the operator's own client as on next.grain.social. did:web:grain.social pointed at a local stand-in for grain-serve, which plans as getAccountDeletionPlan does (its order, 200 a plan) and records deleteAccount. No real account or appview was involved.

  • Web, Chromium at 390 and 1440:
    • Settings shows Delete account and neither removed row.
    • Delete stays disabled with nothing typed, with alice, and with bob.test, and turns on for @ALICE.TEST.
    • The button counted "Deleting…", "Deleting… 200 records", then "Deleting… 219 records".
    • Afterwards describeRepo lists only app.bsky.*. The stand-in saw three plans (200, 19, 0), then deleteAccount with alice's DID, with nothing left. The browser was signed out and its session cookie gone.
    • The consent's scope has no ?action=delete and no group scope.
  • Web with one group record: the run stopped after the first plan and showed the message under the button. The group record and the rest of the second plan stayed. alice stayed signed in, and deleteAccount was never called.
  • iOS simulator, a fresh alice: the same flow passes: Settings, the handle-gated alert, "Deleting… 219 records", the PDS left with only app.bsky.*, deleteAccount with her DID, signed out. With a group record it shows "Couldn't delete account" with the same message and stays signed in.
  • HUD 42d0f76: fmt, clippy -D warnings, just cov (100% of lines and functions), svelte-check, web unit tests (36) and SSR, just lint, just lex.
  • Grain: node next/check-apps.mjs, npm run check; next/ builds.

The end-to-end runs used HUD 46f47fa. That is 42d0f76's change before I rebased it onto app/shell's 9332f5b, a tab-root change that doesn't touch this. Signing in on the web found that the sign-in screen's redirect needed { external: true }. That fix is now f04f35b on feature/hud, merged here.

Shortcomings

  • Needs first: grain-serve's getAccountDeletionPlan is merged to main (855d068) and must be deployed before this. hud-next must run 42d0f76.
  • Accounts with group records can't finish Delete account here until groups' delete scopes are asked for. The message says so.
  • getAccountDeletionPlan's lexicon is bundled by hand in HUD until grain's lexicons carry it.
  • A deletes with repeat on a Covers select is accepted by the view check but never exercised.
  • Android was not run end to end.
Approved

This adds a Delete account action to Settings and removes the Identity & data and Import from Instagram rows. The action's deletes block uses getAccountDeletionPlan with repeat, then calls deleteAccount and signs out. It lists only the ten social.grain.* collections Grain already writes, so sign-in asks for no new scope. It is gated on typing the handle, and the confirm text is clear.

I read next/views/grain-settings.json, which is the only hand-written change. It looks right:

  • The view's own service is did:web:grain.social#grain_appview, and both calls use that same service.
  • deleteAccount takes the account's DID through $did.
  • Nothing else in the view still refers to the removed rows or the "Tools" heading.

I did not read the rest of the diff, which is the vendor/hud bump to 42d0f76. AGENTS.md says that directory is copied from HUD and never edited by hand, and HUD's own checks cover it. I can't verify that bump from here. The pull body says it was tested end to end on web and iOS.

The checks on the previous head all passed. On this head, check and lexicons pass. next, test, web and next-image were still running when I looked.

The pull body states two ordering constraints. getAccountDeletionPlan must be deployed in grain-serve first, and hud-next must run HUD 42d0f76. Make sure both are in place before merging.

Thanks. Every check now passes at 5711f09: web, check, next, test, next-image; lexicons and e2e were skipped. HUD 42d0f76 is on app/shell with just cov at 100%, and the vendor copy is that sha, as vendor/hud/COMMIT says. Both ordering constraints still hold: grain-serve's getAccountDeletionPlan (855d068 on main) has to be deployed and hud-next has to run 42d0f76 before this merges.

Merged as eaeef0f
Part of a stack of 2
  1. next: Delete account in Settings, asking no new scope; Identity & data and Instagram import gone Landed as eaeef0f
  2. main