Skip to content

feat(git): warn about co-change partners missing from diff and PR - #3074

Open
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1791128503-co-change-partners
Open

devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1791128503-co-change-partners

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • tracedecay_diff_context and tracedecay_pr_context now return missing_co_change_partners: files that Git history says usually change with a changed file but are not in the change set. For example, a schema change with no matching migration.

Fixes #3015

Motivation

#3015: agents miss companion edits (migrations, fixtures, generated files) that history says go together.

Changes

  • New crates/tracedecay-runtime-core/src/git/co_change.rs. It mines up to 1,000 non-merge commits with --no-renames and skips bulk commits that touch more than 50 files. A partner is reported only if it still exists in the target tree. Results are ranked deterministically and capped at 20.
    • Change sets with several files: at least 3 co-changes and coupling of at least 50% of the changed file's commits.
    • Single-file change sets use a stricter gate: at least 5 co-changes and at least 75% coupling.
    • A project that is not a Git repository returns an empty list instead of an error.
  • Contracts: new CoChangePartnerV1 { file, partner_of, co_changes, partner_of_changes }. DiffContextResultV1 and all three PrContext*V1 variants (complete, symbols-unavailable, graph-pending) gain a required missing_co_change_partners field.
  • Handlers (handlers/git/context.rs):
    • diff context mines HEAD.
    • PR context mines history up to the merge base and checks that partners exist at head.
  • Regenerated sdks/typescript/src/operations.ts and updated the SDK decode fixtures.

Test plan

  • Behavior test mcp_handler_test::graph_analysis_test::git_context_warns_about_co_change_partners_missing_from_the_change. The fixture repo always changes the schema and its migration together; the feature branch changes the schema without the migration. The test checks the exact partner reported by pr_context and diff_context, and checks that diff_context reports nothing once the migration is in the change set. Before this change the field does not exist, so the test fails.
  • Runtime-core unit tests git::co_change::tests::{a_change_missing_its_usual_companion_is_reported,bulk_commits_do_not_couple_files} (run via scripts/require-exact-test.sh … -- --exact)
  • mcp_suite tests filtered on context (39 passed) and tracedecay-mcp tests filtered on context (49 passed)
  • cargo clippy -p tracedecay-runtime-core -p tracedecay-contracts -p tracedecay-mcp -p tracedecay --features tracedecay/test-transport --all-targets -- -D warnings
  • cargo fmt --all -- --check, pnpm --dir dashboard run contracts:check, SDK vitest (37 passed), python3 scripts/linux-test-partitions.py check
  • Full cargo nextest run --workspace was not run locally; CI will run it

Checklist

  • CHANGELOG.md updated (not done: release-please manages it)
  • No secrets, credentials, or .env files included
  • Breaking changes documented (if any): the new response field is additive

Link to Devin session: https://app.devin.ai/sessions/12af47e87dd44db6a9c72fdc845270da
Open in Devin Desktop: https://app.devin.ai/desktop/session/12af47e87dd44db6a9c72fdc845270da?variant=devin
Requested by: @ScriptedAlchemy


Devin Review

Mine bounded non-merge Git history for files that usually change with a
changed file and report the ones absent from the change set on
tracedecay_diff_context and tracedecay_pr_context. Bulk commits (>50
files) are ignored and single-file change sets need stronger evidence.

Fixes #3015

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@changeset-bot

changeset-bot Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 83f9d15

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

devin-ai-integration[bot]

This comment was marked as resolved.

Co-change mining is enrichment: a failed, cancelled, or timed-out read
now reports co_change_unavailable instead of refusing diff/PR context.
The Git subprocess observes request cancellation and deadline, and paths
stay as bytes so unrelated non-UTF-8 names do not abort the read. Also
rebuild the embedded ChatGPT extension server bundle.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

diff/pr context: warn about co-change partners missing from the diff

1 participant