mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-20 16:07:11 +08:00
feat(ql3): add local run log retention
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user