[GH-ISSUE #4526] [Other] The wheel-lock agreement test re-parses requirements with a regex: an extras pin escapes it, and an OS-conditional pin is unsatisfiable #2040

Closed
opened 2026-11-04 01:56:10 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @TheHubUser4860938 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4526

Problem: tests/terminal/test_packaging_pins.py::WheelLocks::test_the_locks_agree_with_requirements_txt does not use the parser that made the locks. It rebuilds the pin list with re.match(r"^([A-Za-z0-9_.-]+)==([^\s;]+)(?:\s*;\s*(.*))?$", …) and then handles markers by name (colorama and numpy are special-cased by hand). Two holes follow, and both are the check disagreeing with packaging/lock_wheels.py, which parses the same lines with packaging.requirements.Requirement.

(a) An extras pin is invisible. The character class has no brackets, so a pin like psycopg[binary]==3.3.6 matches nothing and is never looked for in any lock. Measured: re.match(r"^([A-Za-z0-9_.-]+)==([^\s;]+)(?:\s*;\s*(.*))?$", "psycopg[binary]==3.3.6") returns None, while the same line with a plain name (fasteners==0.20) matches. A lock that dropped the package would still pass.

(b) Any other OS-conditional pin cannot be satisfied. The loop demands every pinned name in every lock, whatever its marker says, so a pin like embedded-postgres==18.6.3; sys_platform != "win32" is demanded in the Windows lock too - where lock_wheels.py correctly drops it, so no lock content can make the test green (short of shipping a non-Windows server wheel into the Windows archive). Measured on a tree that adds the two store pins: the test fails on all four locks with AssertionError: None != '18.6.3' : embedded-postgres - 4 of 4 subtests, the only failing test in the file.

Environment:
Strata Version: 0.2.7.1 (source checkout at tag v0.2.7.1, commit 46c152a1; the test file is upstream's own, unmodified by this fork)
OS: Linux x86-64 - Runtime: Python 3.14 host, pytest run of the single file

Expected: the check agrees with the tool that builds the locks - a pin is required in the locks where its marker applies to that target and is not required where it does not; and a pin with extras is checked like any other pin.

Suggested shape: parse both files with Requirement (already imported by lock_wheels.py), and per lock evaluate the marker against the environment lock_wheels.TARGETS[target]["env"] + python_version = PYTHON - the same source the lock was built with, so the test cannot drift from the tool. Skip a pin whose marker is false for that target rather than asserting absence: a lock may still need that package transitively, which is exactly the trap in #4525.

Reproduction status: measured on this box - the regex probe above, and the 4-of-4 subtest failures with the fork's two pins present (embedded-postgres non-Windows, pixeltable-pgserver Windows-only). Upstream's own requirements carry no OS-conditional pin today besides colorama (its only other marker, truststore; python_version >= "3.10", applies to all four targets), so both halves are latent for mainline until someone adds one - at which point (b) is a wall and (a) is a silent gap.

Originally created by @TheHubUser4860938 on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4526 Problem: `tests/terminal/test_packaging_pins.py::WheelLocks::test_the_locks_agree_with_requirements_txt` does not use the parser that made the locks. It rebuilds the pin list with `re.match(r"^([A-Za-z0-9_.-]+)==([^\s;]+)(?:\s*;\s*(.*))?$", …)` and then handles markers by name (`colorama` and `numpy` are special-cased by hand). Two holes follow, and both are the check disagreeing with `packaging/lock_wheels.py`, which parses the same lines with `packaging.requirements.Requirement`. **(a) An extras pin is invisible.** The character class has no brackets, so a pin like `psycopg[binary]==3.3.6` matches nothing and is never looked for in any lock. Measured: `re.match(r"^([A-Za-z0-9_.-]+)==([^\s;]+)(?:\s*;\s*(.*))?$", "psycopg[binary]==3.3.6")` returns `None`, while the same line with a plain name (`fasteners==0.20`) matches. A lock that dropped the package would still pass. **(b) Any other OS-conditional pin cannot be satisfied.** The loop demands every pinned name in every lock, whatever its marker says, so a pin like `embedded-postgres==18.6.3; sys_platform != "win32"` is demanded in the Windows lock too - where `lock_wheels.py` correctly drops it, so no lock content can make the test green (short of shipping a non-Windows server wheel into the Windows archive). Measured on a tree that adds the two store pins: the test fails on all four locks with `AssertionError: None != '18.6.3' : embedded-postgres` - 4 of 4 subtests, the only failing test in the file. Environment: **Strata Version:** 0.2.7.1 (source checkout at tag v0.2.7.1, commit 46c152a1; the test file is upstream's own, unmodified by this fork) **OS:** Linux x86-64 - **Runtime:** Python 3.14 host, pytest run of the single file Expected: the check agrees with the tool that builds the locks - a pin is required in the locks where its marker applies to that target and is not required where it does not; and a pin with extras is checked like any other pin. Suggested shape: parse both files with `Requirement` (already imported by `lock_wheels.py`), and per lock evaluate the marker against the environment `lock_wheels.TARGETS[target]["env"]` + `python_version = PYTHON` - the same source the lock was built with, so the test cannot drift from the tool. Skip a pin whose marker is false for that target rather than asserting absence: a lock may still need that package transitively, which is exactly the trap in #4525. Reproduction status: measured on this box - the regex probe above, and the 4-of-4 subtest failures with the fork's two pins present (`embedded-postgres` non-Windows, `pixeltable-pgserver` Windows-only). Upstream's own requirements carry no OS-conditional pin today besides `colorama` (its only other marker, `truststore; python_version >= "3.10"`, applies to all four targets), so both halves are latent for mainline until someone adds one - at which point (b) is a wall and (a) is a silent gap.
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6660605029 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2040
No description provided.