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
@@ -34,8 +34,10 @@ namespace PrivaPub.Federation.Objects
|
||||
public async Task Record(NoteDocument note, PostEntity post, ObjectPath path, bool refetched, CancellationToken token)
|
||||
{
|
||||
var arrival = Arrival.Current;
|
||||
var delivered = path == ObjectPath.Delivered;
|
||||
var raw = Capture(note.Raw);
|
||||
var host = new Uri(note.Id).Host.ToLowerInvariant();
|
||||
var activityContext = !delivered || note.Raw?.ContainsKey("@context") == true || arrival?.Context?.Length > 16 * 1024 ? default : arrival?.Context;
|
||||
var record = new ObjectRecord
|
||||
{
|
||||
ObjectURI = note.Id,
|
||||
@@ -46,20 +48,22 @@ namespace PrivaPub.Federation.Objects
|
||||
RawHash = raw.Hash,
|
||||
RawBytes = raw.Bytes,
|
||||
RawTruncated = raw.Truncated,
|
||||
ActivityContext = note.Raw?.ContainsKey("@context") == true || arrival?.Context?.Length > 16 * 1024 ? default : arrival?.Context,
|
||||
ActivityContext = activityContext,
|
||||
Path = path,
|
||||
Refetched = refetched,
|
||||
ActivityId = arrival?.ActivityId,
|
||||
ActivityType = arrival?.ActivityType,
|
||||
ActivityActorURI = arrival?.ActorURI,
|
||||
Inbox = path == ObjectPath.Delivered ? arrival?.Inbox : default,
|
||||
SignatureScheme = arrival?.KeyId == default ? default : "draft-cavage",
|
||||
KeyId = arrival?.KeyId,
|
||||
Algorithm = arrival?.Algorithm,
|
||||
SignedHeaders = arrival?.SignedHeaders?.ToList() ?? new(),
|
||||
ReceivedAt = arrival?.ReceivedAt ?? DateTime.UtcNow,
|
||||
Inbox = delivered ? arrival?.Inbox : default,
|
||||
SignatureScheme = !delivered || arrival?.KeyId == default ? default : "draft-cavage",
|
||||
KeyId = delivered ? arrival?.KeyId : default,
|
||||
Algorithm = delivered ? arrival?.Algorithm : default,
|
||||
SignedHeaders = delivered ? arrival?.SignedHeaders?.ToList() ?? new() : new(),
|
||||
ReceivedAt = delivered ? arrival?.ReceivedAt ?? DateTime.UtcNow : DateTime.UtcNow,
|
||||
Published = note.Published,
|
||||
Updated = note.Updated
|
||||
Updated = note.Updated,
|
||||
Extensions = ObjectFeatures.Detect(note.Raw),
|
||||
ContextNamespaces = ObjectFeatures.Namespaces(note.Raw, activityContext)
|
||||
};
|
||||
try
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user