fix: Stabilize migration-timestamp rule message for baseline hashing (no-changelog) (#30462)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Declan Carroll 2026-05-14 15:05:21 +01:00 committed by GitHub
parent 52f11c4f8c
commit 42887203fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 17 deletions

View File

@ -557,24 +557,24 @@
{
"rule": "migration-timestamp",
"line": 1,
"message": "1783000000000-CreateAgentTables.ts is prefixed with a future timestamp (1783000000000, ~50d ahead of now). Migration prefixes must be the exact Date.now() value at the time of creation — AI agents commonly fabricate future timestamps.",
"hash": "d81428d567aa"
"message": "1783000000000-CreateAgentTables.ts is prefixed with a future timestamp (1783000000000). Migration prefixes must be the exact Date.now() value at the time of creation — AI agents commonly fabricate future timestamps.",
"hash": "6599e9e66680"
}
],
"packages/@n8n/db/src/migrations/common/1783000000001-CreateAgentExecutionTables.ts": [
{
"rule": "migration-timestamp",
"line": 1,
"message": "1783000000001-CreateAgentExecutionTables.ts is prefixed with a future timestamp (1783000000001, ~50d ahead of now). Migration prefixes must be the exact Date.now() value at the time of creation — AI agents commonly fabricate future timestamps.",
"hash": "e33a8a794126"
"message": "1783000000001-CreateAgentExecutionTables.ts is prefixed with a future timestamp (1783000000001). Migration prefixes must be the exact Date.now() value at the time of creation — AI agents commonly fabricate future timestamps.",
"hash": "e55008535c0e"
}
],
"packages/@n8n/db/src/migrations/common/1784000000000-CreateAgentObservationTables.ts": [
{
"rule": "migration-timestamp",
"line": 1,
"message": "1784000000000-CreateAgentObservationTables.ts is prefixed with a future timestamp (1784000000000, ~61d ahead of now). Migration prefixes must be the exact Date.now() value at the time of creation — AI agents commonly fabricate future timestamps.",
"hash": "4bae5ef065ad"
"message": "1784000000000-CreateAgentObservationTables.ts is prefixed with a future timestamp (1784000000000). Migration prefixes must be the exact Date.now() value at the time of creation — AI agents commonly fabricate future timestamps.",
"hash": "5f4857aa8248"
}
]
}

View File

@ -46,7 +46,7 @@ export class MigrationTimestampRule extends BaseRule<CodeHealthContext> {
filePath,
1,
1,
`${fileName} is prefixed with a future timestamp (${timestamp}, ${formatDelta(timestamp - now)} ahead of now). Migration prefixes must be the exact Date.now() value at the time of creation — AI agents commonly fabricate future timestamps.`,
`${fileName} is prefixed with a future timestamp (${timestamp}). Migration prefixes must be the exact Date.now() value at the time of creation — AI agents commonly fabricate future timestamps.`,
"Rename the file using the current millisecond timestamp from Date.now() (or 'date +%s%3N').",
),
);
@ -55,13 +55,3 @@ export class MigrationTimestampRule extends BaseRule<CodeHealthContext> {
return violations;
}
}
function formatDelta(ms: number): string {
const abs = Math.abs(ms);
const days = Math.floor(abs / 86_400_000);
if (days >= 1) return `~${days}d`;
const hours = Math.floor(abs / 3_600_000);
if (hours >= 1) return `~${hours}h`;
const minutes = Math.floor(abs / 60_000);
return `~${minutes}m`;
}