ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.0.50
    • Affects Version/s: None
    • Component/s: None
    • None
    • DevProd Build
    • ALL
    • Build OnDeck
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Problem

      The v7.0 staging package-test driver fails during import on hosts using Python 3.9.2. Type annotations in buildscripts/package_test_provenance.py are evaluated at module import time; the PEP 604 union expression Path | None requires Python 3.10 unless annotations are postponed.

      The failure happens before any package installation or package tests run. The representative RHEL 8 task reports zero test results.

      Observed failure

      Waterfall build, revision e779dc47c3c78688fe2ae47170eca1a8de82d558, MongoDB 7.0.49.

      RHEL 8 test_packages, execution 0 / BFG-3790791:

      python version: Python 3.9.2
      Traceback (most recent call last):
        File ".../src/buildscripts/package_test.py", line 29, in <module>
          from buildscripts.package_test_provenance import validate_package_build_provenance
        File ".../src/buildscripts/package_test_provenance.py", line 117, in <module>
          archive_path: Path | None = None) -> dict[str, str] | None:
      TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
      

      The waterfall contains 11 failures grouped under this import error: amazon2, enterprise-amazon2, rhel8, enterprise-rhel-8-64-bit, custom-build-splunk-openssl3-rhel8-x86_64, suse12, enterprise-suse12-64, suse15, enterprise-suse15-64, ubuntu2004, and enterprise-ubuntu2004-64.

      Requested change

      Postpone evaluation of annotations in the package provenance helper (for example, add from _future_ import annotations before other imports). Audit the package-test import path for other annotations that are evaluated on older release-branch Python runtimes. Retain the modern type annotations while allowing the existing v7.0 Python 3.9 package-test environment to import the helpers.

      Acceptance criteria

      • buildscripts.package_test and its provenance helpers import successfully with the Python 3.9 environment used by v7.0 package-test hosts.
      • Existing package/provenance unit tests pass on the supported development Python version; meaningful coverage catches annotation evaluation on the release-branch interpreter.
      • Representative affected test_packages tasks proceed beyond driver import and execute package tests.
      • Backport the fix to v7.0.

            Assignee:
            Daniel Moody
            Reporter:
            Daniel Moody
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: