Our @context stays JSON-LD 1.0, and a 500 no longer takes a host out
The proof term added with integrity proofs had a @graph container, which only JSON-LD 1.1 knows: Smithereen's reader refused every document carrying our context with a 500. Those 500s, retried, then put Smithereen's host in quarantine for an hour, and every delivery to it waited. Proofs are canonicalised as JSON (JCS), so the term loses nothing as a plain id; a test keeps every term within 1.0. Only an unreachable host, a timeout or a gateway's 502, 503 or 504 now counts against a host: a 500 is the server failing on that one activity, retried on its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
b66f0acf4e
commit
b478049303
5 files changed
+63
-4
No files matched your search
@@ -0,0 +1,32 @@
|
||||
using PrivaPub.Federation.Rendering;
|
||||
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace PrivaPub.Tests.Federation
|
||||
{
|
||||
// The @context on everything we send. Readers that expand JSON-LD 1.0 (Smithereen) refuse a whole document over one
|
||||
// term only 1.1 knows, so every term stays within 1.0
|
||||
public class ContextTests
|
||||
{
|
||||
static readonly string[] Containers10 = ["@list", "@set", "@index", "@language"];
|
||||
static readonly string[] Keywords11 = ["@version", "@protected", "@propagate", "@import", "@nest", "@prefix", "@context", "@direction", "@json"];
|
||||
|
||||
[Fact]
|
||||
public void Every_term_is_json_ld_1_0()
|
||||
{
|
||||
var terms = ActivityPubRenderer.Context().OfType<JsonObject>().Single();
|
||||
|
||||
foreach (var (name, definition) in terms)
|
||||
{
|
||||
if (definition is not JsonObject term)
|
||||
continue;
|
||||
if (term["@container"] is JsonValue container)
|
||||
Assert.True(Containers10.Contains(container.GetValue<string>()), $"{name}: @container {container} is JSON-LD 1.1");
|
||||
Assert.True(term["@container"] is null or JsonValue, $"{name}: an array of containers is JSON-LD 1.1");
|
||||
Assert.DoesNotContain(term.Select(p => p.Key), Keywords11.Contains);
|
||||
Assert.NotEqual("@json", term["@type"]?.GetValue<string>());
|
||||
}
|
||||
Assert.DoesNotContain(terms.Select(p => p.Key), Keywords11.Contains);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user