Skip to content

Call flow times out on every review in repositories above a few thousand files #4038

Done

Description

@lingechettyr

Problem

Call flow analyzes every supported-language file in both snapshots of a review. The cost scales with repository size, so past a few thousand files every review hits the 45-second limit, whatever the diff contains.

I measured CallDiff 0.6.0 on a monorepo with 70,939 Python files. Parsing runs at roughly 15 ms per file:

Files parsed Wall time
160 3.2 s
640 10.5 s

The union of both snapshots parses once. At that rate, 71,000 files need about 18 minutes. The limit is 45 seconds, which fits roughly 3,000 files. Any repository above that fails on every review.

The changed files are known before the analysis starts. They never narrow the scope.

Proposed solution

Keep full-tree scope as the default. Degrade only when the budget cannot hold.

  1. Count the candidate files before running. The count is already available.
  2. If it fits the budget with margin, run as today. Most repositories are unaffected.
  3. If it does not fit, analyze the changed files only, the union of both sides of the diff, and label the panel so the reader knows the scope ("covers the changed files in this diff").

The scoped run keeps every changed call site and everything inside changed files. It drops the expansion of calls into unchanged files: a newly called helper shows as a leaf instead of unfolding into its body. A diff that touches 40 files completes in about 1.4 seconds.

Optional follow-ups: a second pass that adds the files the changed code calls, and a configurable budget.

Alternatives considered

Raise the timeout. 71,000 files need about 18 minutes. Larger limits just delay the failure.

Always scope to changed files. Makes results worse for the many repositories that fit the budget today.

Run without a limit. Delays results indefinitely and complicates caching and cancellation.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions