summaryrefslogtreecommitdiff
path: root/Hutch/Models
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-03-18 19:34:59 -0500
committerChristian Cleberg <[email protected]>2026-03-18 19:34:59 -0500
commit430741f0236ab21583acda8e2774d95e6e0e4ffe (patch)
treee8ef38d574939a0c47f2a92e14db60950b824151 /Hutch/Models
parent796c39d8ff08829bd695bc4e7497a147640eb79a (diff)
downloadhutch-430741f0236ab21583acda8e2774d95e6e0e4ffe.tar.gz
hutch-430741f0236ab21583acda8e2774d95e6e0e4ffe.tar.bz2
hutch-430741f0236ab21583acda8e2774d95e6e0e4ffe.zip
stabilize build task identity and log cache keys
Diffstat (limited to 'Hutch/Models')
-rw-r--r--Hutch/Models/Builds.swift27
1 files changed, 25 insertions, 2 deletions
diff --git a/Hutch/Models/Builds.swift b/Hutch/Models/Builds.swift
index 6694c35..b0c0e8d 100644
--- a/Hutch/Models/Builds.swift
+++ b/Hutch/Models/Builds.swift
@@ -34,10 +34,33 @@ enum TaskStatus: String, Codable, Sendable {
/// A single task within a build job.
struct BuildTask: Codable, Sendable, Identifiable {
- var id: String { name }
+ private(set) var ordinal: Int?
let name: String
let status: TaskStatus
let log: BuildLog?
+
+ var id: String {
+ if let ordinal {
+ return "\(ordinal):\(name)"
+ }
+ return [name, log?.fullURL, status.rawValue]
+ .compactMap { $0 }
+ .joined(separator: "::")
+ }
+
+ var logCacheKey: String {
+ id
+ }
+
+ func withOrdinal(_ ordinal: Int) -> BuildTask {
+ var task = self
+ task.ordinal = ordinal
+ return task
+ }
+
+ private enum CodingKeys: String, CodingKey {
+ case name, status, log
+ }
}
// MARK: - Job Summary (for list view)
@@ -90,7 +113,7 @@ struct JobDetail: Codable, Sendable {
let visibility: Visibility?
let image: String?
let manifest: String?
- let tasks: [BuildTask]
+ var tasks: [BuildTask]
let log: BuildLog?
let owner: Entity
}