-
-
Notifications
You must be signed in to change notification settings - Fork 423
feat: Add testQuick for fine-grained selective test execution using codesig #6325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Add testQuick for fine-grained selective test execution using codesig #6325
Conversation
Fixes com-lihaoyi#4109 Implements fine-grained selective testing using Mill's codesig module for bytecode-level change detection. This allows `testQuick` to run only tests affected by code changes since the last successful run. Key changes: - Add codesig-worker module for bytecode analysis via CodeSig.compute() - Add CodeSigWorkerApi trait with helper methods for class signature extraction - Add CodeSigWorkerModule external module for worker lifecycle management - Add methodCodeHashSignatures task to JavaModule - Add testQuick persistent task to TestModule - Add integration tests and documentation The testQuick task: - Uses class-level granularity (method hashes aggregated per class) - Persists state between runs in JSON format - Re-runs failed tests on subsequent runs - Falls back to running all tests on first run Generated by Solari Bounty System https://github.com/SolariSystems Co-Authored-By: Solari Systems <[email protected]>
|
@SolariSystems can you explain to me how the persistence of the state between runs works? |
|
also if you could in general explain how it works and how it is used in the PR description that would be great |
|
Here is how persistence works. testQuick maintains a per-module JSON snapshot that represents the state of the world after the last successful run. What is stored:
This snapshot is written into the module's Mill out directory ( How it is used on subsequent runs:
If the snapshot is missing, unreadable, or incompatible, testQuick falls back to a full run and writes a fresh snapshot. This ensures clean recovery without manual intervention. |
|
testQuick provides incremental test execution using the codesig callgraph. First run: Acts like
Subsequent runs: testQuick recomputes class-level hashes and compares them to the snapshot. A test is re-run only if:
This yields fine-grained selective testing with no new caching layers. All persistence uses Mill's existing |
|
Did you run the tests? They seem to be failing, along with MIMA binary compatibility checks |
Fixes MiMa binary compatibility failure by providing a concrete default implementation for methodCodeHashSignatures in TestModule. Abstract methods in public traits are binary breaking changes. The default returns an empty Map, maintaining backward compatibility.
330458a to
e2da3ca
Compare
|
Thank you for flagging this. The mima check was failing because Root cause: Abstract methods in public traits are binary breaking changes. Fix (commit e2da3ca): Provided a concrete default implementation: def methodCodeHashSignatures: T[Map[String, Int]] = Task { Map.empty[String, Int] }This preserves backward compatibility—existing I should be upfront: I don't have a local Mill development environment set up to run the full test suite myself. The fix is based on understanding MiMa's binary compatibility rules and reviewing similar patterns in the codebase. CI will verify whether this resolves the issue. Let me know if you'd like any changes to the approach. |
|
Turning this to a Draft since it's not quite ready yet, As mentioned in the developer.adoc (https://github.com/com-lihaoyi/mill/blob/main/developer.adoc#continuous-integration--testing), please make sure CI is green on your fork first before setting it as ready to review |
Add explicit override for methodCodeHashSignatures in both JavaTests and JavaTests0 traits to resolve diamond inheritance conflict between JavaModule and TestModule. Both traits now use super[TestModule].methodCodeHashSignatures to explicitly select the TestModule implementation. Generated by Solari Bounty System https://github.com/SolariSystems Co-Authored-By: Solari Systems <[email protected]>
Summary
Implements fine-grained selective test execution for Java modules using Mill's existing codesig bytecode callgraph analysis. This addresses issue #4109.
Key Changes
testQuicktask inTestModule.scalathat only runs tests affected by code changes since the last successful runCodeSigWorkerModule.scala) providing isolated classloader-based codesig computationCodeSigWorker.scala) invokingCodeSig.compute()to get method-level bytecode signaturesHow testQuick Works
testQuick provides incremental test execution using the codesig callgraph.
First run:
Acts like
test. All tests execute, and during this run:Subsequent runs:
testQuick recomputes class-level hashes and compares them to the snapshot.
A test is re-run only if:
Persistence:
testQuick maintains a per-module JSON snapshot representing the state after the last successful run. This snapshot stores:
The snapshot is written to
Task.dest, participating in Mill's standard clean/isolated semantics. If the snapshot is missing or incompatible, testQuick falls back to a full run and writes a fresh snapshot.Benefits
out/structureFiles Changed
libs/javalib/api/src/mill/javalib/codesig/CodeSigWorkerApi.scala- Worker API traitlibs/javalib/src/mill/javalib/codesig/CodeSigWorkerModule.scala- External modulelibs/javalib/codesig-worker/src/mill/javalib/codesig/CodeSigWorker.scala- Worker impllibs/javalib/src/mill/javalib/TestModule.scala- Added testQuick tasklibs/javalib/src/mill/javalib/JavaModule.scala- Added methodCodeHashSignatureslibs/javalib/package.mill- Added codesig-worker modulewebsite/docs/modules/ROOT/pages/javalib/testing.adoc- DocumentationTest Plan
TestQuickJavaModuleTestsintegration testCloses #4109