mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 09:07:40 +00:00
Sweeps the triage-only backlog: 2,269 files that earlier waves saw and skipped for size, reconstructed from the unread lists five waves of auditors disclosed. 35 case declarations removed across 15 files, 2 test files deleted, 487 lines gone. No production file touched. These are large integration suites, so the junk here is individual cases buried among real coverage rather than whole bad files. The dominant defect was again a case whose input cannot reach the behavior its title names: - `resume-sleeping-agent-session-remote-compat.test.ts` (deleted) — two cases titled for "transport-level host authority on a capable host" and "host authority is not known". `resume-sleeping-agent-session.ts` has no host-authority or capability concept at all, and its only read of `origin` is `if (!record.origin && record.state === 'done')`, unreachable for both rows. Both executed one identical path. The surviving contract is owned by `resume-sleeping-agent-session-execution-host-scope.test.ts`, which drives a real host catalog. - `project-group-header-drag.test.ts` (deleted) — four cases setting `data-project-group-header-id`, which the predicate never reads. Its subject, `isProjectGroupHeaderActionTarget`, is byte-identical to `isRepoHeaderActionTarget` apart from the function name and imports the same `REPO_HEADER_ACTION_SELECTOR`, so all four cases were a strict subset of `project-header-drag.test.ts` using identical `data-repo-header-*` fixtures. - `remote-worktree-history-cleanup.test.ts` — "repeats idempotent cleanup through the PTY owner" against a six-line best-effort forward with zero dedupe state. The case called it twice and asserted the mock recorded two calls, which is arithmetic over the test's own loop; nothing about idempotence was established. Also removed: - Runtime assertions of type-level facts, where production already makes the check at a stronger boundary: `const adapterSatisfiesPort: AdapterIsPort = true` followed by `expect(...).toBe(true)` — unconditionally true, while `createExpoGenerationFileSystem(): GenerationFileSystem` is explicitly annotated and passed into `createGenerationStore` at a typed call site. And a case named "does not typecheck" whose runtime assertion is a length check on its own literal, declaring its own local annotation so it could never notice the production annotation weakening. - Private predicate tests duplicated at a real boundary: four `repo-slug-cache` cases delivered by `repo-slug-index.test.ts`, which drives the same resolution through the hook, the real store and the preload bridge, while the cache-level versions hand-seed the internal map and break on a cache-key format change. - Duplicate invocations owned at the shared boundary, including commit and push recovery cases owned by `src/shared/source-control-recovery-agent-command.test.ts`. Kept deliberately, verified rather than assumed: the production duplication behind the deleted drag test was left alone, because `REPO_HEADER_ACTION_SELECTOR` ends in generic `button, a, input, textarea, select`, so genuine action targets inside a group header still match — it is an unspecialised copy-paste, not a live bug, and collapsing two functions is a refactor. Reported instead. Auditors' probes produced 20, 11 and 13 candidate hits for the signature-versus-title shape across their chunks; every one was inspected and every one was genuine coverage. No deletion in this wave rests on a probe alone. Coverage is partial and stated as such: of 2,269 files, roughly 100 were read case-by-case and the remainder reviewed at title-plus-import level. Each auditor listed its own unread set. The largest remaining surfaces are `src/main/agent-hooks` (95), `src/main/claude` (100), `src/renderer/src/lib/pane-manager` (62) and the 20 largest sidebar suites. Verified: 2,583 desktop test files / 25,636 cases pass, plus one pre-existing `it.fails` marker; the two modified mobile files pass (57 cases); `check-reliability-gates.mjs` 140 gates; `check:code-quality:changed` 0 new findings. Both deleted files confirmed absent from the gate manifest, `cloud/package.json` and `mobile/tests-typecheck-baseline.txt`.
152 lines
4.8 KiB
TypeScript
152 lines
4.8 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { eventSchemas } from './telemetry-events'
|
|
|
|
describe('setup script prompt schemas', () => {
|
|
it('accepts a bucketed candidate prompt exposure', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_shown.safeParse({
|
|
mode: 'import_available',
|
|
provider: 'codex',
|
|
file_count_bucket: '1',
|
|
unsupported_field_count_bucket: '2-3',
|
|
has_shared_hooks: false
|
|
})
|
|
expect(parsed.success).toBe(true)
|
|
})
|
|
|
|
it('accepts configure prompt actions without a provider', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_action.safeParse({
|
|
action: 'configure_clicked',
|
|
mode: 'configure_needed',
|
|
file_count_bucket: '0',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: true
|
|
})
|
|
expect(parsed.success).toBe(true)
|
|
})
|
|
|
|
it.each([
|
|
'save_detected_setup_clicked',
|
|
'save_detected_setup_completed',
|
|
'save_detected_setup_failed'
|
|
])('accepts %s detected setup save actions', (action) => {
|
|
const parsed = eventSchemas.setup_script_prompt_action.safeParse({
|
|
action,
|
|
mode: 'import_available',
|
|
provider: 'package-manager',
|
|
file_count_bucket: '2-3',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: false,
|
|
edited_before_save: true
|
|
})
|
|
expect(parsed.success).toBe(true)
|
|
})
|
|
|
|
it('rejects detected setup save actions without edit state', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_action.safeParse({
|
|
action: 'save_detected_setup_completed',
|
|
mode: 'import_available',
|
|
provider: 'package-manager',
|
|
file_count_bucket: '2-3',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: false
|
|
})
|
|
expect(parsed.success).toBe(false)
|
|
})
|
|
|
|
it('rejects detected setup save actions for non-package-manager imports', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_action.safeParse({
|
|
action: 'save_detected_setup_completed',
|
|
mode: 'import_available',
|
|
provider: 'codex',
|
|
file_count_bucket: '1',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: false,
|
|
edited_before_save: false
|
|
})
|
|
expect(parsed.success).toBe(false)
|
|
})
|
|
|
|
it('rejects unknown setup import providers', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_shown.safeParse({
|
|
mode: 'import_available',
|
|
provider: 'made_up_tool',
|
|
file_count_bucket: '1',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: false
|
|
})
|
|
expect(parsed.success).toBe(false)
|
|
})
|
|
|
|
it('rejects candidate prompt exposure without a provider', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_shown.safeParse({
|
|
mode: 'import_available',
|
|
file_count_bucket: '1',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: false
|
|
})
|
|
expect(parsed.success).toBe(false)
|
|
})
|
|
|
|
it('rejects configure prompt actions with a provider', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_action.safeParse({
|
|
action: 'configure_clicked',
|
|
mode: 'configure_needed',
|
|
provider: 'codex',
|
|
file_count_bucket: '0',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: false
|
|
})
|
|
expect(parsed.success).toBe(false)
|
|
})
|
|
|
|
it('rejects edit state on non-save actions', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_action.safeParse({
|
|
action: 'configure_clicked',
|
|
mode: 'configure_needed',
|
|
file_count_bucket: '0',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: false,
|
|
edited_before_save: true
|
|
})
|
|
expect(parsed.success).toBe(false)
|
|
})
|
|
|
|
it('rejects raw setup import details via .strict()', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_action.safeParse({
|
|
action: 'import_completed',
|
|
mode: 'import_available',
|
|
provider: 'codex',
|
|
file_count_bucket: '1',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: false,
|
|
files: ['.codex/environments/environment.toml'],
|
|
setup: 'npm install'
|
|
})
|
|
expect(parsed.success).toBe(false)
|
|
})
|
|
|
|
it('rejects unknown setup prompt actions', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_action.safeParse({
|
|
action: 'save_detected_setup_cancelled',
|
|
mode: 'configure_needed',
|
|
file_count_bucket: '0',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: false
|
|
})
|
|
expect(parsed.success).toBe(false)
|
|
})
|
|
|
|
it('rejects legacy generation setup action names', () => {
|
|
const parsed = eventSchemas.setup_script_prompt_action.safeParse({
|
|
action: 'generate_setup_clicked',
|
|
mode: 'import_available',
|
|
provider: 'package-manager',
|
|
file_count_bucket: '2-3',
|
|
unsupported_field_count_bucket: '0',
|
|
has_shared_hooks: false,
|
|
edited_before_save: false
|
|
})
|
|
expect(parsed.success).toBe(false)
|
|
})
|
|
})
|