Skip to content

Commit 74f4570

Browse files
committed
Published using @Stream44 Studio
Signed-off-by: Christoph <christoph@christoph.diy>
1 parent 5c7604d commit 74f4570

3 files changed

Lines changed: 29 additions & 9 deletions

File tree

caps/ProjectPublishing.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,12 @@ export async function capsule({
303303
}
304304

305305
// ══════════════════════════════════════════════════════
306-
// INTERNAL: Check for .rej files (unresolved patch conflicts)
306+
// INTERNAL: Check for .rej / .orig files (unresolved patch conflicts)
307307
// ══════════════════════════════════════════════════════
308308
const allRejFiles: string[] = []
309309
for (const [repoName, repoConfig] of Object.entries(matchingRepositories)) {
310310
const projectSourceDir = join((repoConfig as any).sourceDir)
311-
const rejFiles = await glob('**/*.rej', {
311+
const rejFiles = await glob('**/*.{rej,orig}', {
312312
cwd: projectSourceDir,
313313
absolute: false,
314314
onlyFiles: true,
@@ -321,13 +321,13 @@ export async function capsule({
321321
}
322322

323323
if (allRejFiles.length > 0) {
324-
console.log(chalk.red('\n[t44] ERROR: Found unresolved patch conflict files (.rej)\n'))
325-
console.log(chalk.red('The following .rej files must be resolved and removed before publishing:\n'))
324+
console.log(chalk.red('\n[t44] ERROR: Found unresolved patch conflict files (.rej / .orig)\n'))
325+
console.log(chalk.red('The following files must be resolved and removed before publishing:\n'))
326326
for (const rejFile of allRejFiles) {
327327
console.log(chalk.red(` • ${rejFile}`))
328328
}
329329
console.log(chalk.yellow('\nThese files are created when `patch` fails to apply a hunk cleanly.'))
330-
console.log(chalk.yellow('Review each .rej file, manually apply the changes, then delete the .rej files.\n'))
330+
console.log(chalk.yellow('Review each file, manually apply the changes, then delete them.\n'))
331331
process.exit(1)
332332
}
333333

caps/ProjectTest.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,26 +208,46 @@ export async function capsule({
208208
// Stabilize for storage: sort object keys only (preserves array order in snapshots)
209209
const stabilizeForStorage = (obj: any): any => JSON.parse(stringify(obj) || 'null')
210210

211+
// Detect hash-like strings (32+ hex chars)
212+
const isHashLike = (s: string): boolean => /^[0-9a-f]{32,}$/i.test(s)
213+
211214
// Deep sort for comparison: sort both object keys AND array elements recursively
215+
// Also normalizes hash-like keys/values that differ between machines
212216
const deepSortForComparison = (obj: any): any => {
213217
if (obj === null || obj === undefined) return obj
214218
if (Array.isArray(obj)) {
215-
// Recursively sort array elements, then sort the array itself
216219
const sorted = obj.map(deepSortForComparison)
217-
// Sort arrays by their JSON representation for deterministic ordering
218220
return sorted.sort((a, b) => {
219221
const aStr = JSON.stringify(a) ?? ''
220222
const bStr = JSON.stringify(b) ?? ''
221223
return aStr.localeCompare(bStr)
222224
})
223225
}
224226
if (typeof obj === 'object') {
227+
const keys = Object.keys(obj)
228+
const hasHashKeys = keys.some(isHashLike)
229+
230+
if (hasHashKeys) {
231+
// For objects with hash-like keys, convert to a sorted array of values
232+
// so that different hash keys with same values still match
233+
const entries = keys.map(k => deepSortForComparison(obj[k]))
234+
return entries.sort((a, b) => {
235+
const aStr = JSON.stringify(a) ?? ''
236+
const bStr = JSON.stringify(b) ?? ''
237+
return aStr.localeCompare(bStr)
238+
})
239+
}
240+
225241
const sorted: Record<string, any> = {}
226-
for (const key of Object.keys(obj).sort()) {
242+
for (const key of keys.sort()) {
227243
sorted[key] = deepSortForComparison(obj[key])
228244
}
229245
return sorted
230246
}
247+
// Normalize hash-like string values to a placeholder
248+
if (typeof obj === 'string' && isHashLike(obj)) {
249+
return '<HASH>'
250+
}
231251
return obj
232252
}
233253

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stream44.studio/t44",
3-
"version": "0.4.0-rc.27",
3+
"version": "0.4.0-rc.28",
44
"license": "LGPL",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)