Every failure the server answers with names its own error code
Build / Build (push) Successful in 34s
Deploy / privapub.thepra.dev (push) Successful in 57s
Deploy / Release notes on the Releases tab (push) Successful in 3s

Each refusal and failure the client API sends now starts with a code no other failure uses, such as "[ERR0030006] That
code is not valid.", so a screenshot or a report points at the exact place it came from. Nothing another program reads
changes: ActivityPub, the Mastodon API's errors, sign-in tokens and the error kinds decePubClient branches on stay as they
were. The house-rules checks move to 1.1.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd
This commit is contained in:
thepraandClaude Opus 5.5 committed 2026-11-10 08:11:24 +01:00
1 parent f3fdeaf038
commit c2f439d1e9
25 files changed
+268 -224

No files matched your search

@@ -38,7 +38,7 @@ namespace PrivaPub.Controllers.ClientToServer
return NotFound();
var state = await PersonaArchives.Of(avatarId, token);
if (state.ExportState is "queued" or "running")
return Conflict(new WebResult().Invalidate("The archive is being made."));
return Conflict(new WebResult().Invalidate(18001.ToCodedError("The archive is being made.")));
state.ExportState = "queued";
state.ExportAskedAt = DateTime.UtcNow;
state.ExportError = default;
@@ -112,12 +112,12 @@ namespace PrivaPub.Controllers.ClientToServer
return NotFound();
// a suspended persona may take its archive away, never bring one in (R6): an import follows, blocks and posts
if (await DB.Default.Find<Avatar>().MatchID(avatarId).Match(a => a.SuspendedAt != null).ExecuteAnyAsync(token))
return StatusCode(StatusCodes.Status403Forbidden, new WebResult().Invalidate("This persona is suspended.", StatusCodes.Status403Forbidden));
return StatusCode(StatusCodes.Status403Forbidden, new WebResult().Invalidate(18002.ToCodedError("This persona is suspended."), StatusCodes.Status403Forbidden));
var state = await PersonaArchives.Of(avatarId, token);
if (state.ImportState is "queued" or "running")
return Conflict(new WebResult().Invalidate("An import is running."));
return Conflict(new WebResult().Invalidate(18003.ToCodedError("An import is running.")));
if (form.Parts.Count == 0 || form.Parts.Any(p => !PersonaArchives.Parts.Contains(p)))
return UnprocessableEntity(new WebResult().Invalidate("Choose what to import."));
return UnprocessableEntity(new WebResult().Invalidate(18004.ToCodedError("Choose what to import.")));
if (transfers.Owner(form.UploadId) != User.GetUserId())
return NotFound();
var path = transfers.Take(form.UploadId, PersonaArchives.Folder(backups.Root, avatarId), $"import-{form.UploadId}.zip");
@@ -128,7 +128,7 @@ namespace PrivaPub.Controllers.ClientToServer
if (archive?.Has("actor.json") != true)
{
System.IO.File.Delete(path);
return UnprocessableEntity(new WebResult().Invalidate(refused ?? "the archive has no actor.json"));
return UnprocessableEntity(new WebResult().Invalidate(18005.ToCodedError(refused ?? "the archive has no actor.json")));
}
state.ImportState = "queued";
state.ImportAskedAt = DateTime.UtcNow;