fix(ci): correct TTL fixtures and unused dependencies (#3065)

This commit is contained in:
Hampus
2026-09-30 17:45:07 +02:00
committed by GitHub
parent 710c1aeaa8
commit f5e32aed31
4 changed files with 14 additions and 31 deletions
+1 -4
View File
@@ -11,13 +11,10 @@
}, },
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "catalog:", "@aws-sdk/client-s3": "catalog:",
"@pkgs/cassandra": "workspace:*",
"@fluxer/geo_utils": "workspace:*", "@fluxer/geo_utils": "workspace:*",
"@fluxer/instance_bootstrap": "workspace:*", "@fluxer/instance_bootstrap": "workspace:*",
"@fluxer/ip_utils": "workspace:*", "@fluxer/ip_utils": "workspace:*",
"@pkgs/postgres": "workspace:*", "maxmind": "catalog:"
"maxmind": "catalog:",
"zod": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "catalog:", "@types/node": "catalog:",
@@ -333,6 +333,7 @@ RETURNING updated_at::text`,
await seed('attachment_upload_traces_by_key', 'at-29', '29 days'); await seed('attachment_upload_traces_by_key', 'at-29', '29 days');
await seed('oauth2_access_tokens', 'oa-8', '8 days'); await seed('oauth2_access_tokens', 'oa-8', '8 days');
await seed('donor_magic_link_tokens', 'dm-hour', '1 hour'); await seed('donor_magic_link_tokens', 'dm-hour', '1 hour');
await seed('push_subscriptions', 'ps-day', '1 day');
await seed('jobs_by_id', 'job', '100 days'); await seed('jobs_by_id', 'job', '100 days');
await seed('users', 'user', '100 days'); await seed('users', 'user', '100 days');
await seed('recent_mentions', 'rm-forever', '1 day', 'infinity'); await seed('recent_mentions', 'rm-forever', '1 day', 'infinity');
@@ -346,6 +347,7 @@ RETURNING updated_at::text`,
expect(await remaining()).toEqual([ expect(await remaining()).toEqual([
{table_name: 'attachment_upload_traces_by_key', row_key: 'at-29'}, {table_name: 'attachment_upload_traces_by_key', row_key: 'at-29'},
{table_name: 'jobs_by_id', row_key: 'job'}, {table_name: 'jobs_by_id', row_key: 'job'},
{table_name: 'push_subscriptions', row_key: 'ps-day'},
{table_name: 'recent_mentions', row_key: 'rm-day'}, {table_name: 'recent_mentions', row_key: 'rm-day'},
{table_name: 'recent_mentions', row_key: 'rm-forever'}, {table_name: 'recent_mentions', row_key: 'rm-forever'},
{table_name: 'recent_mentions', row_key: 'rm-hour'}, {table_name: 'recent_mentions', row_key: 'rm-hour'},
@@ -357,13 +359,13 @@ RETURNING updated_at::text`,
expires_at = updated_at + CASE table_name WHEN 'recent_mentions' THEN interval '7 days' WHEN 'attachment_upload_traces_by_key' THEN interval '30 days' ELSE interval '90 days' END AS exact, expires_at = updated_at + CASE table_name WHEN 'recent_mentions' THEN interval '7 days' WHEN 'attachment_upload_traces_by_key' THEN interval '30 days' ELSE interval '90 days' END AS exact,
CASE WHEN row_key = 'rm-day' THEN updated_at = $1::timestamptz END AS unchanged CASE WHEN row_key = 'rm-day' THEN updated_at = $1::timestamptz END AS unchanged
FROM ${KV_TABLE} FROM ${KV_TABLE}
WHERE row_key IN ('rm-day', 'at-29', 'ip-day') WHERE row_key IN ('rm-day', 'at-29', 'ps-day')
ORDER BY row_key`, ORDER BY row_key`,
[mentionWrittenAt], [mentionWrittenAt],
); );
expect(exact.rows).toEqual([ expect(exact.rows).toEqual([
{row_key: 'at-29', exact: true, unchanged: null}, {row_key: 'at-29', exact: true, unchanged: null},
{row_key: 'ip-day', exact: true, unchanged: null}, {row_key: 'ps-day', exact: true, unchanged: null},
{row_key: 'rm-day', exact: true, unchanged: true}, {row_key: 'rm-day', exact: true, unchanged: true},
]); ]);
const untouched = await raw.query<{row_key: string; state: string}>( const untouched = await raw.query<{row_key: string; state: string}>(
@@ -447,18 +449,18 @@ FROM generate_series(1, 2300) g`,
}); });
it('saves where a run stopped and starts the next run there', async () => { it('saves where a run stopped and starts the next run there', async () => {
const first = DEFAULT_TTL_TABLES[0]!.name; const first = DEFAULT_TTL_TABLES[0]!;
const last = DEFAULT_TTL_TABLES.at(-1)!.name; const last = DEFAULT_TTL_TABLES.at(-1)!;
await seed(first, 'a', '1 hour'); await seed(first.name, 'a', `${first.defaultTtlSeconds / 2} seconds`);
await seed(first, 'z', '1 hour'); await seed(first.name, 'z', `${first.defaultTtlSeconds / 2} seconds`);
await seed(last, 'k', '1 hour'); await seed(last.name, 'k', `${last.defaultTtlSeconds / 2} seconds`);
expect(await expireLegacyDefaultTtlRows(raw, Date.now() - 1)).toEqual({deleted: 0, expiring: 0, complete: false}); expect(await expireLegacyDefaultTtlRows(raw, Date.now() - 1)).toEqual({deleted: 0, expiring: 0, complete: false});
expect(await resumePoint()).toEqual({table: first, row_key: '', unset: 0}); expect(await resumePoint()).toEqual({table: first.name, row_key: '', unset: 0});
await raw.query( await raw.query(
`UPDATE ${KV_TABLE} SET row_data = jsonb_build_object('table', $1::text, 'row_key', 'm', 'unset', 0) WHERE table_name = '__fluxer_schema_migrations' AND row_key = $2`, `UPDATE ${KV_TABLE} SET row_data = jsonb_build_object('table', $1::text, 'row_key', 'm', 'unset', 0) WHERE table_name = '__fluxer_schema_migrations' AND row_key = $2`,
[first, DEFAULT_TTL_EXPIRY_RESUME], [first.name, DEFAULT_TTL_EXPIRY_RESUME],
); );
expect(await expireLegacyDefaultTtlRows(raw, Date.now() + 60_000)).toEqual({ expect(await expireLegacyDefaultTtlRows(raw, Date.now() + 60_000)).toEqual({
deleted: 0, deleted: 0,
@@ -467,7 +469,7 @@ FROM generate_series(1, 2300) g`,
}); });
const untouched = await raw.query<{expires_at: Date | null}>( const untouched = await raw.query<{expires_at: Date | null}>(
`SELECT expires_at FROM ${KV_TABLE} WHERE table_name = $1 AND row_key = 'a'`, `SELECT expires_at FROM ${KV_TABLE} WHERE table_name = $1 AND row_key = 'a'`,
[first], [first.name],
); );
expect(untouched.rows).toEqual([{expires_at: null}]); expect(untouched.rows).toEqual([{expires_at: null}]);
expect(await resumePoint()).toBeNull(); expect(await resumePoint()).toBeNull();
+1 -8
View File
@@ -2,14 +2,7 @@
"$schema": "https://unpkg.com/knip@6/schema.json", "$schema": "https://unpkg.com/knip@6/schema.json",
"include": ["files", "exports", "types", "dependencies", "unlisted", "binaries", "catalog"], "include": ["files", "exports", "types", "dependencies", "unlisted", "binaries", "catalog"],
"ignoreExportsUsedInFile": true, "ignoreExportsUsedInFile": true,
"ignoreDependencies": [ "ignoreDependencies": ["@bufbuild/protoc-gen-es", "@tailwindcss/cli", "@types/events", "events", "tailwindcss"],
"@bufbuild/protoc-gen-es",
"@tailwindcss/cli",
"@types/events",
"events",
"fflate",
"tailwindcss"
],
"ignoreFiles": [ "ignoreFiles": [
"fluxer_admin/src/styles/app.css", "fluxer_admin/src/styles/app.css",
"fluxer_admin/static/htmx.min.js", "fluxer_admin/static/htmx.min.js",
-9
View File
@@ -860,18 +860,9 @@ importers:
'@fluxer/ip_utils': '@fluxer/ip_utils':
specifier: workspace:* specifier: workspace:*
version: link:../../../packages/ip_utils version: link:../../../packages/ip_utils
'@pkgs/cassandra':
specifier: workspace:*
version: link:../cassandra
'@pkgs/postgres':
specifier: workspace:*
version: link:../postgres
maxmind: maxmind:
specifier: 'catalog:' specifier: 'catalog:'
version: 5.0.7 version: 5.0.7
zod:
specifier: 'catalog:'
version: 4.6.5
devDependencies: devDependencies:
'@types/node': '@types/node':
specifier: 'catalog:' specifier: 'catalog:'