mirror of
https://github.com/stablyai/orca.git
synced 2026-11-13 17:37:40 +00:00
* chore(ratchets): count sync fs calls on Electron main and setInterval calls
Sync fs on main and fixed-cadence intervals that never settle were two of the
most common perf fix classes since September, and no gate counted them. Both
ratchets grandfather today's uses per file and fail when a file's count grows.
* chore(ratchets): count every sync fs export, src/shared and node:timers intervals
Review: the allow-list missed descriptor/copy APIs, src/shared helpers run on
main too, and setInterval imported from node:timers escaped the timer count.
* chore(ratchets): keep hosted setInterval calls beside a named timer import
Review: a named node:timers import zeroed window/globalThis calls too, a
destructured require was counted twice, and collector edits didn't select
the timer ratchet in check:changed.
* chore(ratchets): charge calls through an alias, not the alias binding
Decider ruling B on review finding C6: binding a plain alias of a gated call
counted as a use, so an alias refactor failed every collector-based ratchet.
Conditional/fallback aliases and exported bindings stay charged.
* chore(ratchets): count bare setInterval only when nothing local shadows it
Review: the timer ratchet kept its own narrower binding resolver, so alias
and namespace-destructure forms of an imported setInterval counted twice.
Module bindings are the shared collector's; a bare call is the global only
when the file declares no setInterval binding.
* chore(ratchets): resolve bare setInterval calls per scope
Decider ruling A: the file-wide shadow rule let an unrelated parameter or type
declaration named setInterval hide every global poll in the file. Each bare
call now resolves through a single-file TypeScript checker (noLib, noResolve)
and counts when it binds to nothing declared in the file.
* chore(ratchets): write the timer baseline exactly as --prune does
* chore(ratchets): charge global timer aliases and bracket access
CodeRabbit: `const schedule = setInterval; schedule(poll)` and
`window['setInterval'](poll)` counted zero. Count value references to the
global timer (per scope) instead of only direct calls.
* chore(ratchets): charge shorthand timer escapes; skip writes, typeof and JSX tags
Review: `{ setInterval }` of the global counted 0, while assignments to it,
parenthesized typeof probes and a <setInterval/> tag counted 1.
* chore(ratchets): charge compound assignments to the global timer
Review: `||=` and `??=` read setInterval before writing it, so only a
plain `=` target is write-only.
* chore(ratchets): regenerate baselines for files main moved
main's SSH reorganisation moved counted files under src/main/ssh and
src/main/managed-server; counts are unchanged except one sync fs call main
removed.
65 lines
4.3 KiB
Markdown
65 lines
4.3 KiB
Markdown
# Performance regression checks
|
|
|
|
`pnpm --silent audit:perf > performance-audit.json` scans production `src/` with
|
|
the existing app-store and buffer-concatenation rules. Warnings are advisory in this full inventory; tool/parser failures fail.
|
|
New findings from rules enabled in the changed-code configuration fail
|
|
`pnpm check:code-quality:changed`.
|
|
|
|
The `app-store-performance/no-whole-hot-map-selector` warning is advisory only:
|
|
it appears in this inventory and the performance-contracts artifact, and its
|
|
findings cannot fail the changed-code gate or other required checks. It catches
|
|
selectors returning the whole `runtimeStatusByEnvironmentId` map, which is
|
|
replaced on meaningful host observations. Select a stable derived answer inside
|
|
the selector (see `paired-runtime-parking-capabilities.ts`). Fleet consumers can
|
|
optionally silence the inventory warning with
|
|
`// oxlint-disable-next-line app-store-performance/no-whole-hot-map-selector -- <why every host is needed>`.
|
|
It resolves direct returns, module-scope named selectors and selector-local const
|
|
aliases/destructuring; it does not infer consumer lifetime or follow imported
|
|
helpers. Legitimate fleet consumers also match, so behavior-level render-isolation
|
|
assertions remain the safeguard against actual fanout regressions.
|
|
|
|
Tests, generated files, `mobile/` and `cloud/` are outside this source audit.
|
|
|
|
The ast-grep rule `config/ast-grep/rules/no-repeated-collator.yml` (`pnpm lint:ast-grep`,
|
|
an error everywhere) detects optioned `localeCompare` and `Intl.Collator` construction
|
|
inside inline `sort`/`toSorted` callbacks. Construct one collator outside the
|
|
callback, preserving locale, options and tie-breakers. If the locale changes at
|
|
runtime, reconstruct at the next sort or key the cache by locale. Bare comparisons
|
|
and standalone equality checks are allowed. There is no autofix or interprocedural
|
|
analysis: named comparators, aliases, custom methods and deferred callbacks need
|
|
manual review. A finding identifies repeated setup, not proof of visible lag.
|
|
|
|
`pnpm test:perf:contracts` runs the explicit selection in
|
|
`vitest.performance.config.ts`: SQLite statement reuse and schema parity, relay
|
|
filesystem concurrency, incremental Codex scans and reader lifetimes, pinned JSONL
|
|
readers and snapshots, linear tool-result pairing and attribution allocation,
|
|
tokenizer rejection, highlighting cache, queued cancellation, terminal backing-memory
|
|
retention and detector fixtures. Missing
|
|
listed files fail configuration loading. Tests run serially, without retries,
|
|
and inherit the full suite's setup and forced-GC support. This makes existing
|
|
regression coverage easy to run and attribute; it does not create new workload
|
|
coverage by itself.
|
|
|
|
Incremental Claude scans and persisted Claude cache checkpoints are also included.
|
|
|
|
`.github/workflows/performance-contracts.yml` runs daily and manually on Linux,
|
|
macOS and Windows, and on PRs changing this tooling or any listed contract file.
|
|
It uploads per-OS JSON test results, plus the source inventory once from Linux
|
|
because that scan is OS-independent. Its schedule starts after merge. Run the existing
|
|
`test:e2e:terminal-perf:scale:report` ([guide](../docs/readme/terminal-perf.md)) for rendered typing/frame budgets. Unit tests do not
|
|
measure SSH RTT, WSL scheduling or a packaged Electron renderer.
|
|
|
|
To extend coverage, select a production-path regression with an operation-count,
|
|
identity, queue-admission or retained-memory oracle. Confirm it fails with the
|
|
old behavior. Use controlled, counterbalanced benchmark samples for timings;
|
|
avoid new machine-dependent millisecond gates in the normal unit suite. A green
|
|
source scan and these contracts cannot establish that the whole app is fast.
|
|
|
|
Two count ratchets (counts per file may only fall) cover classes the audit only warns about:
|
|
`pnpm check:main-sync-fs-ratchet` counts synchronous `node:fs` calls (every `*Sync` export) in production `src/main` and `src/shared`
|
|
(`config/main-sync-fs-baseline.txt`), and `pnpm check:recurring-timer-ratchet` counts `setInterval`
|
|
calls in production `src/main`, `src/renderer`, `src/shared` and `src/cli`
|
|
(`config/recurring-timer-baseline.txt`). Both run in `check:ratchets` on every non-draft PR that runs static analysis. A new use either
|
|
moves off the hot path (async fs or a stat-fingerprint cache; a push signal, a visibility-gated or
|
|
backing-off timer) or raises its file's count with reviewer sign-off.
|