mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-03 06:24:30 +00:00
feat(runner): replace server-side bash sandbox with remote runner (#530)
* feat(runner): replace server-side bash sandbox with remote runner * fix(runner): address review findings for output bounds, key rotation, defaults, and generated uploads * chore(docker): remove sandbox privileges and env vars from remaining compose files * feat(cli): add runner start with bundled SRT sandboxing (#535) * refactor(agent): expose runner bash without skill gating * feat(cli): add runner start with optional SRT sandboxing * refactor(cli): remove runner Python dependency * feat(cli): bundle SRT and use platform-native runner shells * refactor(cli): delegate runner processes to Execa * chore(cli): upgrade @anthropic-ai/sandbox-runtime to 0.0.83 * feat(cli): discover Bash for Windows runners Use Pi-style Bash discovery and launch behavior, exercise the packaged CLI shell, and wait for pending ZIP metadata reads before closing cancelled downloads. * fix(runner): enforce ownership and safe reconnects Gate dispatch on reconciliation, retain cancellations across disconnects, and stop replaced clients. Guard the single-server runner topology with a database lease. Restage missing generated inputs, report signal exits, and bound generated-file cleanup. * feat(webui): add Korean translations for agent runners * feat(cli): add runner event logging and --verbose flag (#536) * feat(cli): add runner event logging and --verbose flag * fix(cli): log runner capacity rejections accurately and use monotonic duration
This commit is contained in:
@@ -717,6 +717,50 @@ describe('S3Service implementations', () => {
|
||||
expect(keysAll.length).toBe(3)
|
||||
})
|
||||
|
||||
it('lists a nested prefix without scanning unrelated directories', async () => {
|
||||
await localS3.putObject('test-bucket', 'temp/generated/one.jpg', 'one', 3)
|
||||
await localS3.putObject('test-bucket', 'files/unrelated.txt', 'abc', 3)
|
||||
const readDirectory = vi.spyOn(fs.promises, 'readdir')
|
||||
try {
|
||||
await expect(localS3.listObjects('test-bucket', 'temp/generated/')).resolves.toEqual([
|
||||
'temp/generated/one.jpg',
|
||||
])
|
||||
expect(readDirectory.mock.calls.map(([directory]) => directory)).toEqual([
|
||||
path.join(TEST_BASE_PATH, 'test-bucket', 'temp', 'generated'),
|
||||
])
|
||||
readDirectory.mockClear()
|
||||
await expect(localS3.listObjects('test-bucket', 'temp/missing/')).resolves.toEqual([])
|
||||
expect(readDirectory.mock.calls.map(([directory]) => directory)).not.toContain(
|
||||
path.join(TEST_BASE_PATH, 'test-bucket'),
|
||||
)
|
||||
await expect(localS3.listObjects('test-bucket', 'temp/generated/on')).resolves.toEqual([
|
||||
'temp/generated/one.jpg',
|
||||
])
|
||||
} finally {
|
||||
readDirectory.mockRestore()
|
||||
}
|
||||
})
|
||||
|
||||
it('continues listing when a file disappears during a local prefix scan', async () => {
|
||||
const removedKey = 'temp/generated/removed.jpg'
|
||||
const remainingKey = 'temp/generated/remaining.jpg'
|
||||
await localS3.putObject('test-bucket', removedKey, 'old', 3)
|
||||
await localS3.putObject('test-bucket', remainingKey, 'new', 3)
|
||||
const stat = fs.promises.stat
|
||||
const removedPath = path.join(TEST_BASE_PATH, 'test-bucket', removedKey)
|
||||
const statSpy = vi.spyOn(fs.promises, 'stat').mockImplementation(async (target, options) => {
|
||||
if (target === removedPath) await fs.promises.unlink(removedPath)
|
||||
return stat(target, options)
|
||||
})
|
||||
try {
|
||||
await expect(localS3.listObjects('test-bucket', 'temp/generated/')).resolves.toEqual([
|
||||
remainingKey,
|
||||
])
|
||||
} finally {
|
||||
statSpy.mockRestore()
|
||||
}
|
||||
})
|
||||
|
||||
it('should handle headObject correctly', async () => {
|
||||
await localS3.putObject('test-bucket', 'test.txt', 'hello world', 11)
|
||||
const head = await localS3.headObject('test-bucket', 'test.txt')
|
||||
|
||||
Reference in New Issue
Block a user