fix(02-03): mask collection_key and checkpoint in JSON diffs
Album sync payloads hash the collection and stamp a checkpoint that change across seed runs and must not fail PHP self-replay. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -55,6 +55,16 @@ func maskLeaf(path string, val any, step Step, diffs *[]Diff) any {
|
||||
if key == "slug" || disabledPath(step, path, key) {
|
||||
return val
|
||||
}
|
||||
if key == "collection_key" {
|
||||
if val == nil {
|
||||
return nil
|
||||
}
|
||||
if _, ok := val.(string); !ok {
|
||||
*diffs = append(*diffs, Diff{Path: path, Expected: "string collection_key", Actual: formatValue(val)})
|
||||
return val
|
||||
}
|
||||
return maskID
|
||||
}
|
||||
if isDateKey(key) {
|
||||
return maskDate(path, val, diffs)
|
||||
}
|
||||
@@ -97,7 +107,7 @@ func maskIDValue(path string, val any, diffs *[]Diff) any {
|
||||
}
|
||||
|
||||
func isDateKey(key string) bool {
|
||||
return strings.HasSuffix(key, "_at")
|
||||
return strings.HasSuffix(key, "_at") || key == "checkpoint"
|
||||
}
|
||||
|
||||
func isIDKey(key string) bool {
|
||||
|
||||
Reference in New Issue
Block a user