Skip to content

fix(deps): cap munkres below 2 - #737

Open
digalaviz wants to merge 1 commit into
awslabs:devfrom
digalaviz:fix/cap-munkres-below-2
Open

digalaviz wants to merge 1 commit into
awslabs:devfrom
digalaviz:fix/cap-munkres-below-2

Conversation

@digalaviz

Copy link
Copy Markdown
Contributor

tl;dr for humans

The same two lists could give different per-item counts depending on which munkres build was installed. munkres 2.x and 3.x are a rewrite, and each build breaks ties between equally good assignments differently. This caps munkres below 2, so users get the same solver CI tests (1.1.4, already in uv.lock). Totals and scores of untied lists don't change.


for agents

  • intent: fixes the root cause of warehouse notebook: results hash differs on macOS #736. The same input should give the same counts on every install.
  • behavior:
    • trigger: a list field where two or more assignments have exactly the same total similarity.
    • effect: HungarianMatcher.match (src/stickler/algorithms/hungarian.py) returns whichever optimum munkres.Munkres().compute picks. Each build picks differently:
      • 1.1.4: pure Python.
      • 3.0.0 with the native kernel: the wheels for macOS and Linux x86_64.
      • 3.0.0 with the Python fallback: Linux arm64, where there is no wheel and no compiler.
    • affected: which ground-truth item counts as FN, FD or TP, so per-object rows, non_matches and anything sliced from them.
    • unchanged: similarity matrices, which are bit-identical across builds, and lists without ties.
  • code:
    • pyproject.toml: munkres>=1.1.4,<2.
    • uv.lock: the matching requires-dist specifier. The locked version stays 1.1.4, and uv lock --check passes.
    • CHANGELOG: an [Unreleased] Fixed entry with an upgrade note.
  • commits: fix(deps): cap munkres below 2. It's a fix: it corrects results that depended on the install. No public API changes.
  • verification:
    • frames: in the warehouse notebook, frames 6078 and 6615 of near_vehicle_miss under the strict schema have bit-identical similarity matrices on every platform, and two assignments tie at 48.667 and 49.667. With munkres 1.1.4, the chosen pairs are identical on python:3.12-slim arm64, python:3.12-slim amd64 and macOS arm64. With 3.0.0, the native wheels (amd64 and macOS) pick one optimum, and the arm64 fallback picks another.
    • fresh resolve: uv pip compile pyproject.toml in a clean amd64 container resolves munkres==1.1.4.
    • suite with 3.0.0: the full suite on dev with munkres 3.0.0 forced (amd64 container) gives 7463 passed, 19 skipped and 1 xfailed. No test pins tie-breaking, which is why CI didn't catch this.
  • supply chain: munkres 2.0.0 (2026-10-06) and 3.0.0 (2026-10-18) were published under the same PyPI name by a new maintainer. They are a ground-up rewrite with optional native C code, "modified from munkres 1.1.4 by Brian M. Clapper" according to their CHANGELOG. I found nothing malicious, and I didn't audit the native code. The cap also keeps that code out of installs until someone reviews it.
  • not covered:
    • stickler doesn't break ties itself, so lifting the cap later needs a deterministic tie-break, for example a canonical optimum.
    • No regression test pins a tie. Such a test would only pass on the solver it was written against.
    • The warehouse notebook still needs re-recording against 1.1.4. That change goes in docs(examples): pin the warehouse notebook to stickler-eval 1.1.0 #734.

- munkres 2.x and 3.x are a rewrite with a native kernel and a pure
  python fallback; each of the three solvers breaks a tie between
  equally good assignments differently, so the same lists could give
  different fn, fd and tp per item by platform
- uv.lock already pins 1.1.4, so ci tested a different solver than a
  fresh install of 1.1.0 got (3.0.0)
- 1.1.4 gives identical assignments on linux arm64, linux amd64 and
  macos for the warehouse notebook frames that differed
@digalaviz
digalaviz requested a review from sromoam as a code owner December 5, 2026 02:35
@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

Security Scan Results

ASH Security Scan Report

  • Report generated: 2026-12-05T02:44:10+00:00
  • Time since scan: 2 minutes

Scan Metadata

  • Project: ASH
  • Scan executed: 2026-12-05T02:41:15+00:00
  • ASH version: 3.1.2

Summary

Scanner Results

The table below shows findings by scanner, with status based on severity thresholds and dependencies:

  • Severity levels:
    • Suppressed (S): Findings that have been explicitly suppressed and don't affect scanner status
    • Critical (C): Highest severity findings that require immediate attention
    • High (H): Serious findings that should be addressed soon
    • Medium (M): Moderate risk findings
    • Low (L): Lower risk findings
    • Info (I): Informational findings with minimal risk
  • Duration (Time): Time taken by the scanner to complete its execution
  • Actionable: Number of findings at or above the threshold severity level that require attention
  • Result:
    • PASSED = No findings at or above threshold
    • FAILED = Findings at or above threshold
    • MISSING = Required dependencies not available
    • SKIPPED = Scanner explicitly disabled
    • ERROR = Scanner execution error
  • Threshold: The minimum severity level that will cause a scanner to fail
    • Thresholds: ALL, LOW, MEDIUM, HIGH, CRITICAL
    • Source: Values in parentheses indicate where the threshold is set:
      • global (global_settings section in the ASH_CONFIG used)
      • config (scanner config section in the ASH_CONFIG used)
      • scanner (default configuration in the plugin, if explicitly set)
  • Statistics calculation:
    • All statistics are calculated from the final aggregated SARIF report
    • Suppressed findings are counted separately and do not contribute to actionable findings
    • Scanner status is determined by comparing actionable findings to the threshold
Scanner Suppressed Critical High Medium Low Info Actionable Result Threshold
bandit 0 0 0 0 8237 0 0 PASSED MEDIUM (global)
cdk-nag 0 0 0 0 0 0 0 PASSED MEDIUM (global)
cfn-nag 0 0 0 0 0 0 0 MISSING MEDIUM (global)
checkov 0 0 0 0 0 0 0 PASSED MEDIUM (global)
detect-secrets 0 0 0 0 0 0 0 PASSED MEDIUM (global)
grype 0 0 0 0 0 0 0 MISSING MEDIUM (global)
npm-audit 0 0 0 0 0 0 0 PASSED MEDIUM (global)
opengrep 0 0 0 0 0 0 0 MISSING MEDIUM (global)
semgrep 7 0 0 0 0 0 0 PASSED MEDIUM (global)
syft 0 0 0 0 0 0 0 MISSING MEDIUM (global)

Report generated by Automated Security Helper (ASH) at 2026-12-05T02:44:11+00:00

This branch has not been deployed

No deployments
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.

1 participant