Skip to content

test: PR gate rejects untimed urlretrieve/urlopen in workspace scripts #326

Closed

Description

@Jammy2211

Overview

An untimed urlretrieve to hips2fits stalled in ssl.read and hit the 300 s smoke cap (run 34099198772). autolens_workspace#293 fixed it once, and it returned in four scripts within three weeks (fixed again in autolens_workspace#537). Add a durable check so the pattern cannot return.

Plan

  • Add a self-contained step to Heart's reusable smoke-tests.yml PR gate (called by autolens_workspace, autogalaxy_workspace and autofit_workspace) that AST-scans scripts/**/*.py and fails with file:line on any urlretrieve( call, or urlopen( without a timeout.
  • Workspace tests/ are not run by any CI, so the gate lives centrally: one step covers every workspace caller — no per-workspace mirror needed.
  • Heart tests execute the step verbatim against planted offending / clean scripts, and pin its position before the install.
Detailed implementation plan

Affected Repositories

  • PyAutoHeart (primary)

Suggested branch: feature/no-untimed-network-downloads

Implementation Steps

  1. .github/workflows/smoke-tests.yml — new step "Reject untimed network downloads" after "Reject tracked validation output", python3 heredoc, no ${{ }}, honours WORKSPACE_DIR (default workspace).
  2. tests/test_workflow_wiring.py — run the step on fixtures: flags urlretrieve and timeout-less urlopen with file:line; passes keyword/positional timeouts; no-op without scripts/.
  3. Verify the step passes on current main of all three workspaces.

Key Files

  • .github/workflows/smoke-tests.yml
  • tests/test_workflow_wiring.py

Original Prompt

Click to expand starting prompt

Guard every workspace script against untimed network downloads

Type: test · Target: autolens_workspace · Repos: autolens_workspace, autogalaxy_workspace, autofit_workspace, PyAutoHeart

Witness: a repo-level check (pytest or a PyAutoHeart/PyAutoHands lint) fails on any urllib.request.urlretrieve( or urlopen( call without timeout= under scripts/, and passes on current main after autolens_workspace#537 merges.

On 2026-09-07 scripts/multi_dataset/features/imaging_and_point_source/modeling.py timed out at the 300 s smoke cap in PyAutoHeart run 34099198772 because an untimed urlretrieve to hips2fits stalled in ssl.read (CI artifact traceback).

autolens_workspace#293 (commit 3920ed30, 2026-07-19) had fixed the identical defect in scripts/cluster/start_here.py, and it came back in four scripts within three weeks (multi_dataset/.../modeling.py, weak/start_here.py, weak/real_data/a2744.py, weak/features/strong_lensing/a2744.py; fixed in autolens_workspace#537).

Add a durable check so the pattern cannot return: scan scripts/**/*.py in each workspace for urlretrieve( and for urlopen( without a timeout= kwarg, fail with the file:line. Decide where it lives (a workspace test_* file that Heart's PR gate already runs, or a shared PyAutoHands lint that every workspace gate calls) and mirror it to the other workspaces that download data.

Do not add retry logic here; the check is the deliverable.

Activity

  1. Jammy2211 commented on Nov 8, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    Merged in #327 (merge commit 0b49dd7). The reusable smoke-tests.yml PR gate now fails on urlretrieve( or a timeout-less urlopen( under scripts/**/*.py in every workspace that calls it. Both pytest legs (3.12 and 3.13) were green.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions