feat: mark WriteDeltaTime obsolete; document ReadDeltaTime as legacy-decode-only

WriteDeltaTime has no remaining callers - with warnings-as-errors, any new
delta-time write now fails the build with migration instructions in the
message. ReadDeltaTime stays un-attributed: its ~25 remaining callers (old-
version fallbacks and generated migration replays) decode existing bytes and
are correct forever; its docs now say exactly that.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kamron Batman 2026-08-22 19:32:47 -07:00
parent 8d1283ba27
commit 3c7355f5c4
No known key found for this signature in database
GPG key ID: 7D81DF26D9A5D94A
3 changed files with 10 additions and 0 deletions

View file

@ -384,6 +384,7 @@ public class BufferWriter : IGenericWriter
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[Obsolete("Delta time rewrites its bytes on every save. Write anchored time instead (WriteAnchoredTime, or [AnchoredDateTime] on generated fields); bump the containing type's version, as the wire format changes. Existing delta payloads remain readable through ReadDeltaTime in old-version fallbacks.")]
public void WriteDeltaTime(DateTime value)
{
if (value == DateTime.MinValue)

View file

@ -43,6 +43,12 @@ public interface IGenericReader
DateTime ReadDateTime() => new(ReadLong(), DateTimeKind.Utc);
TimeSpan ReadTimeSpan() => new(ReadLong());
/// <summary>
/// Decodes a legacy delta-time value. Only for reading old-version payloads (version
/// fallbacks and migration replays) — current formats store anchored time and read it
/// with <see cref="ReadAnchoredTime" />. <see cref="IGenericWriter.WriteDeltaTime" /> is
/// obsolete: no current-version format may write delta time.
/// </summary>
DateTime ReadDeltaTime()
{
return ReadLong() switch

View file

@ -40,7 +40,10 @@ public interface IGenericWriter
void Write(decimal value);
void WriteEncodedInt(int value);
void Write(DateTime value);
[Obsolete("Delta time rewrites its bytes on every save. Write anchored time instead (WriteAnchoredTime, or [AnchoredDateTime] on generated fields); bump the containing type's version, as the wire format changes. Existing delta payloads remain readable through ReadDeltaTime in old-version fallbacks.")]
void WriteDeltaTime(DateTime value);
void WriteAnchoredTime(DateTime value);
void Write(IPAddress value);
void Write(TimeSpan value);