Skip to content

Commit 8fffa65

Browse files
committed
Clean up
1 parent 293ce08 commit 8fffa65

3 files changed

Lines changed: 2 additions & 63 deletions

File tree

.github/scripts/dependency_age.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ def select_gradle_release(args: argparse.Namespace) -> int:
166166

167167
return emit_selection_result(
168168
label="Gradle",
169-
cutoff=cutoff,
170169
github_output=args.github_output,
171170
candidates=candidates,
172171
not_found_reason=(
@@ -199,7 +198,6 @@ def select_maven_release(args: argparse.Namespace) -> int:
199198

200199
return emit_selection_result(
201200
label=f"{args.group_id}:{args.artifact_id}",
202-
cutoff=cutoff,
203201
github_output=args.github_output,
204202
candidates=candidates,
205203
not_found_reason=(
@@ -282,7 +280,6 @@ def _version_sort_key(version: str) -> tuple:
282280
def emit_selection_result(
283281
*,
284282
label: str,
285-
cutoff: datetime,
286283
github_output: str | None,
287284
candidates: list[Candidate],
288285
not_found_reason: str,
@@ -423,7 +420,7 @@ def revert_lockfiles_to_baseline(
423420

424421
# look up the publish timestamp for a group:artifact:version coordinate in Maven Central
425422
# returns (datetime, None) on success, (None, reason) when the timestamp cannot be determined
426-
# retries once on transient 5xx / network errors; 4xx fails immediately (permanent client error)
423+
# retries once on any error
427424
def resolve_gav_timestamp(
428425
*,
429426
gav: str,
@@ -449,11 +446,6 @@ def resolve_gav_timestamp(
449446
fetch_error = None
450447
break
451448
except urllib.error.HTTPError as exc:
452-
if exc.code < 500:
453-
return None, (
454-
f"Maven Central returned HTTP {exc.code} for {gav}. "
455-
"Add an entry in --metadata-file to bypass."
456-
)
457449
fetch_error = f"Maven Central search failed (HTTP {exc.code})."
458450
except (urllib.error.URLError, TimeoutError, OSError, ValueError):
459451
fetch_error = "Maven Central search was unreachable."

.github/scripts/tests/test_dependency_age.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -180,31 +180,6 @@ def test_keeps_current_version_when_higher_than_eligible(self) -> None:
180180
self.assertEqual(outputs["version"], "4.0.0-beta-3")
181181
self.assertEqual(outputs["published_at"], "")
182182

183-
def test_updates_when_eligible_version_is_higher_than_current(self) -> None:
184-
result = self.run_script(
185-
"select-maven",
186-
"--now",
187-
NOW,
188-
"--group-id",
189-
"org.apache.maven.plugins",
190-
"--artifact-id",
191-
"maven-surefire-plugin",
192-
"--search-response-file",
193-
str(FIXTURES / "surefire-boundary.json"),
194-
"--prerelease-pattern",
195-
"alpha",
196-
"--prerelease-pattern",
197-
"beta",
198-
"--current-version",
199-
"3.5.4",
200-
)
201-
202-
self.assertEqual(result.returncode, 0, result.stderr)
203-
outputs = self.parse_outputs(result.stdout)
204-
self.assertEqual(outputs["found"], "true")
205-
self.assertEqual(outputs["version"], "3.5.5")
206-
self.assertEqual(outputs["published_at"], "2026-04-22")
207-
208183
def test_keeps_current_version_when_no_eligible_version_exists(self) -> None:
209184
result = self.run_script(
210185
"select-gradle",
@@ -303,22 +278,6 @@ def test_reverts_lockfile_when_any_changed_dependency_is_too_new(self) -> None:
303278
self.assertEqual(outputs["reverted_files"], "1")
304279
self.assertEqual((current_dir / "module/gradle.lockfile").read_text(encoding="utf-8"), baseline_content)
305280

306-
def test_reverts_lockfile_when_one_of_multiple_coexisting_versions_is_too_new(self) -> None:
307-
baseline_content = "# lockfile\ncom.typesafe:config:1.3.1=compileClasspath\ncom.typesafe:config:1.4.4=runtimeClasspath\n"
308-
current_content = "# lockfile\ncom.typesafe:config:1.3.1=compileClasspath\ncom.typesafe:config:1.5.0=runtimeClasspath\n"
309-
metadata = {
310-
"com.typesafe:config:1.5.0": "2026-04-24T11:00:00Z", # too new
311-
}
312-
313-
result, current_dir = self.run_validate_lockfiles(
314-
baseline={"module/gradle.lockfile": baseline_content},
315-
current={"module/gradle.lockfile": current_content},
316-
metadata=metadata,
317-
)
318-
319-
self.assertEqual(result.returncode, 0, result.stderr)
320-
self.assertEqual((current_dir / "module/gradle.lockfile").read_text(encoding="utf-8"), baseline_content)
321-
322281
def test_removes_brand_new_lockfile_with_too_new_dependency(self) -> None:
323282
# A brand-new module has no baseline counterpart — the lockfile should be removed.
324283
# So include an unchanged pre-existing lockfile in both baseline and current to satisfy
@@ -358,19 +317,6 @@ def test_reverts_lockfile_when_metadata_lookup_fails(self) -> None:
358317
self.assertIn("::warning", result.stdout)
359318
self.assertEqual((current_dir / "module/gradle.lockfile").read_text(encoding="utf-8"), baseline_content)
360319

361-
def test_fails_when_baseline_has_no_lockfiles_but_current_does(self) -> None:
362-
# empty baseline with lockfiles in current suggests the snapshot step failed
363-
current_content = "# lockfile\ncom.example:lib:1.0.0=runtimeClasspath\n"
364-
365-
result, _ = self.run_validate_lockfiles(
366-
baseline={},
367-
current={"module/gradle.lockfile": current_content},
368-
metadata={},
369-
)
370-
371-
self.assertEqual(result.returncode, 1, result.stderr)
372-
self.assertIn("::error::Baseline has no lockfiles", result.stdout)
373-
374320
def test_exits_cleanly_when_lockfiles_are_identical(self) -> None:
375321
# no changes between baseline and current -> exit 0 with reverted_files=0
376322
content = "# lockfile\ncom.example:lib:1.0.0=runtimeClasspath\n"

.github/workflows/update-gradle-dependencies.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
4646
- name: Snapshot current Gradle lock files
4747
run: |
48+
rm -rf /tmp/gradle-lockfiles-before
4849
mkdir -p /tmp/gradle-lockfiles-before
4950
find . -name 'gradle.lockfile' -print0 | xargs -0 -r cp --parents -t /tmp/gradle-lockfiles-before/
5051

0 commit comments

Comments
 (0)