[Feature] Code contracts for Maven and Gradle artifacts, and a code consumer at the call site

Open
#6,304 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@veklov is already working on this.

Since Nov 26, 2026.

  • #6472 by @veklov — open

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
12/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
go, java, kotlin, python
Domain
devtools

Research direction

The design starts in workspace/code_api.py, where code contracts are defined and pom.xml is listed as not implemented; read how the entry-file bound works there before proposing an artifact bound. The second part concerns the code consumer built from the import edge, so find where that consumer is created and where per-call information would have to come from. Done would need a decision from maintainers on the artifact bound and the call-site consumer, not only code.

Written by the indexing model from the issue text.

Description

Problem

In a workspace, a provider often ships its own client package. Example: the repository "billing" holds the service and a package "billing-client". The repository "orders" depends on "billing-client" and calls billingClient.charge(order). The HTTP request POST /charges is made inside the package. The same shape occurs when the package sends to a queue or a stream, or reads or writes a store, on behalf of its caller.

The workspace already has the model for this. A package boundary is a contract of the kind "code" (workspace/code_api.py): the repository that ships the package provides its published symbols, and a repository that imports the package consumes them. With it the example is three contracts, and no contract is copied:

  • "orders" consumes the function BillingClient.charge.
  • "billing-client" provides that function, and holds the HTTP consumer for POST /charges.
  • "billing" provides POST /charges.

A walk from "orders" passes over the code link into the function, through the package's own call graph to the HTTP consumer, and from there to the route of "billing". So "orders" is seen as the real caller of "billing", and the steps inside the package stay visible.

Two things stop this from working today:

  1. Code contracts are not built for Maven and Gradle artifacts. code_api.py lists pom.xml as not implemented, because a jar has no entry file that bounds what is published. In a workspace of JVM services with shared client artifacts there is then no code contract at all, and a service that calls another one through a client artifact shows no relation to it.
  2. The code consumer comes from the import edge, so it names the file that imports the symbol. It does not name the function that makes the call, or the line. A walk that starts at one route of "orders" cannot tell whether that route reaches BillingClient.charge or another function of the same file does.

Proposed Solution

  1. Code contracts for Maven and Gradle artifacts, with a bound that takes the place of the entry file. One possible bound: the public symbols of the artifact that another repository of the workspace imports. The surface is then exactly what the workspace uses, and it stays small.
  2. A code consumer at the call site: the file, the line and the symbol that holds the call, for each call of a provided function or method. It can stand beside the consumer per import, or take its place.

The first is specific to the JVM (and the same question may stand for Go, which code_api.py also lists as not implemented). The second does not depend on the language.

Alternatives Considered

Copies of contracts. On a fork, on top of v0.60.1, I built the case another way before I understood code contracts well enough: each HTTP consumer, send, read and write of a package is marked with the public methods that reach it, and each call of such a method in a dependent gets a copy of the contract at the calling line. It works for Java and Kotlin and has tests, but it walks the call graph a second time, hides the steps inside the package, and duplicates what code contracts already say. I do not propose it. I mention it because it shows that the two missing parts above are enough to cover the case, and because parts of it (reading the calls of a dependent on a type of the package) can serve the consumer per call site.

Additional Context

Questions:

  1. Would you take code contracts for Maven and Gradle with a bound like the one above, or do you have another bound in mind?
  2. Would you take a code consumer per call site, beside or in place of the consumer per import?
  3. If yes to either, how would you like the work split for review?

Edited: the first version of this issue proposed the copies of contracts as the solution. I replaced it after reading code_api.py again.

Dominant language
Python
Stars
7.1k
Forks
756
Avg merge
21h 5m
Merged PRs (30d)
797

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from repowise-dev/repowise

All issues in repowise-dev/repowise

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.