diff --git a/src/cache/lock.ts b/src/cache/lock.ts index 4e5f262..c42c69b 100644 --- a/src/cache/lock.ts +++ b/src/cache/lock.ts @@ -9,12 +9,10 @@ export interface DocsCacheLockSource { fileCount: number; manifestSha256: string; rulesSha256?: string; - updatedAt: string; } export interface DocsCacheLock { version: 1; - generatedAt: string; toolVersion: string; sources: Record; } @@ -54,7 +52,6 @@ export const validateLock = (input: unknown): DocsCacheLock => { if (version !== 1) { throw new Error("Lock file version must be 1."); } - const generatedAt = assertString(input.generatedAt, "generatedAt"); const toolVersion = assertString(input.toolVersion, "toolVersion"); if (!isRecord(input.sources)) { throw new Error("sources must be an object."); @@ -84,12 +81,10 @@ export const validateLock = (input: unknown): DocsCacheLock => { value.rulesSha256 === undefined ? undefined : assertString(value.rulesSha256, `sources.${key}.rulesSha256`), - updatedAt: assertString(value.updatedAt, `sources.${key}.updatedAt`), }; } return { version: 1, - generatedAt, toolVersion, sources, }; diff --git a/src/commands/sync.ts b/src/commands/sync.ts index 018d368..064d02d 100644 --- a/src/commands/sync.ts +++ b/src/commands/sync.ts @@ -221,7 +221,6 @@ const loadToolVersion = async () => { const buildLockSource = ( result: SyncResult, prior: DocsCacheLock["sources"][string] | undefined, - now: string, ) => ({ repo: result.repo, ref: result.ref, @@ -231,7 +230,6 @@ const buildLockSource = ( manifestSha256: result.manifestSha256 ?? prior?.manifestSha256 ?? result.resolvedCommit, rulesSha256: result.rulesSha256 ?? prior?.rulesSha256, - updatedAt: now, }); const buildLock = async ( @@ -239,7 +237,6 @@ const buildLock = async ( previous: Awaited> | null, ) => { const toolVersion = await loadToolVersion(); - const now = new Date().toISOString(); const configSourceIds = new Set( plan.config.sources.map((source) => source.id), ); @@ -253,11 +250,10 @@ const buildLock = async ( } for (const result of plan.results) { const prior = sources[result.id]; - sources[result.id] = buildLockSource(result, prior, now); + sources[result.id] = buildLockSource(result, prior); } return { version: 1 as const, - generatedAt: now, toolVersion, sources, }; diff --git a/tests/edge-cases.test.js b/tests/edge-cases.test.js index b64520a..1d7a210 100644 --- a/tests/edge-cases.test.js +++ b/tests/edge-cases.test.js @@ -222,7 +222,6 @@ test("lock file with invalid version", async () => { const invalidLock = { version: 2, - generatedAt: new Date().toISOString(), toolVersion: "0.1.0", sources: {}, }; @@ -249,7 +248,7 @@ test("lock file with missing required fields", async () => { const invalidLock = { version: 1, - // missing generatedAt, toolVersion, sources + // missing toolVersion, sources }; await writeFile(lockPath, JSON.stringify(invalidLock, null, 2), "utf8"); @@ -259,7 +258,7 @@ test("lock file with missing required fields", async () => { } = await import("node:fs/promises"); const raw = await read(lockPath, "utf8"); const parsed = JSON.parse(raw); - assert.equal(parsed.generatedAt, undefined); + assert.equal(parsed.toolVersion, undefined); }); test("lock file with negative bytes", async () => { @@ -272,7 +271,6 @@ test("lock file with negative bytes", async () => { const invalidLock = { version: 1, - generatedAt: new Date().toISOString(), toolVersion: "0.1.0", sources: { test: { @@ -282,7 +280,6 @@ test("lock file with negative bytes", async () => { bytes: -100, fileCount: 5, manifestSha256: "def456", - updatedAt: new Date().toISOString(), }, }, }; diff --git a/tests/fixtures/docs-lock.json b/tests/fixtures/docs-lock.json index c45932c..d4910a9 100644 --- a/tests/fixtures/docs-lock.json +++ b/tests/fixtures/docs-lock.json @@ -1,6 +1,5 @@ { "version": 1, - "generatedAt": "2026-01-30T12:00:00+01:00", "toolVersion": "0.1.0", "sources": { "vitest": { @@ -10,8 +9,7 @@ "bytes": 123456, "fileCount": 512, "manifestSha256": "abcd", - "rulesSha256": "efgh", - "updatedAt": "2026-01-30T12:00:00+01:00" + "rulesSha256": "efgh" } } } diff --git a/tests/fixtures/empty.docs-lock.json b/tests/fixtures/empty.docs-lock.json index e2c5d66..427341b 100644 --- a/tests/fixtures/empty.docs-lock.json +++ b/tests/fixtures/empty.docs-lock.json @@ -1,6 +1,5 @@ { "version": 1, - "generatedAt": "2026-01-30T12:00:00+01:00", "toolVersion": "0.1.0", "sources": {} } diff --git a/tests/lock.test.js b/tests/lock.test.js index fff11b1..2ed45fe 100644 --- a/tests/lock.test.js +++ b/tests/lock.test.js @@ -42,11 +42,10 @@ test("writeLock produces readable JSON", async (t) => { const tmpPath = path.join(tmpdir(), `docs-lock-${Date.now()}.json`); const lock = { version: 1, - generatedAt: "2026-01-30T12:00:00+01:00", toolVersion: "0.1.0", sources: {}, }; await module.writeLock(tmpPath, lock); const parsed = await module.readLock(tmpPath); - assert.equal(parsed.generatedAt, lock.generatedAt); + assert.deepEqual(parsed, lock); }); diff --git a/tests/sync-materialize.test.js b/tests/sync-materialize.test.js index 99f7d31..da53c7b 100644 --- a/tests/sync-materialize.test.js +++ b/tests/sync-materialize.test.js @@ -230,7 +230,6 @@ test("sync re-materializes when docs missing even if commit unchanged", async () path.join(tmpRoot, DEFAULT_LOCK_FILENAME), JSON.stringify({ version: 1, - generatedAt: new Date().toISOString(), toolVersion: "0.1.0", sources: { local: { @@ -240,7 +239,6 @@ test("sync re-materializes when docs missing even if commit unchanged", async () bytes: 0, fileCount: 0, manifestSha256: "abc123", - updatedAt: new Date().toISOString(), }, }, }), @@ -315,7 +313,6 @@ test("sync offline materializes from cache when lock exists", async () => { path.join(tmpRoot, DEFAULT_LOCK_FILENAME), JSON.stringify({ version: 1, - generatedAt: new Date().toISOString(), toolVersion: "0.1.0", sources: { local: { @@ -325,7 +322,6 @@ test("sync offline materializes from cache when lock exists", async () => { bytes: 0, fileCount: 0, manifestSha256: "abc123", - updatedAt: new Date().toISOString(), }, }, }), diff --git a/tests/sync-offline-fail.test.js b/tests/sync-offline-fail.test.js index d662ce7..296b4e5 100644 --- a/tests/sync-offline-fail.test.js +++ b/tests/sync-offline-fail.test.js @@ -75,7 +75,6 @@ test("sync offline uses lock entries without resolving remotes", async () => { lockPath, JSON.stringify({ version: 1, - generatedAt: new Date().toISOString(), toolVersion: "0.1.0", sources: { local: { @@ -85,7 +84,6 @@ test("sync offline uses lock entries without resolving remotes", async () => { bytes: 4, fileCount: 1, manifestSha256: "abc123", - updatedAt: new Date().toISOString(), }, }, }), @@ -145,7 +143,6 @@ test("sync offline fails when lock exists but cache missing", async () => { lockPath, JSON.stringify({ version: 1, - generatedAt: new Date().toISOString(), toolVersion: "0.1.0", sources: { local: { @@ -155,7 +152,6 @@ test("sync offline fails when lock exists but cache missing", async () => { bytes: 4, fileCount: 1, manifestSha256: "abc123", - updatedAt: new Date().toISOString(), }, }, }),