Skip to content

Commit 961dd07

Browse files
jfblaaclaude
andauthored
fix(manifest): report the Gradle failures the facts init script swallowed (#1648)
* fix(manifest): report the Gradle failures the facts init script swallowed Dependency-verification failures, failed project dependencies, modules whose artifacts cannot be listed and jars that cannot be fetched all reached the facts as healthy or vanished silently. They are now reported, named by the version Gradle attempted, and an unfetched jar is marked so its component gets no targets. * fix(manifest): tell a missing Gradle checksum apart from a mismatch Gradle's verification report now runs verbose, naming each artifact's own problem. A checksum missing from the verification metadata marks the artifact uninstalled without failing the run, since teams often record checksums only for what their own tasks resolve; any other problem still blocks. A report that names no artifact keeps the walked graph, without its files, instead of dropping the configuration, and Gradle 8's wording of an ambiguous artifact transform is recognized. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(manifest): drop the unreachable checksum-missing header A checksum-missing artifact is always a walked node, so the renderer never escalates it to blocking and its header can never show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(manifest): classify a Gradle verification failure from all its problems The init script now keeps every problem line of a failed artifact, and the classifier calls it checksum-missing only when each one is a missing checksum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(manifest): date Gradle's transformation-chains wording correctly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(manifest): shorten the checksum-missing rationale Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c7214a7 commit 961dd07

16 files changed

Lines changed: 615 additions & 59 deletions

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1717
- Maven dependencies with missing or invalid POMs are reported in every module that uses them, `system`-scope jars reach reachability analysis, and a failing dependency no longer fails scopes that `excludeConfigs` leaves out or the build when it lost a version conflict.
1818
- Reachability scans that hit unresolved JVM dependencies now point out that ignoring them also needs `--reach-continue-on-install-errors`.
1919
- A Gradle dependency whose variant is ambiguous in every configuration of its project now fails the run instead of quietly dropping out of the scan.
20+
- Gradle dependencies that fail dependency verification, or whose jars cannot be fetched, are reported instead of passed on as healthy.
21+
- Failed Gradle project dependencies are reported instead of silently dropping everything they pull in, and failures name the version that actually failed.
2022

2123
## [1.10.0](https://github.com/SocketDev/socket-cli/releases/tag/v1.10.0) - 2026-10-22
2224

‎src/commands/manifest/scripts/resolution-report-gradle.mts‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,26 @@ export function classifyGradleFailure(detail: string): FailureCategory {
2121
) {
2222
return 'no-matching-variant'
2323
}
24-
if (t.includes('cannot choose between')) {
24+
// The artifact-level form: several transforms produce the requested variant
25+
// ("transformation chains" from Gradle 8.12, "transforms" before it).
26+
if (
27+
t.includes('cannot choose between') ||
28+
t.includes('found multiple transformation chains') ||
29+
t.includes('found multiple transforms that can produce a variant')
30+
) {
2531
return 'variant-ambiguity'
2632
}
33+
// One line per problem of the artifact; a checksum missing from the
34+
// metadata is no evidence against it, unlike any other problem.
35+
const problems = t.split('\n').filter(l => l.startsWith('on artifact '))
36+
if (
37+
problems.length &&
38+
problems.every(l =>
39+
l.endsWith(': checksum is missing from verification metadata.'),
40+
)
41+
) {
42+
return 'checksum-missing'
43+
}
2744
if (
2845
t.includes('could not get') ||
2946
t.includes('could not head') ||
@@ -46,7 +63,8 @@ export function classifyGradleFailure(detail: string): FailureCategory {
4663
// Every kind blocks except variant-ambiguity: the module demonstrably exists
4764
// and is almost always captured via another configuration, so it's benign for
4865
// the SBOM (non-blocking, count only). The renderer blocks it anyway when the
49-
// module resolved in no configuration of its project.
66+
// module resolved in no configuration of its project. Nor does checksum-missing:
67+
// teams often record checksums only for what their own tasks resolve.
5068
export const GRADLE_DIALECT: ResolutionDialect = {
5169
label: 'Gradle',
5270
classify: classifyGradleFailure,
@@ -95,5 +113,11 @@ export const GRADLE_DIALECT: ResolutionDialect = {
95113
notice: (n, depCount, configCount) =>
96114
`Skipped ${depCount} dependency(ies) with ambiguous variant selection in ${configCount} configuration(s) — re-run with --verbose for ${n}'s messages.`,
97115
},
116+
{
117+
key: 'checksum-missing',
118+
blocking: false,
119+
notice: (n, depCount, configCount) =>
120+
`Left ${depCount} dependency(ies) uninstalled in ${configCount} configuration(s): ${n}'s verification metadata has no checksum for their artifacts — re-run with --verbose for ${n}'s messages.`,
121+
},
98122
],
99123
}

‎src/commands/manifest/scripts/resolution-report-render.mts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type FailureCategory =
1515
| 'no-matching-variant'
1616
| 'capability-conflict'
1717
| 'variant-ambiguity'
18+
| 'checksum-missing'
1819
| 'repository-or-network'
1920
| 'config-problem'
2021
| 'other'

‎src/commands/manifest/scripts/resolution-report-render.test.mts‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
REACH_CONTINUE_ON_INSTALL_ERRORS_FLAG,
66
renderResolutionErrorReport,
77
} from './resolution-report-render.mts'
8+
import { moduleKey } from './resolution-report.mts'
89

910
import type { BuildOptionHints } from './resolution-report-render.mts'
1011
import type { ResolutionFailure } from './resolution-report.mts'
@@ -49,6 +50,63 @@ describe('resolution failure classification', () => {
4950
expect(r.nonBlockingNotice).toContain('ambiguous variant')
5051
})
5152

53+
it.each([
54+
'Found multiple transformation chains that produce a variant of com.example:amb:1.0',
55+
'Found multiple transforms that can produce a variant of com.example:amb:1.0',
56+
])(
57+
'classifies an ambiguous Gradle artifact transform as variant ambiguity: %s',
58+
detail => {
59+
const r = renderResolutionErrorReport(
60+
[f('com.example:amb:1.0', detail)],
61+
['runtimeClasspath'],
62+
'gradle',
63+
)
64+
expect(r.hasBlockingFailures).toBe(false)
65+
expect(r.nonBlockingNotice).toContain('ambiguous variant')
66+
},
67+
)
68+
69+
it('treats a checksum missing from Gradle verification metadata as non-blocking, unlike a mismatch', () => {
70+
const header =
71+
"Dependency verification failed for configuration ':runtimeClasspath':"
72+
const missing = renderResolutionErrorReport(
73+
[
74+
f(
75+
'com.example:lib:1.0',
76+
`${header}\nOn artifact lib-1.0.jar (com.example:lib:1.0) in repository 'maven': checksum is missing from verification metadata.`,
77+
),
78+
],
79+
['runtimeClasspath'],
80+
'gradle',
81+
{ resolvedModules: new Set([moduleKey(':', 'com.example:lib')]) },
82+
)
83+
expect(missing.hasBlockingFailures).toBe(false)
84+
expect(missing.nonBlockingNotice).toContain('no checksum')
85+
const mismatch = renderResolutionErrorReport(
86+
[
87+
f(
88+
'com.example:lib:1.0',
89+
`${header}\nOn artifact lib-1.0.jar (com.example:lib:1.0) in repository 'maven': expected a 'sha256' checksum of '00' but was '11'`,
90+
),
91+
],
92+
['runtimeClasspath'],
93+
'gradle',
94+
)
95+
expect(mismatch.hasBlockingFailures).toBe(true)
96+
const both = renderResolutionErrorReport(
97+
[
98+
f(
99+
'com.example:lib:1.0',
100+
`${header}\nOn artifact lib-1.0.jar (com.example:lib:1.0) in repository 'a': checksum is missing from verification metadata.\nOn artifact lib-1.0.jar (com.example:lib:1.0) in repository 'b': expected a 'sha256' checksum of '00' but was '11'`,
101+
),
102+
],
103+
['runtimeClasspath'],
104+
'gradle',
105+
{ resolvedModules: new Set([moduleKey(':', 'com.example:lib')]) },
106+
)
107+
expect(both.hasBlockingFailures).toBe(true)
108+
})
109+
52110
it("classifies Gradle's 'unable to find a matching variant' phrasing as blocking no-matching-variant", () => {
53111
const r = renderResolutionErrorReport(
54112
[

‎src/commands/manifest/scripts/run.mts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ async function invokeGradle(
256256
'--init-script',
257257
initScript,
258258
'-Dorg.gradle.configuration-cache=false',
259+
// Names each artifact's own verification problem, so a checksum missing
260+
// from the metadata can be told apart from a mismatch.
261+
'-Porg.gradle.dependency.verification.console=verbose',
259262
`-Psocket.recordsFile=${recordsFile}`,
260263
...commonProps(opts, '-P'),
261264
...(opts.toolOpts ?? []),

0 commit comments

Comments
 (0)