[Feature] Code contracts for Maven and Gradle artifacts, and a code consumer at the call site
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
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:
- 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.
- 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
- 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.
- 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:
- Would you take code contracts for Maven and Gradle with a bound like the one above, or do you have another bound in mind?
- Would you take a code consumer per call site, beside or in place of the consumer per import?
- 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
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from repowise-dev/repowise
-
[Bug] Elixir `.formatter.exs`, `.credo.exs`, `config/*.exs` and `priv/**/*.exs` are reported as unreachable filesPossibly taken @ZYZ666-RGB claimed this 1 day ago. Openbug good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
repowise-dev/repowise#6296 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] Coverage stack detection omits Swift, Dart, and Scala, falling through to UNKNOWN in evidence setupPossibly taken @RishabhIIITD claimed this 2 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
repowise-dev/repowise#5838 · 2 comments ·
Maintainers usually reply within 1 day
-
[Bug] PR-mined decisions store the decision sentence again as their rationalePossibly taken @suyashgitt claimed this 11 days ago. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
repowise-dev/repowise#5702 · 2 comments ·
Maintainers usually reply within 1 day
-
[Bug] CICS CSD `DEFINE _PGMLIST` startup programs (`_PGMPH`) are not rootsPossibly taken @dchaudhari7177 claimed this 34 days ago. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
repowise-dev/repowise#4477 ·
Maintainers usually reply within 1 day
-
[Bug] COBOL listing directives EJECT, SKIP1/SKIP2/SKIP3 and TITLE fail to parse and drop the rest of the filePossibly taken @dchaudhari7177 claimed this 34 days ago. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
repowise-dev/repowise#4474 ·
Maintainers usually reply within 1 day
All issues in repowise-dev/repowise
Similar issues
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
kornia/kornia-rs#1416 · 1 comment ·
Maintainers usually reply within 2 days
-
ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PolicyEngine/ai-inequality#64 ·
Maintainers usually reply within 1 day
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timePossibly taken @PabloRoque claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pymc-devs/pymc-extras#839 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day