Skip to content

Keep HTML validation reports available when link checks fail - #304

Merged
mrbean-bremen merged 2 commits into
pydicom:mainfrom
jdotc1:fix/html-link-network-errors-20261021
Oct 26, 2026
Merged

mrbean-bremen merged 2 commits into
pydicom:mainfrom
jdotc1:fix/html-link-network-errors-20261021

Conversation

@jdotc1

@jdotc1 jdotc1 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Describe the changes

Optional HEAD probes for links to the DICOM standard can abort HTML error reporting on network or HTTP failures, and successful or failed probes do not close their connections.

Use contextlib.closing around the HTTPSConnection lifetime, and treat HTTPException/OSError plus the existing ValueError/TypeError failures as an unavailable optional link. Keep the response status boundary at <400 and retain existing parent-section fallback.

Existing HTML rendering tests now use a deterministic optional-link fixture with a fresh reference cache; the RT Series parent-section link assertion is preserved.

No matching open issue was found; this is a directly reproduced bug fix.

Validation

Tested on Linux with Python 3.12.14 and pydicom 3.0.2.

  • Before the fix: 31 failed, exit 1; all failures demonstrate unhandled failures or missing connection cleanup.
  • After the fix: 34 passed: 31 new link-check cases and 3 existing filename-escaping cases.
  • The patch applied cleanly to the stated base and the focused tests passed again there.
  • All applicable pinned pre-commit hooks passed on the changed files.
  • Sphinx HTML documentation built with warnings treated as errors.
  • Additional macOS ARM64/Python 3.12.14 validation: genuine 2015b/2026b standards are available, and all three previously fixture-blocked HTML rendering tests passed (10 other tests deselected).
  • The upstream test matrix passes at 580cca5f on Linux, macOS and Windows.

Compatibility

The handler is explicitly example code. Default socket timeouts, parent-reference retries, positive-reference caching, and HTTPS behavior remain as upstream. A nonresponsive server can still delay reporting; this patch handles errors and resource cleanup, not a new timeout policy.

Tasks

  • Unit tests added that reproduce the issue or prove feature is working
  • Fix added
  • Entry to release notes added
  • Local pre-commit checks pass on changed files
  • Documentation build succeeds
  • Focused regression tests pass
  • Pre-commit CI shows no errors
  • Full upstream unit-test matrix passes

Focused regressions, formatting and documentation checks are reused from the reviewed Linux preparation at the unchanged base. The HTML rendering checks above were completed separately on macOS; the hosted platform-matrix result is recorded above.

@codecov-commenter

codecov-commenter commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.66%. Comparing base (e8644e2) to head (580cca5).
⚠️ Report is 228 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #304      +/-   ##
==========================================
+ Coverage   89.82%   90.66%   +0.83%     
==========================================
  Files          15       21       +6     
  Lines        1632     2131     +499     
==========================================
+ Hits         1466     1932     +466     
- Misses        166      199      +33     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jdotc1

jdotc1 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Merged current main at d62a14c into this PR in 580cca5 and resolved the changelog conflict while retaining both #303's validation-mode fix and this PR's optional-link fix. The original link-check implementation and tests are unchanged.

The existing local validation for this integrated result recorded 84 affected tests passing on Python 3.12/pydicom 3.0.2, including HTML rendering and validation-mode restoration, plus passing pinned pre-commit hooks and a warnings-as-errors documentation build. Those results are reused here; no unchanged local checks were rerun for this upload. Fresh hosted CI has started on the updated branch and is pending.

@mrbean-bremen
mrbean-bremen merged commit 0b46363 into pydicom:main Oct 26, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants