mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 00:02:29 +00:00
* Prevent main-process crash on huge git status output git status on a repo with an enormous un-ignored folder could emit a listing large enough that buffering it into one string exceeded V8's max string length, throwing an uncatchable RangeError inside Node's execFile exit handler and crashing the main process (and blocking mobile). The runner also forwarded an undefined maxBuffer straight to execFile, which silently disabled the cap entirely. - runner: apply a non-bypassable default maxBuffer so no git call can buffer without a bound. - status: stream porcelain-v2 output through an incremental parser and kill git the moment the changed-entry count crosses a limit (default 10,000); skip numstat/upstream probe when limited. Apply the same limit to the relay/SSH status path. - UX: surface a 'too many changes' state, pause auto status polling while a repo is over the limit, and offer to .gitignore a detected huge folder. Co-authored-by: Orca <help@stably.ai> * Address review: validate inputs, fix stream decoding, localize copy - huge-folder-ignore: restrict folderName to the known-folder allowlist before writing .gitignore (reject path-sep/newline injection). - gitStreamStdout: decode stdout/stderr with StringDecoder so multibyte UTF-8 split across chunk boundaries isn't corrupted; flush on cleanup. - gitStreamStdout: wrap the onStdout callback in try/catch so a throwing parser rejects the promise instead of crashing the main process. - status/relay: validate the status limit as a non-negative integer. - SourceControl: localize the 'too many changes' banner and the .gitignore warning toast via translate() with placeholder params. Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
7 lines
438 B
TypeScript
7 lines
438 B
TypeScript
// Why: git status is capped at this many changed-file entries. A repo with an
|
|
// enormous un-ignored folder can otherwise emit a listing large enough to crash
|
|
// the process when buffered. When the cap is hit the source-control view shows a
|
|
// "too many changes" state instead of the full list. Shared so the local path,
|
|
// the relay/SSH path, and the renderer agree on the same threshold.
|
|
export const DEFAULT_GIT_STATUS_LIMIT = 10_000
|