Files
SocialPub/PrivaPub/Models/Federation/ObjectRecord.cs
T
thepraandClaude Opus 5.5 0f73f69239
Build / Build (push) Successful in 30s
House rules: primary constructors, a cancellation token on every async call, and the rules fail the build
- Services, controllers and jobs take their dependencies through primary
  constructors and use them directly; where a method already named a local
  after a dependency, the dependency takes its type's name.
- Every async method takes a CancellationToken last and passes it down to
  MongoDB, HTTP and the job queue. The setup claim is still given back when
  a request is cancelled.
- The federation and media options are read through IOptionsMonitor.
- The Mastodon entities keep sending "" for empty strings, and every model
  field where null means something says so.
- The inbox's 503 with Retry-After, which other servers retry, is the one
  server error left, and says why.
- Arasaka.HouseRules.Analyzers checks all of this in every build, here and in
  PrivaPub.ClientModels as decePubClient builds it.

Checked against GoToSocial in the pasture: 64 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd
2026-11-10 01:24:43 +01:00

55 lines
2.3 KiB
C#

using MongoDB.Entities;
namespace PrivaPub.Models.Federation
{
public class ObjectRecord : Entity
{
public string ObjectURI { get; set; }
public string PostId { get; set; }
public string ObjectType { get; set; }
public string Host { get; set; }
public string Raw { get; set; }//the object exactly as it reached us, unless it was larger than MaxRawBytes
public string RawHash { get; set; }//sha-256 of the raw bytes, hex
public int RawBytes { get; set; }
public bool RawTruncated { get; set; }
public string ActivityContext { get; set; }//the delivering activity's @context, which an embedded object does not repeat
public ObjectPath Path { get; set; }
public bool Refetched { get; set; }//delivered, but read again from its origin because it came embedded from another one
public string ActivityId { get; set; }//the activity that brought it, or that caused the fetch
public string ActivityType { get; set; }
public string ActivityActorURI { get; set; }
public string Inbox { get; set; }//"shared" or "personal" when delivered
public string SignatureScheme { get; set; }
public string KeyId { get; set; }
public string Algorithm { get; set; }
public List<string> SignedHeaders { get; set; } = new();
public DateTime ReceivedAt { get; set; } = DateTime.UtcNow;
public DateTime? Published { get; set; }
public DateTime? Updated { get; set; }
public List<ObjectRevision> Revisions { get; set; } = new();
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0006", Justification = "Null on records older than v1.16, which are read again from the raw form; an empty list would mean none.")]
public List<string> Extensions { get; set; }//ObjectFeatures, stored for statistics; null on records older than v1.16
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0006", Justification = "Null on records older than v1.16, which are read again from the raw form; an empty list would mean none.")]
public List<string> ContextNamespaces { get; set; }
}
public class ObjectRevision
{
public string Raw { get; set; }
public string RawHash { get; set; }
public bool RawTruncated { get; set; }
public string ActivityId { get; set; }
public DateTime? Updated { get; set; }
public DateTime ReceivedAt { get; set; } = DateTime.UtcNow;
}
public enum ObjectPath
{
Delivered,
Fetched
}
}