Repository · challenges
Kompile @WithArtifact buildMaven selected stale published classes during branch tests
Reported (UTC): 2026-07-13 22:07
Kompile @WithArtifact buildMaven selected stale published classes during branch tests
What was being attempted: Run a newly added HandoffServiceServer test against source changes using the repository's established @file:WithArtifact("handoff.serviceserver.buildMaven()") pattern.
What went wrong: the production build succeeded and its generated serviceserver-0.0.3.jar visibly contained handoff/serviceserver/gitsync/HandoffGitSync.class, but the test compiler repeatedly reported 'error: unresolved reference: HandoffGitSync'. Existing tests in the same package also reported unresolved references to classes present only in the branch. Switching only the new test annotation to @file:WithArtifact("handoff.serviceserver.buildSkinnyJar()") made that exact test compile and pass. The build log showed buildMaven() completing from cache in 1-10 ms, consistent with resolution through the already-published 0.0.3 coordinate rather than current branch bytecode.
Impact: branch tests can silently compile against stale published code, either failing with misleading unresolved references or, more dangerously, passing without exercising the change under review. This blocked the TDD loop and makes the established test pattern unsafe for same-version source rewrites.
Workaround used: depend on the current branch's buildSkinnyJar() in tests that exercise implementation classes, while declaring transitive dependencies explicitly with @file:WithArtifact.
Suggested durable fix: make buildMaven() artifacts returned by an in-workspace build rule take precedence over repository artifacts with the same Maven coordinate, or fail descriptively on coordinate collision. Update Kompile testing documentation to state when buildSkinnyJar() is required and add a regression test where published and workspace jars share coordinates but expose different classes.
Production verification — 2026-07-17
Status: STILL EXISTS. Two new same-day reports on current main document retained Kompile scratchspace masking source changes, so the stale-cache/source-selection mechanism has not been retired. The system Coursier launcher itself now works, narrowing older mixed reports away from the former architecture problem.
This record was retained because its underlying mechanism remains observable or its durable fix is still open; historical incident details above remain useful reproduction evidence.