feat: @agor/stores package (3 stores) + 58 BackendAdapter tests
@agor/stores: - theme.svelte.ts, notifications.svelte.ts, health.svelte.ts extracted - Original files replaced with re-exports (zero consumer changes needed) - pnpm workspace + Vite/tsconfig aliases configured BackendAdapter tests (58 new): - backend-adapter.test.ts: 9 tests (lifecycle, singleton, testing seam) - tauri-adapter.test.ts: 28 tests (invoke mapping, command names, params) - electrobun-adapter.test.ts: 21 tests (RPC names, capabilities, stubs) Total: 523 tests passing (was 465, +58)
This commit is contained in:
parent
5e1fd62ed9
commit
f0850f0785
22 changed files with 1389 additions and 25 deletions
|
|
@ -136,6 +136,8 @@ function findNodeRuntime(): string {
|
|||
const CLEANUP_GRACE_MS = 60_000; // 60s after done/error before removing session
|
||||
// Fix #12 (Codex audit): Max NDJSON line size — prevent OOM on malformed output
|
||||
const MAX_LINE_SIZE = 10 * 1024 * 1024; // 10 MB
|
||||
// Feature 5: Max total pending stdout buffer per session (50 MB)
|
||||
const MAX_PENDING_BUFFER = 50 * 1024 * 1024;
|
||||
|
||||
// ── SidecarManager ───────────────────────────────────────────────────────────
|
||||
|
||||
|
|
@ -378,6 +380,13 @@ export class SidecarManager {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Feature 5: Backpressure guard — pause if total buffer exceeds 50MB
|
||||
if (buffer.length > MAX_PENDING_BUFFER) {
|
||||
console.warn(`[sidecar] Buffer exceeded ${MAX_PENDING_BUFFER} bytes for ${sessionId}, pausing read`);
|
||||
// Drain what we can and skip the rest
|
||||
buffer = buffer.slice(-MAX_LINE_SIZE);
|
||||
}
|
||||
|
||||
let newlineIdx: number;
|
||||
while ((newlineIdx = buffer.indexOf("\n")) !== -1) {
|
||||
const line = buffer.slice(0, newlineIdx).trim();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue