M6: provenance fixes, stored features, community edits that are real edits
- A fetched ObjectRecord no longer wears the signature, key, signed headers and @context of the activity that caused the fetch, and its ReceivedAt is the fetch's own time. Its activity fields now name the trigger. Provenance answers signature null and fetchedBy "instance-actor". Migration _008 clears the old fetched records. - ObjectRecords store their ObjectFeatures extensions and context namespaces (migration _009 fills older records in batches), so statistics can count them. Provenance reads the stored lists. - ForeignAvatar.Features records what an actor document uses (ActorFeatures): featured, shared inbox, FEP-521a, FEP-8b32, identity proofs, Misskey fields, indexable, undiscoverable, locked, key size, and more. - RemoteEdits.Apply and RemoteDeletes.Remove are shared by the Update, Delete and Announce handlers. A community-wrapped Update is now an edit only when newer, refreshes polls and media otherwise, revises the ObjectRecord and re-resolves quotes. A community-wrapped Delete now tombstones the object, removes its ObjectRecord, reblogs and timeline rows, and lowers the reply count. Any deleted quoting post lowers the quoted post's quote count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ELjqpznMFMNrJoJUj6K5p2
This commit is contained in:
1 parent
d37999970c
commit
90a7e38ce9
19 files changed
+505
-109
No files matched your search
@@ -1,6 +1,7 @@
|
||||
using MongoDB.Entities;
|
||||
|
||||
using PrivaPub.Infrastructure.Data.Migrations;
|
||||
using PrivaPub.Models.Federation;
|
||||
using PrivaPub.Models.Post;
|
||||
using PrivaPub.Tests.Support;
|
||||
|
||||
@@ -46,5 +47,37 @@ namespace PrivaPub.Tests.Infrastructure
|
||||
Assert.Equal("conversation1", post.ConversationId);
|
||||
Assert.Equal("a1", post.AuthorAccountId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Fetched_records_lose_the_signature_they_never_had_and_every_record_gets_its_extensions()
|
||||
{
|
||||
Assert.SkipUnless(MongoFixture.Enabled, MongoFixture.Skip);
|
||||
var token = TestContext.Current.CancellationToken;
|
||||
var fetched = new ObjectRecord
|
||||
{
|
||||
ObjectURI = $"https://r.example/{Guid.NewGuid():N}", Path = ObjectPath.Fetched, KeyId = "https://x.example/u#k", SignatureScheme = "draft-cavage",
|
||||
Algorithm = "rsa-sha256", SignedHeaders = new() { "host" }, ActivityContext = "\"https://www.w3.org/ns/activitystreams\"",
|
||||
Raw = "{\"type\":\"Note\",\"quoteUrl\":\"https://q.example/1\"}"
|
||||
};
|
||||
var delivered = new ObjectRecord
|
||||
{
|
||||
ObjectURI = $"https://r.example/{Guid.NewGuid():N}", Path = ObjectPath.Delivered, KeyId = "https://x.example/u#k", SignatureScheme = "draft-cavage",
|
||||
Raw = "not json"
|
||||
};
|
||||
await DB.Default.SaveAsync(new[] { fetched, delivered }, token);
|
||||
|
||||
await new _008_fetched_records_lose_the_trigger_signature().UpgradeAsync();
|
||||
await new _009_object_records_keep_their_extensions().UpgradeAsync();
|
||||
|
||||
var afterFetched = await DB.Default.Find<ObjectRecord>().OneAsync(fetched.ID, token);
|
||||
var afterDelivered = await DB.Default.Find<ObjectRecord>().OneAsync(delivered.ID, token);
|
||||
Assert.Null(afterFetched.KeyId);
|
||||
Assert.Null(afterFetched.SignatureScheme);
|
||||
Assert.Empty(afterFetched.SignedHeaders);
|
||||
Assert.Null(afterFetched.ActivityContext);
|
||||
Assert.Equal("https://x.example/u#k", afterDelivered.KeyId);
|
||||
Assert.Contains("legacy-quote", afterFetched.Extensions);
|
||||
Assert.Empty(afterDelivered.Extensions);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user