Skip to content

refactor(errors): introduce typed core errors and migrate Git invocation timeouts #4859

Closed

Description

@EffortlessSteven

Parent/controller: #2688.
Existing projection authority to preserve: #2811 (AnalysisFailureKind and LSP/public failure mapping).
Sequence: ERR1 — establish the internal typed boundary with one current matchable error family.

One-PR objective

Introduce the narrow internal typed-error authority needed for semantic control flow, then migrate Git invocation timeout production and consumption away from matching human strings such as error.starts_with("git invocation timed out").

This is not a workspace-wide Result<_, String> rewrite. The PR proves the migration pattern on one current cross-layer family while preserving all public text and behavior.

Current defect

Git timeout meaning is currently recovered from rendered prose across several layers:

Git/process producer returns String
→ analysis/diff consumer checks a prefix
→ fixture and LSP paths check the same prefix
→ public failure mapping is reconstructed from text

A wording change, added context, or unrelated error beginning with the same words can therefore alter control flow. Conversely, wrapping a real timeout can make the prefix disappear.

Required design

Add or extend one small crate-internal error type at the narrowest shared owner, equivalent to:

enum CoreError {
    GitInvocationTimeout { operation: ..., timeout_ms: ..., source: ... },
    // later PR-sized variants only when migrated
}

The exact name and field set should follow current architecture. Requirements:

  • implement std::error::Error and Display without adding a dependency unless current policy clearly prefers one;
  • retain structured source/context sufficient for logs and projection;
  • convert to a display string only at a true human/public compatibility boundary;
  • preserve the existing public wording where it is contractually observed;
  • map the typed timeout into refactor(lsp): type analysis failure kinds #2811's existing git_invocation_timeout failure kind rather than creating a rival vocabulary;
  • keep ordinary Git failures distinct from timeout;
  • keep process ownership, deadline, cancellation and cleanup behavior unchanged.

Migration boundary

Migrate the current applicable producer and consumers, including the equivalents of:

crates/ripr/src/git.rs timeout production
analysis/diff Git loading and fallback decisions
LSP diagnostics/component outcome classification
fixture/test helpers that currently call `is_git_invocation_timeout`

Remove the timeout prefix helper once no production consumer needs it. A test-only compatibility oracle may retain the old text only to prove Display parity.

Do not migrate unrelated Git errors, cancellation, diff-scope overflow, configuration errors, CLI parse errors, or xtask in this PR.

Required controls

  1. A real bounded Git timeout is represented by the typed variant and maps to the same public/LSP failure state as before.
  2. A non-timeout Git command failure remains a non-timeout failure even when its stderr contains similar words.
  3. An unrelated error whose message begins with the legacy timeout prefix cannot trigger timeout control flow.
  4. Adding structured context around a real timeout does not lose its semantic kind.
  5. Source chaining remains inspectable without leaking unbounded command output or private paths.
  6. CLI/human error text, JSON/LSP vocabulary, exit mapping and retry guidance remain byte- or schema-compatible where currently pinned.
  7. Timeout cleanup and child-process terminality remain unchanged.
  8. Removing the typed match and restoring prefix matching makes a discriminating test fail.
  9. Default, no-default and applicable feature builds retain the same public surface.
  10. No broad golden re-bless is accepted merely because errors moved types.

Acceptance

  • One crate-internal typed error authority owns Git invocation timeout meaning.
  • No production timeout decision for this family depends on starts_with, contains, regex, or exact rendered prose.
  • refactor(lsp): type analysis failure kinds #2811 remains the public/LSP projection owner and receives the typed source kind directly.
  • Existing public messages, exit codes, output schemas, retry behavior and process policy do not drift.
  • Focused positive, negative, wrapped-context and lookalike controls are discriminating.
  • The PR records every migrated producer/consumer and every intentionally deferred String boundary.
  • No milestone or release-scope admission is implied.

Proof

cargo test -p ripr --lib git -- --nocapture
cargo test -p ripr --lib analysis::diff -- --nocapture
cargo test -p ripr --lib lsp -- --nocapture
cargo xtask check-output-contracts
cargo xtask check-static-language
cargo xtask check-no-panic-family
cargo xtask check-process-policy
cargo xtask check-architecture
cargo xtask precommit
git diff --check

Use the actual current focused selectors and retain before/after public-message and failure-kind fixtures.

Non-goals

  • No workspace-wide error-library migration.
  • No cancellation or diff-scope-overflow migration; follow-up children own them.
  • No timeout-value, retry, Git command, process runner or LSP lifecycle change.
  • No new public error schema or support-tier claim.
  • No release, publication, credential, secret or settings action.

Claim boundary

Completion makes Git invocation timeout a typed internal fact rather than a convention encoded in prose. It does not establish a complete repository error taxonomy or convert every Result<_, String>.

Activity

  1. added
    status/needs-work
    on Sep 29, 2026
  2. EffortlessSteven commented on Oct 3, 2026

    @EffortlessSteven
    MemberAuthor

    Source integration accepted — 2026-10-04 07:37 UTC

    PR #4882 merged by the normal protected squash path as 2274ebba0eb8fe912e26c57b22f394c9ffe1f87c, tree 2290c9d460f3f037e47a97ebebeae6c77231b9ed, parent 9acf0b6630fc21101baa0bbf52cc872dfe3b08a2. Exact-head review5404866516 binds4bbee and records REVIEW_READY; all five threads are resolved.

    Required run37183446764, worker111380499230 and Result111387090920 passed, including PR evidence. Authentic artifact11296457495 binds actual Linux checkout 610aa05468db695399fd36c6219b02bf24506f96 (tree de24e21647a9a643175783ab7ddd4226fd2ea258, parents83c1+4bbee), Rust1.95,11,612 executed passes and2 native-reported skips. All36 applicable feature-touched controls plus4 integration controls passed; the two Windows-only selectors were not applicable. Doctests:2 passed/1 ignored. ZIP SHA256: 015cabbdc11794f44777d7d3972b629f0e4c0707ce398b6d52c05ac363e654cb.

    Landed verification found18 of20 feature blobs identical to the tested combination. CHANGELOG and first_pr include reviewed later-main additions; all20 feature patches match the tested feature patches apart from hunk locations. The later landed whole tree is source-reviewed composition, not a new execution claim.

    ERR1 is now a typed internal Git-timeout fact through the current analysis/review-comments/LSP consumers, with public String wording, timeout repair guidance and #2811 projection preserved. The actual Linux missing-Git and real missing-base controls pass. Historical2ec/2ee Windows evidence retains its original producer and stimulus limits. The false public-export allegation and external-import test are withdrawn; no new API was exposed.

    Cancellation and oversized-diff follow-ups, Windows actual missing-Git stimulus, installed editor/human/fresh-agent journeys and package/release qualification remain separate. #5285 was closed unmerged by its owner; this PR supplied the accepted implementation. No further ERR1 writer or routine unchanged CI rerun is needed.

    GitHub closed #4859 through the merged PR's existing closing reference. That closes this ERR1 slice; the parent #2688 error-family campaign is not globally complete.

  3. EffortlessSteven commented on Oct 3, 2026

    @EffortlessSteven
    MemberAuthor

    Note: See #5095 (fix(errors): typed CoreError migration (#4882) must preserve the git-timeout repair-route wording).
    When rebasing #4882 onto current main, the GitInvocationTimeout Display / error string must preserve the repair-route guidance added in #4953 (Repair route: raise or disable the git deadline...) rather than shortening it, preserving public message parity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/needs-work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions