Skip to content

Commit dbf4ef1

Browse files
JusterZhuclaude
andauthored
fix: align cross-version field mapping between client SDK and server API (#505)
- Add MinClientVersion, SourceArchiveHash, TargetArchiveHash fields to VersionEntry with JSON property names - Fix HttpDownloadSource.MapVersionEntry to correctly map these fields (TargetArchiveHash was mapped to package hash instead of archive hash) - Remove unused ToVersion field from VersionEntry (no consumer in the SDK — target version is already represented by Version field) This completes the cross-version update field alignment: - MinClientVersion now flows end-to-end from server DB -> API -> client SDK -> DownloadPlanBuilder.IsCompatible() - SourceArchiveHash/TargetArchiveHash now correctly map for CVP traceability Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b2ae167 commit dbf4ef1

2 files changed

Lines changed: 25 additions & 14 deletions

File tree

src/c#/GeneralUpdate.Core/Configuration/VersionEntry.cs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace GeneralUpdate.Core.Configuration;
3131
/// <item>
3232
/// <description>
3333
/// Differential update phase: Uses <see cref="Hash" /> for file verification, and
34-
/// <see cref="FromVersion" /> and <see cref="ToVersion" /> to determine the scope of the
34+
/// <see cref="FromVersion" /> to determine the scope of the
3535
/// differential patch.
3636
/// </description>
3737
/// </item>
@@ -196,26 +196,35 @@ public class VersionEntry : VersionIdentity
196196
/// </summary>
197197
/// <remarks>
198198
/// Only valid when <see cref="IsCrossVersion" /> is <c>true</c>.
199-
/// Together with <see cref="ToVersion" />, defines the version scope of the differential patch.
200199
/// </remarks>
201200
[JsonPropertyName("fromVersion")]
202201
public string? FromVersion { get; set; }
203202

204-
/// <summary>
205-
/// The target version number for cross-version upgrade packages.
206-
/// Indicates the target version that will be reached after applying this differential patch.
207-
/// </summary>
208-
/// <remarks>
209-
/// Only valid when <see cref="IsCrossVersion" /> is <c>true</c>.
210-
/// Together with <see cref="FromVersion" />, defines the version scope of the differential patch.
211-
/// </remarks>
212-
[JsonPropertyName("toVersion")]
213-
public string? ToVersion { get; set; }
214-
215203
/// <summary>
216204
/// Whether this version package is frozen (archived and not used for active updates).
217205
/// Frozen version packages will not be used for update detection or download.
218206
/// </summary>
219207
[JsonPropertyName("isFreeze")]
220208
public bool? IsFreeze { get; set; }
209+
210+
/// <summary>
211+
/// The minimum client version required for this package.
212+
/// If the current client version is below this, the package is not applicable.
213+
/// </summary>
214+
[JsonPropertyName("minClientVersion")]
215+
public string? MinClientVersion { get; set; }
216+
217+
/// <summary>
218+
/// The hash of the source full-version archive used to build this cross-version package.
219+
/// Only valid when <see cref="IsCrossVersion"/> is <c>true</c>.
220+
/// </summary>
221+
[JsonPropertyName("sourceArchiveHash")]
222+
public string? SourceArchiveHash { get; set; }
223+
224+
/// <summary>
225+
/// The hash of the target full-version archive used to build this cross-version package.
226+
/// Only valid when <see cref="IsCrossVersion"/> is <c>true</c>.
227+
/// </summary>
228+
[JsonPropertyName("targetArchiveHash")]
229+
public string? TargetArchiveHash { get; set; }
221230
}

src/c#/GeneralUpdate.Core/Download/Sources/HttpDownloadSource.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ private static DownloadAsset MapVersionEntry(VersionEntry v)
182182
AppType: v.AppType,
183183
IsCrossVersion: v.IsCrossVersion == true,
184184
FromVersion: v.FromVersion,
185-
TargetArchiveHash: v.Hash,
185+
MinClientVersion: v.MinClientVersion,
186+
SourceArchiveHash: v.SourceArchiveHash,
187+
TargetArchiveHash: v.TargetArchiveHash,
186188
AuthScheme: v.AuthScheme,
187189
AuthToken: v.AuthToken
188190
);

0 commit comments

Comments
 (0)