diff --git a/.code-health-baseline.json b/.code-health-baseline.json index 0ea3900b19e..afc1e9e5268 100644 --- a/.code-health-baseline.json +++ b/.code-health-baseline.json @@ -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" } ] } diff --git a/packages/testing/code-health/src/rules/migration-timestamp.rule.ts b/packages/testing/code-health/src/rules/migration-timestamp.rule.ts index c902b09de50..728da85d6d6 100644 --- a/packages/testing/code-health/src/rules/migration-timestamp.rule.ts +++ b/packages/testing/code-health/src/rules/migration-timestamp.rule.ts @@ -46,7 +46,7 @@ export class MigrationTimestampRule extends BaseRule { 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 { 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`; -}