Skip to content

refactor(shared): drop the shared/types barrel and import from the real modules - #14447

Merged
nwparker merged 1 commit into
mainfrom
nwparker/remove-shared-types-barrel
Aug 14, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/remove-shared-types-barrel

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Follow-up to #14397, which split shared/types.ts into 46 per-domain modules but kept the path as a re-export barrel so import sites didn't have to change. This removes the barrel entirely — every consumer now imports from the module that actually declares the type, and src/shared/types.ts is deleted.

Barrels hide where a type lives, make every consumer look like it depends on the whole domain, and let an unrelated edit invalidate a module that ~2,000 files transitively import.

2,321 import declarations across 2,319 files. Rewritten mechanically: each specifier resolved to an absolute path via the TypeScript AST and recomputed, rather than string-substituted — so alias forms (@/../../shared/types) and per-specifier type modifiers survive.

Three cases the mechanical pass had to handle

Each was caught by a gate, not by reading the diff — worth noting since the diff is too large to eyeball:

  1. Modules inside src/shared import the barrel as ./types, not shared/types. A pre-filter on the latter string skipped 176 of them and left imports dangling at a deleted file. That surfaced as a wall of confusing Property 'x' is optional in type 'Repo' but required in Pick<Repo, ...> errors — not "module not found".
  2. The barrel renamed a type on the way through — export type { WorkspaceSource as WorkspaceCreateTelemetrySource } — so the original name in the owning module has to be re-aliased at every consumer.
  3. ASI footgun. Three test files put ;(globalThis as ...) on the line after the import. TypeScript parses that ; as the import statement's terminator, so replacing through statement.getEnd() deletes it and breaks parsing. The rewrite now stops at the module specifier.

Two files hit 301 counted lines

Splitting one barrel import into several genuinely adds lines. Neither gets a max-lines bypass:

  • terminal-layout-pty-ownership.ts — wrapped 4-line import compacted into two single-line imports.
  • visible-worktrees.ts — dropped its own mini-barrel re-export of isDefaultBranchWorkspace, repointing the four real consumers at the declaring module. (Fittingly, one fewer barrel.)

Verification

  • Cold tsc --noEmit green on node, cli, and web — the complete gate here, since every wrong path or name is a compile error. Buildinfo deleted first: these projects are composite: true and will report a stale cached pass.
  • oxlint clean; max-lines ratchet OK at 344.
  • Full suite: 51,750 passed. The only 2 failures are src/relay/agent-exec-handler.test.ts, which asserts every ambient env var reaches the child and so fails in any terminal already exporting Git's indexed-config protocol — unrelated to this change, fixed in fix(test): deflake relay exec env, project boundary, and speech resume tests #14446.
  • Only deletion in the diff is src/shared/types.ts itself; zero test files removed.

Review note

Unreviewable line-by-line by design. The guarantee is that tsc cannot pass if any of the 396 names resolved to the wrong module. The parts worth a human look are the two 301-line fixes above and the WorkspaceCreateTelemetrySource re-aliasing.

@greptile-apps

greptile-apps Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Too many files changed for review (2323 files, 100 file limit).

@nwparker
nwparker force-pushed the nwparker/remove-shared-types-barrel branch 2 times, most recently from 6562dfa to e560283 Compare August 14, 2026 05:21
@nwparker

Copy link
Copy Markdown
Contributor Author

CI caught a real defect in the rewriter — fixed

static analysis failed on audit:code-quality:native, which runs import/no-duplicates with --deny-warnings. My local check ran plain oxlint and missed it. Now verified with the full pnpm lint, which is what CI actually runs.

Root cause (5 files): the rewriter grouped names within one import declaration, but a file that already imported directly from a module — e.g. shared/git-status-types — got a second import from it, because the barrel re-exported those same names. Added a post-pass that merges declarations sharing a specifier and type-only-ness. The import type {...} + import {...} pair from one module is explicitly left alone, since that form is allowed by the rule and already exists on main.

terminal-layout-pty-ownership.ts — proper fix, not a workaround. My earlier trick of splitting its wrapped import into two single-line imports was itself one of the 5 duplicate violations. The file sits at 301 counted lines only because a 107-char import must wrap; collapsing either local type onto one line doesn't fit either (101 and 116 chars), and contorting a type declaration to hit a line budget is the wrong fix.

Instead, collectLeafIds and pruneLeaves — pure structural operations on the layout tree, independent of PTY ownership — move to terminal-pane-layout-tree.ts. That's a genuine separation of concerns and drops the file well under budget. No max-lines bypass added.

Re-verified

  • Full pnpm lint — clean end to end (native + type-aware audits, reliability gates, ratchet, localization).
  • Cold tsc --noEmit green on node, cli, web (buildinfo deleted first).
  • max-lines ratchet OK at 344.
  • The 5 tests covering the split module: 41 passed.

…al modules

#14397 split `shared/types.ts` into 46 per-domain modules but kept the path as
a re-export barrel so the import sites did not have to change. This removes
the barrel: every consumer now imports from the module that actually declares
the type, and `src/shared/types.ts` is deleted.

Barrels hide where a type lives, make every consumer look like it depends on
the whole domain, and let an unrelated edit invalidate a module that ~2,000
files transitively import.

2,323 import declarations across 2,321 files. Rewritten mechanically: each
specifier was resolved to an absolute path via the TypeScript AST and
recomputed, rather than string-substituted, so alias forms (`@/../../shared/
types`) and per-specifier `type` modifiers survive.

Four cases the mechanical pass had to handle, each found by a gate rather than
by reading the diff:

- Modules inside `src/shared` import the barrel as `./types`, not
  `shared/types`. A pre-filter on the latter string skipped 176 of them and
  left imports dangling at a deleted file, which surfaced as confusing
  `Property 'x' is optional in type 'Repo' but required in Pick<Repo, ...>`
  errors rather than "module not found".
- The barrel RENAMED one type on the way through
  (`WorkspaceSource as WorkspaceCreateTelemetrySource`), so the original name
  in the owning module has to be re-aliased at each consumer.
- Three test files put `;(globalThis as ...)` on the line after the import.
  TypeScript parses that `;` as the import statement's terminator, so
  replacing through `statement.getEnd()` deletes it and breaks ASI. The
  rewrite now stops at the module specifier.
- A file that already imported directly from a module got a SECOND import
  from it, because the barrel re-exported those same names — which trips
  `import/no-duplicates` under `--deny-warnings`. A post-pass merges
  declarations sharing a specifier and type-only-ness; the `import type` plus
  `import` pair from one module is left alone, since that form is allowed.

Splitting one barrel import into several genuinely adds lines, which pushed
`terminal-layout-pty-ownership.ts` to 301 counted lines: its 107-character
import must wrap, and neither local type collapses onto one line (101 and 116
characters). Rather than contort a type declaration to fit a line budget,
`collectLeafIds` and `pruneLeaves` move to `terminal-pane-layout-tree.ts` —
they are pure structural operations on the layout tree and independent of PTY
ownership. `visible-worktrees.ts` similarly loses its own mini-barrel
re-export of `isDefaultBranchWorkspace`, with the four real consumers
repointed at the declaring module. No `max-lines` bypass added.

Verified: cold `tsc --noEmit` green on node, cli, and web (buildinfo deleted
first — these projects are `composite: true` and reuse stale caches); the full
`pnpm lint` green, not just bare oxlint — the narrower local check is what let
the duplicate imports reach CI; max-lines ratchet OK at 344.
@nwparker
nwparker force-pushed the nwparker/remove-shared-types-barrel branch from e560283 to bcc2cd4 Compare August 14, 2026 05:27
@nwparker
nwparker merged commit 77f23b0 into main Aug 14, 2026
54 checks passed
nwparker added a commit that referenced this pull request Aug 14, 2026
…emoval

Upstream #14447 dropped the shared/types barrel; GitDiffResult now lives in
git-diff-compare-types and GlobalSettings in global-settings-types.

Co-authored-by: Orca <help@stably.ai>
nwparker added a commit that referenced this pull request Aug 14, 2026
…budget (#14160)

* fix(runtime): cap remote git.diff and file previews at the transport budget

A remote or mobile user who opens the diff of a large image loses their whole
WebSocket, not just that request: the E2EE channel closes with 1013 when a reply
exceeds the 4 MiB outbound envelope. Two producers can exceed it unaided.

git.diff/branchDiff/commitDiff cap text with MAX_RENDERED_DIFF_COMBINED_CHARACTERS
(6M chars) -- a *renderer* budget that sits above the transport limit -- and return
base64 for previewable binaries bounded only by MAX_GIT_SHOW_BYTES, so a 10 MiB PNG
changed in place is ~26.7 MiB in one envelope. files.readPreview inlines base64 up
to 10 MiB, and mobile calls it for every image tab.

Both now measure against a budget derived from the outbound limit. The check sits in
orca-runtime-git.ts, downstream of the dedupe and of both the SSH-provider and local
branches, so a payload forwarded verbatim by an old relay is covered by the same code
and src/relay needs no change. Local and in-process callers pass no budget and keep
full fidelity.

Measuring raw bytes would not work, which is the whole reason this needs a module.
JSON escaping turns one control byte into six (\u00XX), and binary-buffer.ts sniffs
only for NUL in the first 8 KiB -- so a NUL-free file of 0x01-0x1f bytes is classified
as *text*, would pass a raw-byte cap, and would then blow the envelope. The budget is
escape-aware, with a three-branch fast path that keeps normal diffs at two native
byteLength calls and scans only the ambiguous band.

The SSH branch of readFileExplorerPreview had the same raw-vs-escaped gap: its stat
gate sizes base64 binaries, but text crossed unbounded. It now honours the same
decoded-text limit the local branch already enforced.

No wire change: GitDiffResult is untouched -- no third kind, no new field. Old clients
see an error for one request instead of a dropped connection. diff_too_large joins the
structured passthrough codes and lands on an existing error arm in both mobile
consumers and the desktop remote path; file_too_large was already handled on both.

Instruments the 1013 close, which nothing measured before, so the incidence this cap
is meant to drive to zero is finally observable. `emitter` separates a producer size
bug from a wedged link.

Known regression: remote image previews between ~3.096 and ~3.146 MB now return
file_too_large. They only intermittently worked before -- above ~3.0 MB they killed
the socket -- so this trades intermittent connection loss for a consistent error.

Test: 10281 passed in src/main/runtime + src/shared + src/main/git; mobile 3427
passed. Each of the six budget-enforcement sites is independently mutation-killed.
Escaping fixtures cover newline-dense, control-char, CJK, lone-surrogate and base64
content against native JSON.stringify. tsc clean for node, web and cli; oxlint clean.

Co-authored-by: Orca <help@stably.ai>

* fix(runtime): harden remote reply transport budgets

* test(runtime): cover desktop remote preview budgets

* test(runtime): close telemetry review gaps

* chore(shared): repoint budget imports after the shared/types barrel removal

Upstream #14447 dropped the shared/types barrel; GitDiffResult now lives in
git-diff-compare-types and GlobalSettings in global-settings-types.

Co-authored-by: Orca <help@stably.ai>

* fix(ssh): surface an over-cap preview read as file_too_large

The stream reader aborts an over-cap read with StreamProtocolError, whose numeric
code falls through mapRuntimeError to a generic runtime_error carrying the raw
"Reported totalSize N exceeds client cap M" string. Neither preview client
recognizes that: runtime-file-client.ts and mobile-file-preview-response.ts both
key on file_too_large. It also made the two file_too_large guards directly below
the read unreachable on the streaming path.

Gives the cap its own error type so the caller can translate it, keeping the
bandwidth saving the cap exists for. A genuine protocol fault still propagates
unmasked.

Found by the readiness review. Mutation-verified: removing the translation fails
exactly the new test.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
ifobos added a commit to ifobos/orca that referenced this pull request Aug 14, 2026
Upstream moved twice under this branch:

- `src/shared/types.ts` is gone (stablyai#14447). The two fields this branch added
  (`includeReposInsideGitRepos`, `isSubmodule`) now live in the module that
  declares the types, `shared/project-group-types.ts`, and the five import
  sites this branch owned were repointed — including two `./types` imports
  inside `src/shared` that a `shared/types` grep does not catch.
- `WorktreeCard.tsx` was split into a controller/presentation/surface trio.
  The change-count wiring moved with it: the hook and `hasTrailingRowContent`
  into `use-worktree-card-secondary-details`, the badge, the hover sections
  and `renderIndicatorDetails` into `worktree-card-presentation`, and the
  parent-card hover in `worktree-card-surface`. All three `detailsAfter`
  callers upstream added became `indicatorDetails`.

The store-subscription census test now mounts `useWorktreeChangeCount` in its
composed-hooks probe: the count is a subscription the hook composes, not one it
opens on its own, which is what that test guards.
nwparker added a commit that referenced this pull request Aug 15, 2026
The read owner imported the shared/types barrel deleted by #14447, and its
push-target key hand-enumerated fields, so a new GitPushTarget field would
silently share a lease between two different targets. The destructure now
fails to compile if a field is added. Lease tests moved into their own file
after #14728 split ssh-git-provider.test.ts.
nwparker added a commit that referenced this pull request Aug 15, 2026
The read owner imported the shared/types barrel deleted by #14447, and its
push-target key hand-enumerated fields, so a new GitPushTarget field would
silently share a lease between two different targets. The destructure now
fails to compile if a field is added. Lease tests moved into their own file
after #14728 split ssh-git-provider.test.ts.
nwparker added a commit that referenced this pull request Aug 16, 2026
* perf: coalesce git upstream status reads

* fix(git): repair upstream lease key imports and guard its field list

The read owner imported the shared/types barrel deleted by #14447, and its
push-target key hand-enumerated fields, so a new GitPushTarget field would
silently share a lease between two different targets. The destructure now
fails to compile if a field is added. Lease tests moved into their own file
after #14728 split ssh-git-provider.test.ts.

* test(git): enforce native upstream coalescing in CI

The 10-caller benchmark only runs under ORCA_GIT_UPSTREAM_COALESCING_BENCH_JSON,
so nothing in CI failed when the native/WSL lease was bypassed. Route status.ts
through invalidateGitUpstreamStatusReads so the export has a production caller.
AmethystLiang pushed a commit that referenced this pull request Aug 17, 2026
* perf: coalesce git upstream status reads

* fix(git): repair upstream lease key imports and guard its field list

The read owner imported the shared/types barrel deleted by #14447, and its
push-target key hand-enumerated fields, so a new GitPushTarget field would
silently share a lease between two different targets. The destructure now
fails to compile if a field is added. Lease tests moved into their own file
after #14728 split ssh-git-provider.test.ts.

* test(git): enforce native upstream coalescing in CI

The 10-caller benchmark only runs under ORCA_GIT_UPSTREAM_COALESCING_BENCH_JSON,
so nothing in CI failed when the native/WSL lease was bypassed. Route status.ts
through invalidateGitUpstreamStatusReads so the export has a production caller.
Hihongboyang pushed a commit to Hihongboyang/orca that referenced this pull request Aug 24, 2026
Integrate the user-selected app background image feature. Conflict
resolution notes:

- shared/types barrel was removed upstream (stablyai#14447); our additions moved
  to the real modules: new src/shared/background-image-settings.ts plus
  the two GlobalSettings fields in global-settings-types.ts, and a
  BackgroundImageApi in src/preload/api/background-image-api.ts
- App.tsx was heavily refactored upstream; feature edits (hook call,
  root wallpaper class + style spread) re-applied on the upstream base
- preload/index.ts keeps the auto-merged backgroundImage implementation
- filesystem.test.ts takes upstream's registered-worktree-roots-cache
  import plus our fileListingCancellationError import

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
luisgonzaleznf added a commit to luisgonzaleznf/orca that referenced this pull request Aug 24, 2026
Ports the collections feature across three upstream refactors: the
shared/types barrel drop (stablyai#14447) — Collection type now lives in
shared/collection-types.ts; the worktree-list decomposition (stablyai#14486) —
sidebar integration re-woven into worktree-list/{drag,grouping,listing,
rows,viewport} modules; and the per-domain test split (stablyai#14728) —
web-preload collections coverage moved to its own domain test file.
Splits collection RPC methods out of repo.ts to respect max-lines.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013SqQZ3Ssc7LJnAvacUkVhx
dcieslak19973 added a commit to dcieslak19973/orca that referenced this pull request Aug 30, 2026
The shared/types barrel was removed upstream (stablyai#14447).
trs-80 added a commit to trs-80/orca that referenced this pull request Sep 2, 2026
Rebase of stablyai#7698 (by @kiyeonjeon21) onto current main, which had drifted
1102 commits since the original merge base. Agent behavior is unchanged
from the original PR; only the landing sites moved.

Relocations forced by two refactors on main:

- stablyai#14447 dropped the src/shared/types.ts barrel, so the TuiAgent union
  member moves to src/shared/tui-agent.ts and bobDefaultDisabledMigrated
  moves to src/shared/global-settings-types.ts.
- src/main/persistence.ts is now an 8-line barrel; the three opt-in
  migration hunks move to persistence/loading-store/store.ts.
- stablyai#14728 split the oversized test files, so the Bob detection test moves
  to preflight-agent-detection.test.ts and the disabledTuiAgents tests
  move to persistence-settings-update.test.ts.
- i18n locales and agent-headless-command.ts took both sides of the
  collision with Prime Agent (stablyai#12935).

Co-Authored-By: Kiyeon Jeon <kiyeon.jeon.21@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
trs-80 added a commit to trs-80/orca that referenced this pull request Sep 15, 2026
Rebase of stablyai#7698 (by @kiyeonjeon21) onto current main, which had drifted
1102 commits since the original merge base. Agent behavior is unchanged
from the original PR; only the landing sites moved.

Relocations forced by two refactors on main:

- stablyai#14447 dropped the src/shared/types.ts barrel, so the TuiAgent union
  member moves to src/shared/tui-agent.ts and bobDefaultDisabledMigrated
  moves to src/shared/global-settings-types.ts.
- src/main/persistence.ts is now an 8-line barrel; the three opt-in
  migration hunks move to persistence/loading-store/store.ts.
- stablyai#14728 split the oversized test files, so the Bob detection test moves
  to preflight-agent-detection.test.ts and the disabledTuiAgents tests
  move to persistence-settings-update.test.ts.
- i18n locales and agent-headless-command.ts took both sides of the
  collision with Prime Agent (stablyai#12935).

Co-Authored-By: Kiyeon Jeon <kiyeon.jeon.21@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
trs-80 added a commit to trs-80/orca that referenced this pull request Oct 8, 2026
Rebase of stablyai#7698 (by @kiyeonjeon21) onto current main, which had drifted
1102 commits since the original merge base. Agent behavior is unchanged
from the original PR; only the landing sites moved.

Relocations forced by two refactors on main:

- stablyai#14447 dropped the src/shared/types.ts barrel, so the TuiAgent union
  member moves to src/shared/tui-agent.ts and bobDefaultDisabledMigrated
  moves to src/shared/global-settings-types.ts.
- src/main/persistence.ts is now an 8-line barrel; the three opt-in
  migration hunks move to persistence/loading-store/store.ts.
- stablyai#14728 split the oversized test files, so the Bob detection test moves
  to preflight-agent-detection.test.ts and the disabledTuiAgents tests
  move to persistence-settings-update.test.ts.
- i18n locales and agent-headless-command.ts took both sides of the
  collision with Prime Agent (stablyai#12935).

Co-Authored-By: Kiyeon Jeon <kiyeon.jeon.21@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…al modules (stablyai#14447)

stablyai#14397 split `shared/types.ts` into 46 per-domain modules but kept the path as
a re-export barrel so the import sites did not have to change. This removes
the barrel: every consumer now imports from the module that actually declares
the type, and `src/shared/types.ts` is deleted.

Barrels hide where a type lives, make every consumer look like it depends on
the whole domain, and let an unrelated edit invalidate a module that ~2,000
files transitively import.

2,323 import declarations across 2,321 files. Rewritten mechanically: each
specifier was resolved to an absolute path via the TypeScript AST and
recomputed, rather than string-substituted, so alias forms (`@/../../shared/
types`) and per-specifier `type` modifiers survive.

Four cases the mechanical pass had to handle, each found by a gate rather than
by reading the diff:

- Modules inside `src/shared` import the barrel as `./types`, not
  `shared/types`. A pre-filter on the latter string skipped 176 of them and
  left imports dangling at a deleted file, which surfaced as confusing
  `Property 'x' is optional in type 'Repo' but required in Pick<Repo, ...>`
  errors rather than "module not found".
- The barrel RENAMED one type on the way through
  (`WorkspaceSource as WorkspaceCreateTelemetrySource`), so the original name
  in the owning module has to be re-aliased at each consumer.
- Three test files put `;(globalThis as ...)` on the line after the import.
  TypeScript parses that `;` as the import statement's terminator, so
  replacing through `statement.getEnd()` deletes it and breaks ASI. The
  rewrite now stops at the module specifier.
- A file that already imported directly from a module got a SECOND import
  from it, because the barrel re-exported those same names — which trips
  `import/no-duplicates` under `--deny-warnings`. A post-pass merges
  declarations sharing a specifier and type-only-ness; the `import type` plus
  `import` pair from one module is left alone, since that form is allowed.

Splitting one barrel import into several genuinely adds lines, which pushed
`terminal-layout-pty-ownership.ts` to 301 counted lines: its 107-character
import must wrap, and neither local type collapses onto one line (101 and 116
characters). Rather than contort a type declaration to fit a line budget,
`collectLeafIds` and `pruneLeaves` move to `terminal-pane-layout-tree.ts` —
they are pure structural operations on the layout tree and independent of PTY
ownership. `visible-worktrees.ts` similarly loses its own mini-barrel
re-export of `isDefaultBranchWorkspace`, with the four real consumers
repointed at the declaring module. No `max-lines` bypass added.

Verified: cold `tsc --noEmit` green on node, cli, and web (buildinfo deleted
first — these projects are `composite: true` and reuse stale caches); the full
`pnpm lint` green, not just bare oxlint — the narrower local check is what let
the duplicate imports reach CI; max-lines ratchet OK at 344.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…budget (stablyai#14160)

* fix(runtime): cap remote git.diff and file previews at the transport budget

A remote or mobile user who opens the diff of a large image loses their whole
WebSocket, not just that request: the E2EE channel closes with 1013 when a reply
exceeds the 4 MiB outbound envelope. Two producers can exceed it unaided.

git.diff/branchDiff/commitDiff cap text with MAX_RENDERED_DIFF_COMBINED_CHARACTERS
(6M chars) -- a *renderer* budget that sits above the transport limit -- and return
base64 for previewable binaries bounded only by MAX_GIT_SHOW_BYTES, so a 10 MiB PNG
changed in place is ~26.7 MiB in one envelope. files.readPreview inlines base64 up
to 10 MiB, and mobile calls it for every image tab.

Both now measure against a budget derived from the outbound limit. The check sits in
orca-runtime-git.ts, downstream of the dedupe and of both the SSH-provider and local
branches, so a payload forwarded verbatim by an old relay is covered by the same code
and src/relay needs no change. Local and in-process callers pass no budget and keep
full fidelity.

Measuring raw bytes would not work, which is the whole reason this needs a module.
JSON escaping turns one control byte into six (\u00XX), and binary-buffer.ts sniffs
only for NUL in the first 8 KiB -- so a NUL-free file of 0x01-0x1f bytes is classified
as *text*, would pass a raw-byte cap, and would then blow the envelope. The budget is
escape-aware, with a three-branch fast path that keeps normal diffs at two native
byteLength calls and scans only the ambiguous band.

The SSH branch of readFileExplorerPreview had the same raw-vs-escaped gap: its stat
gate sizes base64 binaries, but text crossed unbounded. It now honours the same
decoded-text limit the local branch already enforced.

No wire change: GitDiffResult is untouched -- no third kind, no new field. Old clients
see an error for one request instead of a dropped connection. diff_too_large joins the
structured passthrough codes and lands on an existing error arm in both mobile
consumers and the desktop remote path; file_too_large was already handled on both.

Instruments the 1013 close, which nothing measured before, so the incidence this cap
is meant to drive to zero is finally observable. `emitter` separates a producer size
bug from a wedged link.

Known regression: remote image previews between ~3.096 and ~3.146 MB now return
file_too_large. They only intermittently worked before -- above ~3.0 MB they killed
the socket -- so this trades intermittent connection loss for a consistent error.

Test: 10281 passed in src/main/runtime + src/shared + src/main/git; mobile 3427
passed. Each of the six budget-enforcement sites is independently mutation-killed.
Escaping fixtures cover newline-dense, control-char, CJK, lone-surrogate and base64
content against native JSON.stringify. tsc clean for node, web and cli; oxlint clean.

Co-authored-by: Orca <help@stably.ai>

* fix(runtime): harden remote reply transport budgets

* test(runtime): cover desktop remote preview budgets

* test(runtime): close telemetry review gaps

* chore(shared): repoint budget imports after the shared/types barrel removal

Upstream stablyai#14447 dropped the shared/types barrel; GitDiffResult now lives in
git-diff-compare-types and GlobalSettings in global-settings-types.

Co-authored-by: Orca <help@stably.ai>

* fix(ssh): surface an over-cap preview read as file_too_large

The stream reader aborts an over-cap read with StreamProtocolError, whose numeric
code falls through mapRuntimeError to a generic runtime_error carrying the raw
"Reported totalSize N exceeds client cap M" string. Neither preview client
recognizes that: runtime-file-client.ts and mobile-file-preview-response.ts both
key on file_too_large. It also made the two file_too_large guards directly below
the read unreachable on the streaming path.

Gives the cap its own error type so the caller can translate it, keeping the
bandwidth saving the cap exists for. A genuine protocol fault still propagates
unmasked.

Found by the readiness review. Mutation-verified: removing the translation fails
exactly the new test.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* perf: coalesce git upstream status reads

* fix(git): repair upstream lease key imports and guard its field list

The read owner imported the shared/types barrel deleted by stablyai#14447, and its
push-target key hand-enumerated fields, so a new GitPushTarget field would
silently share a lease between two different targets. The destructure now
fails to compile if a field is added. Lease tests moved into their own file
after stablyai#14728 split ssh-git-provider.test.ts.

* test(git): enforce native upstream coalescing in CI

The 10-caller benchmark only runs under ORCA_GIT_UPSTREAM_COALESCING_BENCH_JSON,
so nothing in CI failed when the native/WSL lease was bypassed. Route status.ts
through invalidateGitUpstreamStatusReads so the export has a production caller.
trs-80 added a commit to trs-80/orca that referenced this pull request Oct 21, 2026
Rebase of stablyai#7698 (by @kiyeonjeon21) onto current main, which had drifted
1102 commits since the original merge base. Agent behavior is unchanged
from the original PR; only the landing sites moved.

Relocations forced by two refactors on main:

- stablyai#14447 dropped the src/shared/types.ts barrel, so the TuiAgent union
  member moves to src/shared/tui-agent.ts and bobDefaultDisabledMigrated
  moves to src/shared/global-settings-types.ts.
- src/main/persistence.ts is now an 8-line barrel; the three opt-in
  migration hunks move to persistence/loading-store/store.ts.
- stablyai#14728 split the oversized test files, so the Bob detection test moves
  to preflight-agent-detection.test.ts and the disabledTuiAgents tests
  move to persistence-settings-update.test.ts.
- i18n locales and agent-headless-command.ts took both sides of the
  collision with Prime Agent (stablyai#12935).

Co-Authored-By: Kiyeon Jeon <kiyeon.jeon.21@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant