feat(ql3): add local run log retention

This commit is contained in:
whyour
2026-08-12 02:57:43 +08:00
parent 308aa75d89
commit 2bfa8ca279
50 changed files with 2752 additions and 85 deletions
@@ -96,6 +96,18 @@ export function createLocalApiRunAttemptLogReadRoute(
if (result.status === 'missing') {
return response(503, { code: 'artifact_unavailable' });
}
if (result.status === 'retired') {
return response(410, {
schema: 'qinglong/run-attempt-log-read-result@v1',
status: 'retired',
projectId: result.projectId,
runId: result.runId,
attemptId: result.attemptId,
retiredAtMs: result.retiredAtMs,
byteLength: result.byteLength,
truncation: result.truncation,
});
}
return response(200, projection(result));
} catch (error) {
if (error instanceof InvalidRunAttemptLogReadError) {
@@ -88,6 +88,31 @@ test('maps pending, masked absence, missing storage and unavailable evidence', a
},
{ statusCode: 503, body: { code: 'artifact_unavailable' } },
],
[
{
status: 'retired',
projectId: 'prj_default',
runId: 'run_123',
attemptId: 'attempt_123',
logArtifactId: `local-${'a'.repeat(30)}`,
retiredAtMs: 30,
byteLength: 42,
truncation: { truncated: 'unknown' },
},
{
statusCode: 410,
body: {
schema: 'qinglong/run-attempt-log-read-result@v1',
status: 'retired',
projectId: 'prj_default',
runId: 'run_123',
attemptId: 'attempt_123',
retiredAtMs: 30,
byteLength: 42,
truncation: { truncated: 'unknown' },
},
},
],
];
for (const [result, expected] of cases) {
const route = createLocalApiRunAttemptLogReadRoute({