rapidsai / rapidsai/pre-commit-hooks

verify-alpha-spec does not work on pre-commit.ci

Open
#58 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1
Forks
12
Avg merge
33m
Merged PRs (30d)
6

Description

The verify-alpha-spec hook appears to be failing when used with pre-commit.ci. It requires downloading a file from GitHub, which may be against security policy for pre-commit.ci or something like that. Here is the full error log:

verify-alpha-spec........................................................Failed
- hook id: verify-alpha-spec
- exit code: 1

Traceback (most recent call last):
  File "/usr/lib/python3.12/urllib/request.py", line 1344, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.12/http/client.py", line 1336, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1382, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1331, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1091, in _send_output
    self.send(msg)
  File "/usr/lib/python3.12/http/client.py", line 1035, in send
    self.connect()
  File "/usr/lib/python3.12/http/client.py", line 1470, in connect
    super().connect()
  File "/usr/lib/python3.12/http/client.py", line 1001, in connect
    self.sock = self._create_connection(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/socket.py", line 841, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/socket.py", line 976, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/bin/verify-alpha-spec", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_pre_commit_hooks/alpha_spec.py", line 316, in main
    with m.execute() as ctx:
         ^^^^^^^^^^^
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_pre_commit_hooks/lint.py", line 276, in __exit__
    check(linter, self.args)
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_pre_commit_hooks/alpha_spec.py", line 296, in check_alpha_spec
    check_root(linter, args, loader.document_anchors[0], set(), root)
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_pre_commit_hooks/alpha_spec.py", line 260, in check_root
    check_dependencies(linter, args, anchors, used_anchors, root_value)
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_pre_commit_hooks/alpha_spec.py", line 241, in check_dependencies
    check_common(
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_pre_commit_hooks/alpha_spec.py", line 183, in check_common
    check_packages(
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_pre_commit_hooks/alpha_spec.py", line 165, in check_packages
    check_package_spec(linter, args, anchors, used_anchors, package_spec)
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_pre_commit_hooks/alpha_spec.py", line 119, in check_package_spec
    in get_rapids_version(args).prerelease_packages
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_pre_commit_hooks/alpha_spec.py", line 48, in get_rapids_version
    md = all_metadata()
         ^^^^^^^^^^^^^^
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_pre_commit_hooks/alpha_spec.py", line 40, in all_metadata
    return fetch_latest()
           ^^^^^^^^^^^^^^
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_metadata/remote.py", line 33, in fetch_latest
    return _fetch_from_url(_GITHUB_METADATA_URL)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/Snh3JbNeSBuwwobXK8YN9w/py_env-python3/lib/python3.12/site-packages/rapids_metadata/remote.py", line 28, in _fetch_from_url
    with urllib.request.urlopen(url) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 515, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 532, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 1392, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 1347, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

Example run: https://results.pre-commit.ci/run/github/160453496/1733415061.N-S7Hv6PT7CcB8uDhTexlA

Discovered while working on https://github.com/rapidsai/rmm/pull/1746. For now, skipping verify-alpha-spec in pre-commit.ci is sufficient. We will need to continue using self-hosted runners for style checks anyway, due to limitations like those described here: https://github.com/rapidsai/build-planning/issues/124#issuecomment-2520664022

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the verify-alpha-spec entry point and the alpha_spec.py and rapids_metadata/remote.py frames shown in the traceback. Reproduce the hook in pre-commit.ci using the linked run, then determine how its GitHub metadata fetch behaves under that environment. Done means the pre-commit.ci failure has a tested, documented resolution or a clearly defined supported limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.